buli
2023-07-10 f05bfc9a39bccc8afb928efe7555f21e0e69c5bd
backupfixtablecolumn0710
14个文件已修改
17476 ■■■■■ 已修改文件
force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.js 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.html 326 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.js 926 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.html 1800 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js 3749 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumable/lexConsumable.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.html 414 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js 782 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.html 2563 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js 5205 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexTopPage/lexTopPage.html 283 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexTopPage/lexTopPage.js 1390 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manifest/package.xml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexArriveGoods/lexArriveGoods.js
@@ -154,7 +154,7 @@
      },
      hideDefaultActions: true,
      wrapText: true,
      initialWidth: 180
      initialWidth: 95
    });
    // cols.push({label:'出库单' , fieldName:'orderNo', hideDefaultActions: true});
    cols.push({
@@ -169,22 +169,22 @@
      fieldName: "prodName",
      wrapText: true,
      hideDefaultActions: true,
      wrapText: true,
      initialWidth: 190
      wrapText: true
      // initialWidth: 190
    });
    cols.push({
      label: "出库目的",
      fieldName: "summonsForDirctionDet",
      wrapText: true,
      hideDefaultActions: true,
      initialWidth: 130
      initialWidth: 85
    });
    cols.push({
      label: "客户名",
      fieldName: "hospitalName",
      hideDefaultActions: true,
      wrapText: true,
      initialWidth: 130
      initialWidth: 85
    });
    cols.push({
      label: "经销商",
force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.html
@@ -1,109 +1,227 @@
<template>
    <template if:true={showSpinner}>
        <!-- <lightning-spinner size="medium" variant="brand"></lightning-spinner> -->
        <div class="slds-spinner_container">
            <div role="status" class="slds-spinner slds-spinner_medium slds-spinner_brand">
                <span class="slds-assistive-text">Loading</span>
                <div class="slds-spinner__dot-a"></div>
                <div class="slds-spinner__dot-b"></div>
            </div>
        </div>
    </template>
    <c-common-toast></c-common-toast>
    <template if:true={showPage}>
        <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;">
            <div style="padding:10px;">
                <!-- 按钮 -->
                <!-- <lightning-button style="margin: 5px;" label="入库" onclick={orderArrive}></lightning-button>
  <template if:true={showSpinner}>
    <!-- <lightning-spinner size="medium" variant="brand"></lightning-spinner> -->
    <div class="slds-spinner_container">
      <div
        role="status"
        class="slds-spinner slds-spinner_medium slds-spinner_brand"
      >
        <span class="slds-assistive-text">Loading</span>
        <div class="slds-spinner__dot-a"></div>
        <div class="slds-spinner__dot-b"></div>
      </div>
    </div>
  </template>
  <c-common-toast></c-common-toast>
  <template if:true={showPage}>
    <div
      style="
        border: 1px solid #d4d4d4;
        border-top: 3px solid #51606e;
        border-radius: 5px;
      "
    >
      <div style="padding: 10px">
        <!-- 按钮 -->
        <!-- <lightning-button style="margin: 5px;" label="入库" onclick={orderArrive}></lightning-button>
                <lightning-button style="margin: 5px;" label="返品" onclick={orderReturn}></lightning-button> -->
                <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;margin-right: 150px;" label="入库" onclick={orderArrive}>入库</button>
                <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="margin: 5px;" label="返品" onclick={orderReturn}>返品</button>
                <p style="height: 10px;"></p>
                <!-- 检索条件 -->
                <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
                    <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
                        <lightning-layout>
                            <lightning-layout-item padding="around-small">
                                <p style="font-size: 18px">
                                    <strong>检索条件</strong>
                                </p>
                            </lightning-layout-item>
                        </lightning-layout>
                        <!-- <p style="font-size: 16px;"><strong>检索条件</strong></p> -->
        <button
          class="slds-button slds-button_neutral slds-button_stretch lexBorder"
          style="margin: 5px; margin-right: 150px"
          label="入库"
          onclick={orderArrive}
        >
          入库
        </button>
        <button
          class="slds-button slds-button_neutral slds-button_stretch lexBorder"
          style="margin: 5px"
          label="返品"
          onclick={orderReturn}
        >
          返品
        </button>
        <p style="height: 10px"></p>
        <!-- 检索条件 -->
        <div
          style="
            border: 1px solid #d4d4d4;
            border-top: 3px solid #51606e;
            border-radius: 5px;
            margin-bottom: 7px;
          "
        >
          <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
            <lightning-layout>
              <lightning-layout-item padding="around-small">
                <p style="font-size: 18px">
                  <strong>检索条件</strong>
                </p>
              </lightning-layout-item>
            </lightning-layout>
            <!-- <p style="font-size: 16px;"><strong>检索条件</strong></p> -->
          </div>
          <div style="padding: 10px">
            <table>
              <tbody>
                <tr>
                  <td style="width: 10px"></td>
                  <td style="width: 120px">
                    <div
                      style="color: #696969; font-size: 16px; text-align: left"
                    >
                      消耗品订单名称
                    </div>
                    <div style="padding:10px;">
                        <table>
                            <tbody>
                                <tr>
                                    <td style="width: 10px;"></td>
                                    <td style="width: 120px;">
                                        <div style="color:#696969;font-size:16px;text-align: left;">消耗品订单名称</div>
                                    </td>
                                    <td>
                                        <lightning-input class="inputFont" type="text" variant="label-hidden" label="消耗品订单名称" value={category1} onchange={category1Change}></lightning-input>
                                    </td>
                                    <td style="width: 30px;"></td>
                                    <td  style="width: 108px;">
                                        <div style="color:#696969;font-size:16px;text-align: left;">最新发货日期</div>
                                    </td>
                                    <td>
                                        <lightning-input class="inputFont" type="date" variant="label-hidden" label="最新发货日期" value={cate2} onchange={cate2Change}></lightning-input>
                                    </td>
                                    <td style="width: 30px;"></td>
                                    <td>
                                        <!-- <lightning-button style="margin-left: 10px;margin-right: 5px;" label="搜索" onclick={search}></lightning-button>
                  </td>
                  <td>
                    <lightning-input
                      class="inputFont"
                      type="text"
                      variant="label-hidden"
                      label="消耗品订单名称"
                      value={category1}
                      onchange={category1Change}
                    ></lightning-input>
                  </td>
                  <td style="width: 30px"></td>
                  <td style="width: 108px">
                    <div
                      style="color: #696969; font-size: 16px; text-align: left"
                    >
                      最新发货日期
                    </div>
                  </td>
                  <td>
                    <lightning-input
                      class="inputFont"
                      type="date"
                      variant="label-hidden"
                      label="最新发货日期"
                      value={cate2}
                      onchange={cate2Change}
                    ></lightning-input>
                  </td>
                  <td style="width: 30px"></td>
                  <td>
                    <!-- <lightning-button style="margin-left: 10px;margin-right: 5px;" label="搜索" onclick={search}></lightning-button>
                                        <lightning-button style="margin-left: 5px;margin-right: 5px;" label="清空" onclick={clear}></lightning-button> -->
                                        <button class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle" style="height:32px;margin-right: 30px;" label="搜索" onclick={search}>搜索</button>
                                        <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" style="height:32px;" label="清空" onclick={clear}>清空</button>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
                <!-- 订单明细 -->
                <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
                    <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
                        <lightning-layout>
                            <lightning-layout-item padding="around-small">
                                <p style="font-size: 18px">
                                    <strong>订单明细</strong>
                                </p>
                            </lightning-layout-item>
                        </lightning-layout>
                        <!-- <p style="font-size: 16px;"><strong>订单明细</strong></p> -->
                    </div>
                    <div style="padding:10px;">
                        <!-- <lightning-datatable hide-checkbox-column key-field="id" columns={colms}  data={raesList}></lightning-datatable> -->
                        <c-lex-custom-lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="Id" data={raesList} columns={colms} onclicklink={clickLick}></c-lex-custom-lightning-datatable>
                    </div>
                </div>
            </div>
        </div>
    </template>
    <!-- 订单各种数量信息弹窗 -->
    <template if:true={showPop}>
        <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open slds-modal_small" style="border: 1px solid #D4D4D4;">
            <div class="slds-modal__container">
                <header class="slds-modal__header" style="background-color: #F3F3F3;">
                    <button style="" class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close" onclick={closePop}>
                        <lightning-icon icon-name="utility:close"
                            alternative-text="close"
                            variant="inverse"
                            size="small" ></lightning-icon>
                        <span class="slds-assistive-text">Close</span>
                    <button
                      class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                      style="height: 32px; margin-right: 30px"
                      label="搜索"
                      onclick={search}
                    >
                      搜索
                    </button>
                    <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">{popTitle}</h2>
                </header>
                <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1" style="border: 1px solid #F3F3F3;">
                    <lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="prodModel" columns={colms2}  data={recordList}></lightning-datatable>
                </div>
                <footer class="slds-modal__footer">
                    <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="关闭" onclick={closePop}></lightning-button> -->
                    <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" style="margin-left: 10px;" variant="neutral" label="关闭" onclick={closePop}>关闭</button>
                </footer>
            </div>
        </section>
        <div class="slds-backdrop slds-backdrop_open"></div>
    </template>
</template>
                    <button
                      class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
                      style="height: 32px"
                      label="清空"
                      onclick={clear}
                    >
                      清空
                    </button>
                  </td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
        <!-- 订单明细 -->
        <div
          style="
            border: 1px solid #d4d4d4;
            border-top: 3px solid #51606e;
            border-radius: 5px;
            margin-bottom: 7px;
          "
        >
          <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
            <lightning-layout>
              <lightning-layout-item padding="around-small">
                <p style="font-size: 18px">
                  <strong>订单明细</strong>
                </p>
              </lightning-layout-item>
            </lightning-layout>
            <!-- <p style="font-size: 16px;"><strong>订单明细</strong></p> -->
          </div>
          <div style="padding: 10px">
            <!-- <lightning-datatable hide-checkbox-column key-field="id" columns={colms}  data={raesList}></lightning-datatable> -->
            <c-lex-custom-lightning-datatable
              class="wrapped-header-datatable"
              hide-checkbox-column
              key-field="Id"
              data={raesList}
              columns={colms}
              onclicklink={clickLick}
            ></c-lex-custom-lightning-datatable>
          </div>
        </div>
      </div>
    </div>
  </template>
  <!-- 订单各种数量信息弹窗 -->
  <template if:true={showPop}>
    <section
      role="dialog"
      tabindex="-1"
      aria-labelledby="modal-heading-01"
      aria-modal="true"
      aria-describedby="modal-content-id-1"
      class="slds-modal slds-fade-in-open slds-modal_small"
      style="border: 1px solid #d4d4d4"
    >
      <div class="slds-modal__container">
        <header class="slds-modal__header" style="background-color: #f3f3f3">
          <button
            style=""
            class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
            title="Close"
            onclick={closePop}
          >
            <lightning-icon
              icon-name="utility:close"
              alternative-text="close"
              variant="inverse"
              size="small"
            ></lightning-icon>
            <span class="slds-assistive-text">Close</span>
          </button>
          <h2
            id="modal-heading-01"
            class="slds-text-heading_medium slds-hyphenate"
          >
            {popTitle}
          </h2>
        </header>
        <div
          class="slds-modal__content slds-p-around_medium"
          id="modal-content-id-1"
          style="border: 1px solid #f3f3f3"
        >
          <lightning-datatable
            class="wrapped-header-datatable"
            hide-checkbox-column
            key-field="prodModel"
            columns={colms2}
            data={recordList}
          ></lightning-datatable>
        </div>
        <footer class="slds-modal__footer">
          <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="关闭" onclick={closePop}></lightning-button> -->
          <button
            class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
            style="margin-left: 10px"
            variant="neutral"
            label="关闭"
            onclick={closePop}
          >
            关闭
          </button>
        </footer>
      </div>
    </section>
    <div class="slds-backdrop slds-backdrop_open"></div>
  </template>
</template>
force-app/main/default/lwc/lexArriveGoodsMain/lexArriveGoodsMain.js
@@ -1,417 +1,523 @@
import { LightningElement,wire,api,track } from 'lwc';
import { CurrentPageReference } from 'lightning/navigation';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { NavigationMixin } from 'lightning/navigation';
import init from '@salesforce/apex/LexArriveGoodsMainController.init';
import searchConsumableorderdetails from '@salesforce/apex/LexArriveGoodsMainController.searchConsumableorderdetails';
import initTotalNum from '@salesforce/apex/LexConsumableGoodsInfo.initTotalNum';
import initArrDet from '@salesforce/apex/LexConsumableGoodsInfo.initArrDet';
import initArrDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initArrDetAll';
import initDeliveryDet from '@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDet';
import initDeliveryDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDetAll';
import initNotArrDet from '@salesforce/apex/LexConsumableGoodsInfo.initNotArrDet';
import initNotArrDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initNotArrDetAll';
import initMoreThan7 from '@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7';
import initMoreThan7All from '@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7All';
//table css
import { LightningElement, wire, api, track } from "lwc";
import { CurrentPageReference } from "lightning/navigation";
import { ShowToastEvent } from "lightning/platformShowToastEvent";
import { NavigationMixin } from "lightning/navigation";
import init from "@salesforce/apex/LexArriveGoodsMainController.init";
import searchConsumableorderdetails from "@salesforce/apex/LexArriveGoodsMainController.searchConsumableorderdetails";
import initTotalNum from "@salesforce/apex/LexConsumableGoodsInfo.initTotalNum";
import initArrDet from "@salesforce/apex/LexConsumableGoodsInfo.initArrDet";
import initArrDetAll from "@salesforce/apex/LexConsumableGoodsInfo.initArrDetAll";
import initDeliveryDet from "@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDet";
import initDeliveryDetAll from "@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDetAll";
import initNotArrDet from "@salesforce/apex/LexConsumableGoodsInfo.initNotArrDet";
import initNotArrDetAll from "@salesforce/apex/LexConsumableGoodsInfo.initNotArrDetAll";
import initMoreThan7 from "@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7";
import initMoreThan7All from "@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7All";
//table css
import { loadStyle } from "lightning/platformResourceLoader";
import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
export default class LexArriveGoodsMain extends NavigationMixin(LightningElement) {
    //页面基础变量
    @track agencyProType;
    @track category1;
    @track cate2;
    // @track eSetId;
    @track accountId;
    @track title = [];
    @track raesList = [];
    @track recordList = [];
    @track userWorkLocation;
    @track totalNum;
    @track orderNumberArrived;
    @track deliveryDetailCount;
    @track orderNumberNotarrive;
    @track moreThanSevenDays;
    @track showSpinner = true;
    @track showPage = false;
    @track showPop = false;
    @track popTitle;
    stylesLoaded = false;
    //是否一直显示提示
    @track isNoteStay = true;
export default class LexArriveGoodsMain extends NavigationMixin(
  LightningElement
) {
  //页面基础变量
  @track agencyProType;
  @track category1;
  @track cate2;
  // @track eSetId;
  @track accountId;
  @track title = [];
  @track raesList = [];
  @track recordList = [];
  @track userWorkLocation;
  @track totalNum;
  @track orderNumberArrived;
  @track deliveryDetailCount;
  @track orderNumberNotarrive;
  @track moreThanSevenDays;
  @track showSpinner = true;
  @track showPage = false;
  @track showPop = false;
  @track popTitle;
  stylesLoaded = false;
  //是否一直显示提示
  @track isNoteStay = true;
    @track colms = [
        // {label:'消耗品订单名称',fieldName:'Name'},
        // {label:'订单总数',fieldName:'Total_num__c'},
        // {label:'已到货数量',fieldName:'OrderNumber_arrived__c'},
        // {label:'待系统操作入库数量',fieldName:'Delivery_detail_count__c'},
        // {label:'还没发货数量',fieldName:'OrderNumber_notarrive__c'},
        // {label:'发货七天还未到货数',fieldName:'More_than_seven_days__c'},
        {label:'消耗品订单名称',
            type: "customOutputGood",
            typeAttributes: {
                outputValue: { fieldName: "Name" },
                type: 'Title',
                recordId: { fieldName: "Id" }
            },
            hideDefaultActions: true,initialWidth:200,wrapText:true},
        {label:'SAP合同号',fieldName:'ContractNo__c',hideDefaultActions: true,wrapText:true,initialWidth:180},
        {label:'订单总数',
            type: "customOutputGood",
            typeAttributes: {
                outputValue: { fieldName: "Total_num__c" },
                type: 'TotalNum',
                recordId: { fieldName: "Id" }
            },
            hideDefaultActions: true, initialWidth: 100,cellAttributes: { alignment: "right" }},
        {label:'已到货数量',
            type: "customOutputGood",
            typeAttributes: {
                outputValue: { fieldName: "OrderNumber_arrived__c" },
                type: 'ArrDet',
                recordId: { fieldName: "Id" }
            },
            hideDefaultActions: true, initialWidth: 110,cellAttributes: { alignment: "right" }},
        {label:'待系统操作入库数量',
            type: "customOutputGood",
            typeAttributes: {
                outputValue: { fieldName: "Delivery_detail_count__c" },
                type: 'DeliveryDet',
                recordId: { fieldName: "Id" }
            },
            hideDefaultActions: true, initialWidth: 180,cellAttributes: { alignment: "right" }},
        {label:'还没发货数量',
            type: "customOutputGood",
            typeAttributes: {
                outputValue: { fieldName: "OrderNumber_notarrive__c" },
                type: 'NotArrDet',
                recordId: { fieldName: "Id" }
            },
            hideDefaultActions: true, initialWidth: 120,cellAttributes: { alignment: "right" }},
        {label:'发货七天还未到货数',
            type: "customOutputGood",
            typeAttributes: {
                outputValue: { fieldName: "More_than_seven_days__c" },
                type: 'MoreThan7',
                recordId: { fieldName: "Id" }
            },
            hideDefaultActions: true, initialWidth: 180,cellAttributes: { alignment: "right" }},
        {label:'最新发货日期',fieldName:'Shipment_date__c',hideDefaultActions: true, initialWidth: 140},
        {label:'首次发货日期',fieldName:'First_Delivery__c',hideDefaultActions: true, initialWidth: 140}
    ];
  @track colms = [
    // {label:'消耗品订单名称',fieldName:'Name'},
    // {label:'订单总数',fieldName:'Total_num__c'},
    // {label:'已到货数量',fieldName:'OrderNumber_arrived__c'},
    // {label:'待系统操作入库数量',fieldName:'Delivery_detail_count__c'},
    // {label:'还没发货数量',fieldName:'OrderNumber_notarrive__c'},
    // {label:'发货七天还未到货数',fieldName:'More_than_seven_days__c'},
    {
      label: "消耗品订单名称",
      type: "customOutputGood",
      typeAttributes: {
        outputValue: { fieldName: "Name" },
        type: "Title",
        recordId: { fieldName: "Id" }
      },
      hideDefaultActions: true,
      // initialWidth: 200,
      wrapText: true
    },
    {
      label: "SAP合同号",
      fieldName: "ContractNo__c",
      hideDefaultActions: true,
      wrapText: true,
      initialWidth: 180
    },
    {
      label: "订单总数",
      type: "customOutputGood",
      typeAttributes: {
        outputValue: { fieldName: "Total_num__c" },
        type: "TotalNum",
        recordId: { fieldName: "Id" }
      },
      hideDefaultActions: true,
      initialWidth: 100,
      cellAttributes: { alignment: "right" }
    },
    {
      label: "已到货数量",
      type: "customOutputGood",
      typeAttributes: {
        outputValue: { fieldName: "OrderNumber_arrived__c" },
        type: "ArrDet",
        recordId: { fieldName: "Id" }
      },
      hideDefaultActions: true,
      initialWidth: 100,
      cellAttributes: { alignment: "right" }
    },
    {
      label: "待系统操作入库数量",
      type: "customOutputGood",
      typeAttributes: {
        outputValue: { fieldName: "Delivery_detail_count__c" },
        type: "DeliveryDet",
        recordId: { fieldName: "Id" }
      },
      hideDefaultActions: true,
      initialWidth: 150,
      cellAttributes: { alignment: "right" }
    },
    {
      label: "还没发货数量",
      type: "customOutputGood",
      typeAttributes: {
        outputValue: { fieldName: "OrderNumber_notarrive__c" },
        type: "NotArrDet",
        recordId: { fieldName: "Id" }
      },
      hideDefaultActions: true,
      initialWidth: 120,
      cellAttributes: { alignment: "right" }
    },
    {
      label: "发货七天还未到货数",
      type: "customOutputGood",
      typeAttributes: {
        outputValue: { fieldName: "More_than_seven_days__c" },
        type: "MoreThan7",
        recordId: { fieldName: "Id" }
      },
      hideDefaultActions: true,
      initialWidth: 150,
      cellAttributes: { alignment: "right" }
    },
    {
      label: "最新发货日期",
      fieldName: "Shipment_date__c",
      hideDefaultActions: true,
      initialWidth: 105
    },
    {
      label: "首次发货日期",
      fieldName: "First_Delivery__c",
      hideDefaultActions: true,
      initialWidth: 105
    }
  ];
    @track colms2 = [
        {label:'产品型号',fieldName:'prodModel',hideDefaultActions: true},
        {label:'数量',fieldName:'recordCount',hideDefaultActions: true,initialWidth: 100}
    ];
  @track colms2 = [
    { label: "产品型号", fieldName: "prodModel", hideDefaultActions: true },
    {
      label: "数量",
      fieldName: "recordCount",
      hideDefaultActions: true,
      initialWidth: 100
    }
  ];
    //获取参数
    // @wire(CurrentPageReference)
    // getStateParameters(currentPageReference) {
    //     console.log('CurrentPageReference');
    //     if (currentPageReference) {
    //         this.eSetId = currentPageReference.state?.ESetid;
    //     }
  //获取参数
  // @wire(CurrentPageReference)
  // getStateParameters(currentPageReference) {
  //     console.log('CurrentPageReference');
  //     if (currentPageReference) {
  //         this.eSetId = currentPageReference.state?.ESetid;
  //     }
  // }
  renderedCallback() {
    if (!this.stylesLoaded) {
      Promise.all([loadStyle(this, WrappedHeaderTable)])
        .then(() => {
          console.log("Custom styles loaded");
          this.stylesLoaded = true;
        })
        .catch((error) => {
          console.error("Error loading custom styles");
        });
    }
  }
  //初始化
  connectedCallback() {
    init().then((result) => {
      this.isNoteStay = result.isNoteStay;
      if (result.result == "Success") {
        this.agencyProType = result.agencyProType;
        this.accountId = result.accountId;
        this.title = result.title;
        this.userWorkLocation = result.userWorkLocation;
        this.totalNum = result.totalNum;
        this.orderNumberArrived = result.orderNumberArrived;
        this.deliveryDetailCount = result.deliveryDetailCount;
        this.orderNumberNotarrive = result.orderNumberNotarrive;
        this.moreThanSevenDays = result.moreThanSevenDays;
        this.raesList = result.raesList;
        this.raesList.push({
          Id: "1",
          Name: "订单明细汇总",
          Total_num__c: this.totalNum,
          OrderNumber_arrived__c: this.orderNumberArrived,
          Delivery_detail_count__c: this.deliveryDetailCount,
          OrderNumber_notarrive__c: this.orderNumberNotarrive,
          More_than_seven_days__c: this.moreThanSevenDays
        });
        this.showSpinner = false;
        this.showPage = true;
      } else {
        this.showSpinner = false;
        console.log("Error:" + result.errorMsg);
        this.showMyToast("初始化页面失败", result.errorMsg, "error");
      }
    });
  }
  //点击链接
  clickLick(event) {
    var outputValue = event.detail.data.value;
    var outputType = event.detail.data.type;
    var recordId = event.detail.data.recordId;
    console.log("click:" + outputValue + "---" + outputType + "---" + recordId);
    if (outputType == "Title") {
      const config = {
        type: "standard__webPage",
        attributes: {
          url: "/lexarrivegoods?ESetId=" + recordId
        }
      };
      this[NavigationMixin.Navigate](config);
    } else if (outputType == "TotalNum") {
      this.popTitle = "所有产品一览";
      initTotalNum({ ordId: recordId, type: "all" }).then((result) => {
        if (result.result == "Success") {
          // this.recordList = result.recordList;
          var dataStr = JSON.stringify(result.recordList);
          this.recordList = JSON.parse(dataStr);
          console.log("data:" + JSON.stringify(this.recordList));
          this.showPop = true;
        } else {
          this.showMyToast(
            "加载所有产品一览页面失败",
            result.errorMsg,
            "error"
          );
        }
      });
    } else if (outputType == "ArrDet") {
      if (recordId == "1") {
        this.popTitle = "所有已到货产品一览";
        initArrDetAll({ type: "all" }).then((result) => {
          if (result.result == "Success") {
            // this.recordList = result.recordList;
            var dataStr = JSON.stringify(result.recordList);
            this.recordList = JSON.parse(dataStr);
            console.log("data:" + JSON.stringify(this.recordList));
            this.showPop = true;
          } else {
            this.showMyToast(
              "加载所有已到货产品一览页面失败",
              result.errorMsg,
              "error"
            );
          }
        });
      } else {
        this.popTitle = "已到货产品一览";
        initArrDet({ orderId: recordId }).then((result) => {
          if (result.result == "Success") {
            this.recordList = result.recordList;
            console.log("data:" + JSON.stringify(this.recordList));
            this.showPop = true;
          } else {
            this.showMyToast(
              "加载已到货产品一览页面失败",
              result.errorMsg,
              "error"
            );
          }
        });
      }
    } else if (outputType == "DeliveryDet") {
      if (recordId == "1") {
        this.popTitle = "所有已发货还没到货产品一览";
        initDeliveryDetAll({ type: "all" }).then((result) => {
          if (result.result == "Success") {
            this.recordList = result.recordList;
            console.log("data:" + JSON.stringify(this.recordList));
            this.showPop = true;
          } else {
            this.showMyToast(
              "加载所有已发货还没到货产品一览页面失败",
              result.errorMsg,
              "error"
            );
          }
        });
      } else {
        this.popTitle = "未到货产品一览";
        initDeliveryDet({ orderId: recordId }).then((result) => {
          if (result.result == "Success") {
            this.recordList = result.recordList;
            console.log("data:" + JSON.stringify(this.recordList));
            this.showPop = true;
          } else {
            this.showMyToast(
              "加载未到货产品一览页面失败",
              result.errorMsg,
              "error"
            );
          }
        });
      }
    } else if (outputType == "NotArrDet") {
      if (recordId == "1") {
        this.popTitle = "所有还没发货产品一览";
        initNotArrDetAll({ type: "all" }).then((result) => {
          if (result.result == "Success") {
            this.recordList = result.recordList;
            console.log("data:" + JSON.stringify(this.recordList));
            this.showPop = true;
          } else {
            this.showMyToast(
              "加载所有还没发货产品一览页面失败",
              result.errorMsg,
              "error"
            );
          }
        });
      } else {
        this.popTitle = "还没发货数量";
        initNotArrDet({ orderId: recordId }).then((result) => {
          if (result.result == "Success") {
            this.recordList = result.recordList;
            console.log("data:" + JSON.stringify(this.recordList));
            this.showPop = true;
          } else {
            this.showMyToast(
              "加载还没发货数量页面失败",
              result.errorMsg,
              "error"
            );
          }
        });
      }
    } else if (outputType == "MoreThan7") {
      if (recordId == "1") {
        this.popTitle = "所有发货七天还未到货数";
        initMoreThan7All({ type: "all" }).then((result) => {
          if (result.result == "Success") {
            this.recordList = result.recordList;
            console.log("data:" + JSON.stringify(this.recordList));
            this.showPop = true;
          } else {
            this.showMyToast(
              "加载所有发货七天还未到货数页面失败",
              result.errorMsg,
              "error"
            );
          }
        });
      } else {
        this.popTitle = "发货七天还未到货数";
        initMoreThan7({ orderId: recordId }).then((result) => {
          if (result.result == "Success") {
            this.recordList = result.recordList;
            console.log("data:" + JSON.stringify(this.recordList));
            this.showPop = true;
          } else {
            this.showMyToast(
              "加载发货七天还未到货数页面失败",
              result.errorMsg,
              "error"
            );
          }
        });
      }
    }
  }
  //关闭弹窗
  closePop() {
    this.showPop = false;
  }
  //消耗品订单名称变更
  category1Change(event) {
    this.category1 = event.detail.value;
  }
  //最新发货日期变更
  cate2Change(event) {
    this.cate2 = event.detail.value;
  }
  //检索
  search() {
    this.showSpinner = true;
    searchConsumableorderdetails({
      category1Str: this.category1,
      cate2Str: this.cate2,
      accountidStr: this.accountId,
      userWorkLocationStr: this.userWorkLocation,
      agencyProTypeStr: this.agencyProType
    }).then((result) => {
      this.showSpinner = false;
      if (result.result == "Success") {
        this.raesList = result.raesList;
        this.raesList.push({
          Id: "1",
          Name: "订单明细汇总",
          Total_num__c: this.totalNum,
          OrderNumber_arrived__c: this.orderNumberArrived,
          Delivery_detail_count__c: this.deliveryDetailCount,
          OrderNumber_notarrive__c: this.orderNumberNotarrive,
          More_than_seven_days__c: this.moreThanSevenDays
        });
        if (this.raesList.length > 1) {
          var count = this.raesList.length - 1;
          this.showMyToast(
            "搜索成功",
            "共搜索到" + count + "条数据",
            "success"
          );
        } else {
          this.showMyToast("未搜索到数据", "", "error");
        }
      } else {
        this.showMyToast("搜索失败", result.errorMsg, "error");
      }
    });
  }
  //清空搜索框
  clear() {
    this.showSpinner = true;
    this.category1 = "";
    this.cate2 = null;
    searchConsumableorderdetails({
      category1Str: this.category1,
      cate2Str: this.cate2,
      accountidStr: this.accountId,
      userWorkLocationStr: this.userWorkLocation,
      agencyProTypeStr: this.agencyProType
    }).then((result) => {
      this.showSpinner = false;
      if (result.result == "Success") {
        this.raesList = result.raesList;
        this.raesList.push({
          Id: "1",
          Name: "订单明细汇总",
          Total_num__c: this.totalNum,
          OrderNumber_arrived__c: this.orderNumberArrived,
          Delivery_detail_count__c: this.deliveryDetailCount,
          OrderNumber_notarrive__c: this.orderNumberNotarrive,
          More_than_seven_days__c: this.moreThanSevenDays
        });
        if (this.raesList.length > 1) {
          var count = this.raesList.length - 1;
          this.showMyToast(
            "搜索成功",
            "共搜索到" + count + "条数据",
            "success"
          );
        } else {
          this.showMyToast("未搜索到数据", "", "error");
        }
      } else {
        this.showMyToast("搜索失败", result.errorMsg, "error");
      }
    });
  }
  //入库
  orderArrive() {
    const config = {
      type: "standard__webPage",
      attributes: {
        url: "/lexarrivegoods?ArrType=Arr"
      }
    };
    this[NavigationMixin.Navigate](config);
  }
  //返品
  orderReturn() {
    const config = {
      type: "standard__webPage",
      attributes: {
        url: "/lexarrivegoods?ArrType=ReG"
      }
    };
    this[NavigationMixin.Navigate](config);
  }
  showMyToast(title, message, variant) {
    console.log("show custom message");
    var iconName = "";
    var content = "";
    if (variant == "success") {
      iconName = "utility:check";
    } else {
      iconName = "utility:error";
    }
    if (message != "") {
      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);
    // var mode;
    // if(this.isNoteStay){
    //     mode ='sticky';
    // }else{
    //     mode = 'dismissable';
    // }
    renderedCallback(){
        if (!this.stylesLoaded) {
            Promise.all([loadStyle(this, WrappedHeaderTable)])
                .then(() => {
                    console.log("Custom styles loaded");
                    this.stylesLoaded = true;
                })
                .catch((error) => {
                    console.error("Error loading custom styles");
                });
        }
    }
    //初始化
    connectedCallback(){
        init()
            .then(result=>{
                this.isNoteStay = result.isNoteStay;
                if(result.result == 'Success'){
                    this.agencyProType = result.agencyProType;
                    this.accountId = result.accountId;
                    this.title = result.title;
                    this.userWorkLocation = result.userWorkLocation;
                    this.totalNum = result.totalNum;
                    this.orderNumberArrived = result.orderNumberArrived;
                    this.deliveryDetailCount = result.deliveryDetailCount;
                    this.orderNumberNotarrive = result.orderNumberNotarrive;
                    this.moreThanSevenDays = result.moreThanSevenDays;
                    this.raesList = result.raesList;
                    this.raesList.push({Id:'1',Name:'订单明细汇总',Total_num__c:this.totalNum,OrderNumber_arrived__c:this.orderNumberArrived,Delivery_detail_count__c:this.deliveryDetailCount,OrderNumber_notarrive__c:this.orderNumberNotarrive,More_than_seven_days__c:this.moreThanSevenDays});
                    this.showSpinner = false;
                    this.showPage = true;
                }else{
                    this.showSpinner = false;
                    console.log("Error:"+result.errorMsg);
                    this.showMyToast('初始化页面失败',result.errorMsg,'error');
                }
            })
    }
    //点击链接
    clickLick(event){
        var outputValue = event.detail.data.value;
        var outputType = event.detail.data.type;
        var recordId = event.detail.data.recordId;
        console.log("click:"+outputValue+"---"+outputType+"---"+recordId);
        if(outputType == 'Title'){
            const config = {
                type: 'standard__webPage',
                attributes: {
                   url: '/lexarrivegoods?ESetId='+recordId
                }
            };
            this[NavigationMixin.Navigate](config);
        }else if(outputType == 'TotalNum'){
            this.popTitle = '所有产品一览';
            initTotalNum({ordId:recordId, type:'all'})
            .then(result=>{
                if(result.result == 'Success'){
                    // this.recordList = result.recordList;
                    var dataStr = JSON.stringify(result.recordList);
                    this.recordList = JSON.parse(dataStr);
                    console.log('data:'+JSON.stringify(this.recordList));
                    this.showPop = true;
                }else{
                    this.showMyToast('加载所有产品一览页面失败',result.errorMsg,'error');
                }
            })
        }else if(outputType == 'ArrDet'){
            if(recordId == '1'){
                this.popTitle = '所有已到货产品一览';
                initArrDetAll({type:'all'})
                .then(result=>{
                    if(result.result == 'Success'){
                        // this.recordList = result.recordList;
                        var dataStr = JSON.stringify(result.recordList);
                        this.recordList = JSON.parse(dataStr);
                        console.log('data:'+JSON.stringify(this.recordList));
                        this.showPop = true;
                    }else{
                        this.showMyToast('加载所有已到货产品一览页面失败',result.errorMsg,'error');
                    }
                })
            }else{
                this.popTitle = '已到货产品一览';
                initArrDet({orderId:recordId})
                .then(result=>{
                    if(result.result == 'Success'){
                        this.recordList = result.recordList;
                        console.log('data:'+JSON.stringify(this.recordList));
                        this.showPop = true;
                    }else{
                        this.showMyToast('加载已到货产品一览页面失败',result.errorMsg,'error');
                    }
                })
            }
        }else if(outputType == 'DeliveryDet'){
            if(recordId == '1'){
                this.popTitle = '所有已发货还没到货产品一览';
                initDeliveryDetAll({type:'all'})
                .then(result=>{
                    if(result.result == 'Success'){
                        this.recordList = result.recordList;
                        console.log('data:'+JSON.stringify(this.recordList));
                        this.showPop = true;
                    }else{
                        this.showMyToast('加载所有已发货还没到货产品一览页面失败',result.errorMsg,'error');
                    }
                })
            }else{
                this.popTitle = '未到货产品一览';
                initDeliveryDet({orderId:recordId})
                .then(result=>{
                    if(result.result == 'Success'){
                        this.recordList = result.recordList;
                        console.log('data:'+JSON.stringify(this.recordList));
                        this.showPop = true;
                    }else{
                        this.showMyToast('加载未到货产品一览页面失败',result.errorMsg,'error');
                    }
                })
            }
        }else if(outputType == 'NotArrDet'){
            if(recordId == '1'){
                this.popTitle = '所有还没发货产品一览';
                initNotArrDetAll({type:'all'})
                .then(result=>{
                    if(result.result == 'Success'){
                        this.recordList = result.recordList;
                        console.log('data:'+JSON.stringify(this.recordList));
                        this.showPop = true;
                    }else{
                        this.showMyToast('加载所有还没发货产品一览页面失败',result.errorMsg,'error');
                    }
                })
            }else{
                this.popTitle = '还没发货数量';
                initNotArrDet({orderId:recordId})
                .then(result=>{
                    if(result.result == 'Success'){
                        this.recordList = result.recordList;
                        console.log('data:'+JSON.stringify(this.recordList));
                        this.showPop = true;
                    }else{
                        this.showMyToast('加载还没发货数量页面失败',result.errorMsg,'error');
                    }
                })
            }
        }else if(outputType == 'MoreThan7'){
            if(recordId == '1'){
                this.popTitle = '所有发货七天还未到货数';
                initMoreThan7All({type:'all'})
                .then(result=>{
                    if(result.result == 'Success'){
                        this.recordList = result.recordList;
                        console.log('data:'+JSON.stringify(this.recordList));
                        this.showPop = true;
                    }else{
                        this.showMyToast('加载所有发货七天还未到货数页面失败',result.errorMsg,'error');
                    }
                })
            }else{
                this.popTitle = '发货七天还未到货数';
                initMoreThan7({orderId:recordId})
                .then(result=>{
                    if(result.result == 'Success'){
                        this.recordList = result.recordList;
                        console.log('data:'+JSON.stringify(this.recordList));
                        this.showPop = true;
                    }else{
                        this.showMyToast('加载发货七天还未到货数页面失败',result.errorMsg,'error');
                    }
                })
            }
        }
    }
    //关闭弹窗
    closePop(){
        this.showPop = false;
    }
    //消耗品订单名称变更
    category1Change(event){
        this.category1 = event.detail.value;
    }
    //最新发货日期变更
    cate2Change(event){
        this.cate2 = event.detail.value;
    }
    //检索
    search(){
        this.showSpinner = true;
        searchConsumableorderdetails({
            category1Str:this.category1,
            cate2Str:this.cate2,
            accountidStr:this.accountId,
            userWorkLocationStr:this.userWorkLocation,
            agencyProTypeStr:this.agencyProType})
        .then(result=>{
            this.showSpinner = false;
            if(result.result == 'Success'){
                this.raesList = result.raesList;
                this.raesList.push({Id:'1',Name:'订单明细汇总',Total_num__c:this.totalNum,OrderNumber_arrived__c:this.orderNumberArrived,Delivery_detail_count__c:this.deliveryDetailCount,OrderNumber_notarrive__c:this.orderNumberNotarrive,More_than_seven_days__c:this.moreThanSevenDays});
                if(this.raesList.length > 1){
                    var count = this.raesList.length - 1;
                    this.showMyToast('搜索成功','共搜索到'+count+'条数据','success');
                }else{
                    this.showMyToast('未搜索到数据','','error');
                }
            }else{
                this.showMyToast('搜索失败',result.errorMsg,'error');
            }
        })
    }
    //清空搜索框
    clear(){
        this.showSpinner = true;
        this.category1 = '';
        this.cate2 = null;
        searchConsumableorderdetails({
            category1Str:this.category1,
            cate2Str:this.cate2,
            accountidStr:this.accountId,
            userWorkLocationStr:this.userWorkLocation,
            agencyProTypeStr:this.agencyProType})
        .then(result=>{
            this.showSpinner = false;
            if(result.result == 'Success'){
                this.raesList = result.raesList;
                this.raesList.push({Id:'1',Name:'订单明细汇总',Total_num__c:this.totalNum,OrderNumber_arrived__c:this.orderNumberArrived,Delivery_detail_count__c:this.deliveryDetailCount,OrderNumber_notarrive__c:this.orderNumberNotarrive,More_than_seven_days__c:this.moreThanSevenDays});
                if(this.raesList.length > 1){
                    var count = this.raesList.length - 1;
                    this.showMyToast('搜索成功','共搜索到'+count+'条数据','success');
                }else{
                    this.showMyToast('未搜索到数据','','error');
                }
            }else{
                this.showMyToast('搜索失败',result.errorMsg,'error');
            }
        })
    }
    //入库
    orderArrive(){
        const config = {
            type: 'standard__webPage',
            attributes: {
               url: '/lexarrivegoods?ArrType=Arr'
            }
        };
        this[NavigationMixin.Navigate](config);
    }
    //返品
    orderReturn(){
        const config = {
            type: 'standard__webPage',
            attributes: {
               url: '/lexarrivegoods?ArrType=ReG'
            }
        };
        this[NavigationMixin.Navigate](config);
    }
    showMyToast(title, message, variant) {
        console.log('show custom message');
        var iconName = '';
        var content = '';
        if(variant == 'success'){
           iconName = 'utility:check';
        }else{
           iconName = 'utility:error';
        }
        if(message != ''){
           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);
        // var mode;
        // if(this.isNoteStay){
        //     mode ='sticky';
        // }else{
        //     mode = 'dismissable';
        // }
        // const evt = new ShowToastEvent({
        //     title: title,
        //     message: message,
        //     variant: variant,
        //     mode: mode
        // });
        // this.dispatchEvent(evt);
     }
}
    // const evt = new ShowToastEvent({
    //     title: title,
    //     message: message,
    //     variant: variant,
    //     mode: mode
    // });
    // this.dispatchEvent(evt);
  }
}
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.html
@@ -1,199 +1,350 @@
<!-- sldsValidatorIgnore -->
<!-- sldsValidatorIgnore -->
<template>
    <c-common-toast></c-common-toast>
    <template if:true={isShowSpinner}>
        <div role="status" class="slds-spinner slds-spinner_medium slds-spinner_brand">
                <span class="slds-assistive-text">Loading</span>
                <div class="slds-spinner__dot-a"></div>
                <div class="slds-spinner__dot-b"></div>
        </div>
    </template>
  <c-common-toast></c-common-toast>
  <template if:true={isShowSpinner}>
    <div
      role="status"
      class="slds-spinner slds-spinner_medium slds-spinner_brand"
    >
                      <span class="slds-assistive-text">Loading</span>          
           
      <div class="slds-spinner__dot-a"></div>
                     
      <div class="slds-spinner__dot-b"></div>
             
    </div>
  </template>
    <template if:false={isDetailsShow}>
        <template if:false={isConInvoiceList}>
            <!-- 搜索客户名 -->
            <template if:true={isModalOpen}>
                <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true"
                    aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open slds-modal_medium"
                    style="border: 1px solid #D4D4D4;">
                    <div class="slds-modal__container">
                        <header class="slds-modal__header" style="background-color: #F3F3F3;">
                            <button style="" class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
                                title="Close" onclick={closeModal}>
                                <lightning-icon icon-name="utility:close" alternative-text="close" variant="inverse"
                                    size="small"></lightning-icon>
                                <span class="slds-assistive-text">Close</span>
                            </button>
                            <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">经销商医院检索</h2>
                        </header>
                        <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1"
                            style="border: 1px solid #F3F3F3;">
                            <table style="width: 100%;">
                                <tbody>
                                    <tr>
                                        <td style="width: 74px;">
                                            <div style="color:#696969;font-size:16px;text-align: left;">医院名称</div>
                                        </td>
                                        <td style="width: 60%;"><lightning-input class="inputFont" label="医院名称"
                                                variant="label-hidden" placeholder="请输入医院名称" value={searchHospitalName}
                                                data-field="searchHospitalName" onchange={dataChange}></lightning-input></td>
                                        <td style="width: 10px;"></td>
                                        <td><button class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                                                style="height: 32px;" label="搜索" onclick={searchHospital}>搜索</button></td>
                                    </tr>
                                </tbody>
                            </table>
                            <p style="height: 20px;"></p>
                            <!-- <p>已选择医院:{chooseHospital}</p> -->
                            <div
                                style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
                                <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
                                    <lightning-layout>
                                        <lightning-layout-item padding="around-small">
                                            <p style="font-size: 18px">
                                                <strong>搜索结果</strong>
                                            </p>
                                        </lightning-layout-item>
                                    </lightning-layout>
                                    <!-- <p style="font-size: 16px;"><strong>搜索结果</strong></p> -->
                                </div>
                                <div class="myTable" style="padding:10px;">
                                    <!-- <lightning-datatable class="wrapped-header-datatable" key-field="id"
  <template if:false={isDetailsShow}>
    <template if:false={isConInvoiceList}>
      <!-- 搜索客户名 -->
      <template if:true={isModalOpen}>
        <section
          role="dialog"
          tabindex="-1"
          aria-labelledby="modal-heading-01"
          aria-modal="true"
          aria-describedby="modal-content-id-1"
          class="slds-modal slds-fade-in-open slds-modal_medium"
          style="border: 1px solid #d4d4d4"
        >
          <div class="slds-modal__container">
            <header
              class="slds-modal__header"
              style="background-color: #f3f3f3"
            >
              <button
                style=""
                class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
                title="Close"
                onclick={closeModal}
              >
                <lightning-icon
                  icon-name="utility:close"
                  alternative-text="close"
                  variant="inverse"
                  size="small"
                ></lightning-icon>
                <span class="slds-assistive-text">Close</span>
              </button>
              <h2
                id="modal-heading-01"
                class="slds-text-heading_medium slds-hyphenate"
              >
                经销商医院检索
              </h2>
            </header>
            <div
              class="slds-modal__content slds-p-around_medium"
              id="modal-content-id-1"
              style="border: 1px solid #f3f3f3"
            >
              <table style="width: 100%">
                <tbody>
                  <tr>
                    <td style="width: 74px">
                      <div
                        style="
                          color: #696969;
                          font-size: 16px;
                          text-align: left;
                        "
                      >
                        医院名称
                      </div>
                    </td>
                    <td style="width: 60%">
                      <lightning-input
                        class="inputFont"
                        label="医院名称"
                        variant="label-hidden"
                        placeholder="请输入医院名称"
                        value={searchHospitalName}
                        data-field="searchHospitalName"
                        onchange={dataChange}
                      ></lightning-input>
                    </td>
                    <td style="width: 10px"></td>
                    <td>
                      <button
                        class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                        style="height: 32px"
                        label="搜索"
                        onclick={searchHospital}
                      >
                        搜索
                      </button>
                    </td>
                  </tr>
                </tbody>
              </table>
              <p style="height: 20px"></p>
              <!-- <p>已选择医院:{chooseHospital}</p> -->
              <div
                style="
                  border: 1px solid #d4d4d4;
                  border-top: 3px solid #51606e;
                  border-radius: 5px;
                  margin-bottom: 7px;
                "
              >
                <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
                  <lightning-layout>
                    <lightning-layout-item padding="around-small">
                      <p style="font-size: 18px">
                        <strong>搜索结果</strong>
                      </p>
                    </lightning-layout-item>
                  </lightning-layout>
                  <!-- <p style="font-size: 16px;"><strong>搜索结果</strong></p> -->
                </div>
                <div class="myTable" style="padding: 10px">
                  <!-- <lightning-datatable class="wrapped-header-datatable" key-field="id"
                                        hide-checkbox-column="true" data={hospitalList} columns={hosCols}
                                        onrowaction={chooseHos}></lightning-datatable> -->
                                    <lightning-datatable class="datatabel slds-border_top wrapped-header-datatable"
                                        key-field="id" data={hospitalList} columns={hospitalColumns} hide-checkbox-column="true"
                                        onrowaction={searchHandleRowAction}>
                                    </lightning-datatable>
                                </div>
                            </div>
                  <lightning-datatable
                    class="datatabel slds-border_top wrapped-header-datatable"
                    key-field="id"
                    data={hospitalList}
                    columns={hospitalColumns}
                    hide-checkbox-column="true"
                    onrowaction={searchHandleRowAction}
                  >
                  </lightning-datatable>
                </div>
              </div>
            </div>
            <footer class="slds-modal__footer">
              <button
                class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
                label="取消"
                onclick={closeModal}
              >
                取消
              </button>
            </footer>
          </div>
        </section>
        <div class="slds-backdrop slds-backdrop_open"></div>
      </template>
      <div class="outerBorderCss">
        <div style="padding: 5px">
          <div class="borderCss">
            <div style="padding: 10px">
              <div lwc:dom="manual" class="resultDiv"></div>
              <div draggable="false">
                <template if:false={EditAble}>
                  <lightning-layout multiple-rows="true">
                    <lightning-layout-item size="2"></lightning-layout-item>
                    <lightning-layout-item size="10">
                      <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        onclick={SetEditAbleJs}
                        disabled={isDisabledEdit}
                        style="width: 150px"
                      >
                        编辑
                      </button>
                      <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
                        onclick={approvalJs}
                        disabled={isDisabledEdit}
                        style="width: 150px"
                      >
                        提交
                      </button>
                      <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
                        onclick={openReportJs}
                        disabled={isOpenReportDisabled}
                        style="width: 150px"
                      >
                        显示明细
                      </button>
                      <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
                        onclick={reopenJs}
                        disabled={isDisabledReopen}
                        style="width: 150px"
                      >
                        作废重开
                      </button>
                    </lightning-layout-item>
                  </lightning-layout>
                  <lightning-layout
                    multiple-rows="true"
                    style="margin-top: 20px"
                  >
                    <lightning-layout-item size="2"></lightning-layout-item>
                    <lightning-layout-item size="10">
                      <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        onclick={deleteButtonJs}
                        disabled={isDisabledDelete}
                        style="width: 150px"
                      >
                        删除
                      </button>
                      <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
                        disabled={isDisabledReopen}
                        onclick={uploadOrder}
                        style="width: 150px"
                      >
                        上传附件
                      </button>
                      <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
                        onclick={saveAttachmentJs}
                        disabled={isDisabledReopen}
                        style="width: 150px"
                      >
                        保存附件
                      </button>
                    </lightning-layout-item>
                  </lightning-layout>
                </template>
                <!-- 上传附件弹窗 -->
                <template if:true={showAttPop}>
                  <section
                    role="dialog"
                    tabindex="-1"
                    aria-labelledby="modal-heading-02"
                    aria-modal="true"
                    aria-describedby="modal-content-id-2"
                    class="slds-modal slds-fade-in-open slds-modal_small"
                    style="border: 1px solid #d4d4d4"
                  >
                    <template if:true={showPopSpinner}>
                      <lightning-spinner
                        size="medium"
                        variant="brand"
                      ></lightning-spinner>
                    </template>
                    <div class="slds-modal__container">
                      <header
                        class="slds-modal__header"
                        style="background-color: #f3f3f3"
                      >
                        <button
                          style=""
                          class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
                          title="Close"
                          onclick={closePop}
                        >
                          <lightning-icon
                            icon-name="utility:close"
                            alternative-text="close"
                            variant="inverse"
                            size="small"
                          ></lightning-icon>
                          <span class="slds-assistive-text">Close</span>
                        </button>
                        <h2
                          id="modal-heading-02"
                          class="slds-text-heading_medium slds-hyphenate"
                        >
                          上传附件
                        </h2>
                      </header>
                      <div
                        class="slds-modal__content slds-p-around_medium searchName"
                        id="modal-content-id-2"
                        style="border: 1px solid #f3f3f3"
                      >
                        <div class="slds-m-top_medium slds-m-bottom_x-large">
                          <div class="slds-p-around_medium lgc-bg">
                            <lightning-input
                              class="fileUpload"
                              type="file"
                              label="附件上传"
                              accept=".xlsx, .xls, .csv, .png, .doc, .docx, .pdf"
                              onchange={attChange}
                            ></lightning-input>
                          </div>
                          <p class="fontWeight">
                            已选择文件:{fileName}
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <template if:true={attDelBtn}>
                              <a onclick={removeAtt}>移除</a>
                            </template>
                          </p>
                        </div>
                        <footer class="slds-modal__footer">
                            <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" label="取消"
                                onclick={closeModal}>取消</button>
                        </footer>
                    </div>
                </section>
                <div class="slds-backdrop slds-backdrop_open"></div>
            </template>
            <div class="outerBorderCss">
                <div style="padding:5px;">
                    <div class="borderCss">
                        <div style="padding:10px;">
                            <div lwc:dom="manual" class="resultDiv"></div>
                            <div draggable="false">
                                <template if:false={EditAble}>
                                    <lightning-layout multiple-rows="true">
                                        <lightning-layout-item size="2"></lightning-layout-item>
                                        <lightning-layout-item size="10">
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                                onclick={SetEditAbleJs} disabled={isDisabledEdit}
                                                style="width: 150px;">编辑</button>
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
                                                onclick={approvalJs} disabled={isDisabledEdit}
                                                style="width: 150px;">提交</button>
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
                                                onclick={openReportJs} disabled={isOpenReportDisabled}
                                                style="width: 150px;">显示明细</button>
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
                                                onclick={reopenJs} disabled={isDisabledReopen}
                                                style="width: 150px;">作废重开</button>
                                        </lightning-layout-item>
                                    </lightning-layout>
                                    <lightning-layout multiple-rows="true" style="margin-top: 20px;">
                                        <lightning-layout-item size="2"></lightning-layout-item>
                                        <lightning-layout-item size="10">
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                                onclick={deleteButtonJs} disabled={isDisabledDelete}
                                                style="width: 150px;">删除</button>
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
                                                disabled={isDisabledReopen} onclick={uploadOrder}
                                                style="width: 150px;">上传附件</button>
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder buttonminMarginLeft"
                                                onclick={saveAttachmentJs} disabled={isDisabledReopen}
                                                style="width: 150px;">保存附件</button>
                                        </lightning-layout-item>
                                    </lightning-layout>
                                </template>
                                <!-- 上传附件弹窗 -->
                                <template if:true={showAttPop}>
                                    <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-02"
                                        aria-modal="true" aria-describedby="modal-content-id-2"
                                        class="slds-modal slds-fade-in-open slds-modal_small"
                                        style="border: 1px solid #D4D4D4;">
                                        <template if:true={showPopSpinner}>
                                            <lightning-spinner size="medium" variant="brand"></lightning-spinner>
                                        </template>
                                        <div class="slds-modal__container">
                                            <header class="slds-modal__header" style="background-color: #F3F3F3;">
                                                <button style=""
                                                    class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
                                                    title="Close" onclick={closePop}>
                                                    <lightning-icon icon-name="utility:close" alternative-text="close"
                                                        variant="inverse" size="small"></lightning-icon>
                                                    <span class="slds-assistive-text">Close</span>
                                                </button>
                                                <h2 id="modal-heading-02"
                                                    class="slds-text-heading_medium slds-hyphenate">上传附件</h2>
                                            </header>
                                            <div class="slds-modal__content slds-p-around_medium searchName"
                                                id="modal-content-id-2" style="border: 1px solid #F3F3F3;">
                                                <div class="slds-m-top_medium slds-m-bottom_x-large">
                                                    <div class="slds-p-around_medium lgc-bg">
                                                        <lightning-input class="fileUpload" type="file" label="附件上传"
                                                            accept=".xlsx, .xls, .csv, .png, .doc, .docx, .pdf"
                                                            onchange={attChange}></lightning-input>
                                                    </div>
                                                    <p class="fontWeight">已选择文件:{fileName}
                                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                        <template if:true={attDelBtn}>
                                                            <a onclick={removeAtt}>移除</a>
                                                        </template>
                                                    </p>
                                                </div>
                                            </div>
                                            <footer class="slds-modal__footer">
                                                <!-- <lightning-button style="margin-left: 10px;" variant="neutral"
                      </div>
                      <footer class="slds-modal__footer">
                        <!-- <lightning-button style="margin-left: 10px;" variant="neutral"
                                                    label="取消" onclick={closePop}></lightning-button>
                                                <lightning-button style="margin-left: 10px;" variant="neutral"
                                                    label="上传" onclick={handleFilesChange}></lightning-button> -->
                                                <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" style="margin-left: 10px;"
                                                    label="取消" onclick={closePop}>取消</button>
                                                <button class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle" style="margin-left: 10px;"
                                                    label="上传" onclick={handleFilesChange}>上传</button>
                                            </footer>
                                        </div>
                                    </section>
                                    <div class="slds-backdrop slds-backdrop_open"></div>
                                </template>
                        <button
                          class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
                          style="margin-left: 10px"
                          label="取消"
                          onclick={closePop}
                        >
                          取消
                        </button>
                        <button
                          class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                          style="margin-left: 10px"
                          label="上传"
                          onclick={handleFilesChange}
                        >
                          上传
                        </button>
                      </footer>
                    </div>
                  </section>
                  <div class="slds-backdrop slds-backdrop_open"></div>
                </template>
                                <template if:true={EditAble}>
                                    <lightning-layout>
                                        <lightning-layout-item size="1" padding="around-small"></lightning-layout-item>
                                        <lightning-layout-item size="2" padding="around-small"></lightning-layout-item>
                                        <lightning-layout-item padding="around-small">
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                                onclick={SaveJs}>确定</button>
                                        </lightning-layout-item>
                                    </lightning-layout>
                                </template>
                <template if:true={EditAble}>
                  <lightning-layout>
                    <lightning-layout-item
                      size="1"
                      padding="around-small"
                    ></lightning-layout-item>
                    <lightning-layout-item
                      size="2"
                      padding="around-small"
                    ></lightning-layout-item>
                    <lightning-layout-item padding="around-small">
                      <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        onclick={SaveJs}
                      >
                        确定
                      </button>
                    </lightning-layout-item>
                  </lightning-layout>
                </template>
                                <!-- <lightning-layout>
                <!-- <lightning-layout>
                                    <lightning-layout-item size="3"></lightning-layout-item>
                                    <template if:true={EditAble}>
                                        <lightning-layout-item size="1" padding="around-small">
@@ -225,283 +376,386 @@
                                    </template>
                                </lightning-layout> -->
              </div>
            </div>
          </div>
                            </div>
          <div class="borderCss">
            <div class="headerDorderCss">
              <lightning-layout>
                <lightning-layout-item padding="around-small">
                  <p style="font-size: 18px">
                    <strong>发票信息</strong>
                  </p>
                </lightning-layout-item>
              </lightning-layout>
            </div>
            <div style="padding: 7px">
              <div lwc:dom="manual" class="resultDiv"></div>
              <div draggable="false">
                <!--发票信息 显示用 -->
                <template if:false={isEditInvoice}>
                  <lightning-record-edit-form
                    object-api-name="Consumable_order__c"
                    record-id={cocId}
                    onload={handleLoad2}
                  >
                    <!-- 发票号 状态 -->
                    <lightning-layout multiple-rows="true">
                      <lightning-layout-item size="1"></lightning-layout-item>
                      <lightning-layout-item class="hehe-layoutItem" size="5">
                        <lightning-output-field
                          field-name="Name"
                        ></lightning-output-field>
                      </lightning-layout-item>
                      <lightning-layout-item
                        class="hehe-layoutItem"
                        size="5"
                        style="padding-left: 100px"
                      >
                        <lightning-output-field
                          field-name="Invoice_status__c"
                        ></lightning-output-field>
                      </lightning-layout-item>
                      <lightning-layout-item size="1"></lightning-layout-item>
                    </lightning-layout>
                    <!-- 发票日期 -->
                    <lightning-layout multiple-rows="true">
                      <lightning-layout-item size="1"></lightning-layout-item>
                      <lightning-layout-item class="hehe-layoutItem" size="5">
                        <lightning-output-field
                          field-name="Invoice_Date__c"
                        ></lightning-output-field>
                      </lightning-layout-item>
                    </lightning-layout>
                    <!-- 二级经销商 -->
                    <template if:true={isShowSecondaryDistributor}>
                      <lightning-layout-item size="1"></lightning-layout-item>
                      <lightning-layout multiple-rows="true">
                        <lightning-layout-item class="hehe-layoutItem" size="5">
                          <lightning-output-field
                            field-name="Order_Dealer_Info__c"
                          ></lightning-output-field>
                        </lightning-layout-item>
                      </lightning-layout>
                    </template>
                    <!-- 客户名 -->
                    <lightning-layout multiple-rows="true">
                      <lightning-layout-item size="1"></lightning-layout-item>
                      <lightning-layout-item class="hehe-layoutItem" size="5">
                        <lightning-output-field
                          field-name="ShipmentAccount__c"
                          class="hideHelpText"
                        ></lightning-output-field>
                      </lightning-layout-item>
                    </lightning-layout>
                    <!-- 科室 发票票面金额 -->
                    <lightning-layout
                      multiple-rows="true"
                      style="height: 35.5px"
                    >
                      <lightning-layout-item size="1"></lightning-layout-item>
                      <lightning-layout-item class="hehe-layoutItem" size="5">
                        <lightning-output-field
                          field-name="Order_ForCustomerText__c"
                        ></lightning-output-field>
                      </lightning-layout-item>
                      <lightning-layout-item
                        size="5"
                        class="readOnly"
                        style="padding-left: 100px"
                      >
                        <lightning-input
                          label="发票票面金额(元)"
                          value={sumPrice}
                          read-only
                          variant="label-inline"
                        ></lightning-input>
                      </lightning-layout-item>
                      <lightning-layout-item size="1"></lightning-layout-item>
                    </lightning-layout>
                    <!-- 备注 -->
                    <lightning-layout multiple-rows="true">
                      <lightning-layout-item size="1"></lightning-layout-item>
                      <lightning-layout-item class="hehe-layoutItem" size="5">
                        <lightning-output-field
                          field-name="Invoice_Note__c"
                        ></lightning-output-field>
                      </lightning-layout-item>
                    </lightning-layout>
                    <!-- 发票附件 明细附件 -->
                    <lightning-layout multiple-rows="true">
                      <lightning-layout-item size="1"></lightning-layout-item>
                      <lightning-layout-item class="hehe-layoutItem" size="5">
                        <lightning-output-field
                          field-name="Invoice_attachment__c"
                        ></lightning-output-field>
                      </lightning-layout-item>
                      <lightning-layout-item
                        class="hehe-layoutItem"
                        size="5"
                        style="padding-left: 100px"
                      >
                        <lightning-output-field
                          field-name="Invoicedet_attachment__c"
                        ></lightning-output-field>
                      </lightning-layout-item>
                      <lightning-layout-item size="1"></lightning-layout-item>
                    </lightning-layout>
                    <!-- 附件预览 -->
                    <lightning-layout multiple-rows="true">
                      <lightning-layout-item size="1"> </lightning-layout-item>
                      <lightning-layout-item size="10">
                        <lightning-card
                          class="attListTitle"
                          variant="Narrow"
                          title="附件列表"
                          icon-name="utility:attach"
                        >
                          <lightning-layout slot="footer" multiple-rows="true">
                            <template
                              for:each={fileData}
                              for:item="item"
                              for:index="index"
                            >
                              <lightning-layout-item
                                padding="around-none"
                                size="2"
                                key={item.recordId}
                                style="text-align: left; padding: 5px"
                              >
                                <lightning-icon
                                  title={item.Title}
                                  style="margin-left: 20px"
                                  icon-name="doctype:gform"
                                  alternative-text={item.Title}
                                  size="large"
                                ></lightning-icon
                                ><br />
                                <div
                                  title={item.Title}
                                  style="
                                    width: 100px;
                                    text-overflow: ellipsis;
                                    overflow: hidden;
                                    white-space: nowrap;
                                  "
                                >
                                  {item.Title}
                                </div>
                                <p>
                                  <!-- <a data-fileid ={item.documentId} onclick={previweAtt}> -->
                                  <a href={item.attUrl} target="_blank">
                                    预览 </a
                                  >&nbsp;·&nbsp;
                                  <a href={item.downloadUrl}> 下载 </a
                                  >&nbsp;·&nbsp;
                                  <a data-fileid={item.Id} onclick={deleteAtt}>
                                    删除
                                  </a>
                                </p>
                                <!-- <p>{item.updateDate} · {item.ownerName}</p> -->
                              </lightning-layout-item>
                            </template>
                          </lightning-layout>
                        </lightning-card>
                      </lightning-layout-item>
                    </lightning-layout>
                  </lightning-record-edit-form>
                </template>
                <!--发票信息 编辑用 -->
                <template if:true={isEditInvoice}>
                  <lightning-record-edit-form
                    object-api-name="Consumable_order__c"
                    record-id={cocId}
                    onload={handleLoad2}
                  >
                    <!-- 发票号 状态 -->
                    <lightning-layout multiple-rows="true">
                      <lightning-layout-item size="1"></lightning-layout-item>
                      <lightning-layout-item class="hehe-layoutItem" size="5">
                        <lightning-input
                          label="发票号"
                          value={OrderCode}
                          data-field="OrderCode"
                          onchange={dataChange}
                          variant="label-inline"
                          required
                          class="inputFont"
                        ></lightning-input>
                      </lightning-layout-item>
                      <lightning-layout-item
                        class="hehe-layoutItem"
                        size="5"
                        style="padding-left: 100px"
                      >
                        <lightning-output-field
                          field-name="Invoice_status__c"
                        ></lightning-output-field>
                      </lightning-layout-item>
                      <lightning-layout-item size="1"></lightning-layout-item>
                    </lightning-layout>
                    <!-- 发票日期 -->
                    <lightning-layout multiple-rows="true">
                      <lightning-layout-item size="1"></lightning-layout-item>
                      <lightning-layout-item class="hehe-layoutItem" size="5">
                        <lightning-input
                          type="date"
                          label="发票日期"
                          variant="label-inline"
                          value={InvoiceDate}
                          onchange={invoiceDateChange}
                          required
                          class="inputFont"
                        ></lightning-input>
                      </lightning-layout-item>
                    </lightning-layout>
                    <!-- 客户名 二级经销商 -->
                    <lightning-layout multiple-rows="true">
                      <lightning-layout-item size="1"></lightning-layout-item>
                      <lightning-layout-item class="hehe-layoutItem" size="5">
                        <div
                          class="slds-form-element__control slds-input-has-icon slds-input-has-icon_right"
                        >
                          <lightning-icon
                            size="x-small"
                            class="iconMargin slds-icon slds-input__icon slds-input__icon_right slds-icon-text-default hideHelpText"
                            icon-name="utility:search"
                          ></lightning-icon>
                          <lightning-input
                            type="text"
                            name="HospitalName"
                            label="客户名"
                            value={HospitalName}
                            variant="label-inline"
                            onclick={searchHospitalNameModal}
                            data-field="HospitalName"
                            onchange={clearAgencyI}
                            class="inputFont"
                          ></lightning-input>
                        </div>
                    </div>
                      </lightning-layout-item>
                    <div class="borderCss">
                        <div class="headerDorderCss">
                            <lightning-layout>
                                <lightning-layout-item padding="around-small">
                                    <p style="font-size: 18px">
                                        <strong>发票信息</strong>
                                    </p>
                                </lightning-layout-item>
                            </lightning-layout>
                        </div>
                        <div style="padding:7px;">
                            <div lwc:dom="manual" class="resultDiv"></div>
                            <div draggable="false">
                                <!--发票信息 显示用 -->
                                <template if:false={isEditInvoice}>
                                    <lightning-record-edit-form object-api-name="Consumable_order__c" record-id={cocId}
                                        onload={handleLoad2}>
                                        <!-- 发票号 状态 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                      <lightning-layout-item
                        class="hehe-layoutItem"
                        size="5"
                        style="padding-left: 100px"
                      >
                        <lightning-combobox
                          data-field="secondaryDistributor"
                          name="secondaryDistributor"
                          label="二级经销商"
                          value={secondaryDistributor}
                          placeholder="请选择..."
                          options={provinceOptsMap}
                          variant="label-inline"
                          onchange={dataChange}
                          class="inputFont"
                        ></lightning-combobox>
                      </lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5">
                                                <lightning-output-field field-name="Name"></lightning-output-field>
                                            </lightning-layout-item>
                      <lightning-layout-item size="1"></lightning-layout-item>
                    </lightning-layout>
                                            <lightning-layout-item class="hehe-layoutItem" size="5" style="padding-left: 100px;">
                                                <lightning-output-field
                                                    field-name="Invoice_status__c"></lightning-output-field>
                                            </lightning-layout-item>
                    <!-- 科室 经销商(录入) -->
                    <lightning-layout multiple-rows="true">
                      <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                      <lightning-layout-item class="hehe-layoutItem" size="5">
                        <lightning-input-field
                          onchange={dataChange}
                          data-field="ForCustomerText"
                          value={ForCustomerText}
                          field-name="Order_ForCustomerText__c"
                          class="inputFont"
                        ></lightning-input-field>
                      </lightning-layout-item>
                                        </lightning-layout>
                      <lightning-layout-item
                        class="hehe-layoutItem"
                        size="5"
                        style="padding-left: 100px"
                      >
                        <lightning-output-field
                          field-name="Order_ForDealerText__c"
                        ></lightning-output-field>
                      </lightning-layout-item>
                                        <!-- 发票日期 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                      <lightning-layout-item size="1"></lightning-layout-item>
                    </lightning-layout>
                                            <lightning-layout-item class="hehe-layoutItem" size="5">
                                                <lightning-output-field
                                                    field-name="Invoice_Date__c"></lightning-output-field>
                                            </lightning-layout-item>
                                        </lightning-layout>
                    <!-- 备注 -->
                    <lightning-layout multiple-rows="true">
                      <lightning-layout-item size="1"></lightning-layout-item>
                                        <!-- 二级经销商 -->
                                        <template if:true={isShowSecondaryDistributor}>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout multiple-rows="true">
                                                <lightning-layout-item class="hehe-layoutItem" size="5">
                                                    <lightning-output-field
                                                        field-name="Order_Dealer_Info__c"></lightning-output-field>
                                                </lightning-layout-item>
                                            </lightning-layout>
                                        </template>
                                        <!-- 客户名 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5">
                                                <lightning-output-field field-name="ShipmentAccount__c"
                                                    class="hideHelpText"></lightning-output-field>
                                            </lightning-layout-item>
                                        </lightning-layout>
                                        <!-- 科室 发票票面金额 -->
                                        <lightning-layout multiple-rows="true" style="height:35.5px">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5">
                                                <lightning-output-field
                                                    field-name="Order_ForCustomerText__c"></lightning-output-field>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="5" class="readOnly" style="padding-left: 100px;">
                                                <lightning-input label="发票票面金额(元)" value={sumPrice} read-only
                                                    variant="label-inline"></lightning-input>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                        </lightning-layout>
                                        <!-- 备注 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5">
                                                <lightning-output-field
                                                    field-name="Invoice_Note__c"></lightning-output-field>
                                            </lightning-layout-item>
                                        </lightning-layout>
                                        <!-- 发票附件 明细附件 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5">
                                                <lightning-output-field
                                                    field-name="Invoice_attachment__c"></lightning-output-field>
                                            </lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5" style="padding-left: 100px;">
                                                <lightning-output-field
                                                    field-name="Invoicedet_attachment__c"></lightning-output-field>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                        </lightning-layout>
                                        <!-- 附件预览 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1">
                                            </lightning-layout-item>
                                            <lightning-layout-item size="10">
                                                <lightning-card class="attListTitle" variant="Narrow" title="附件列表"
                                                    icon-name="utility:attach">
                                                    <lightning-layout slot="footer" multiple-rows="true">
                                                        <template for:each={fileData} for:item="item" for:index="index">
                                                            <lightning-layout-item padding="around-none" size="2"
                                                                key={item.recordId}
                                                                style="text-align: left;padding:5px">
                                                                <lightning-icon title={item.Title}
                                                                    style="margin-left: 20px;" icon-name="doctype:gform"
                                                                    alternative-text={item.Title}
                                                                    size="large"></lightning-icon><br />
                                                                <div title={item.Title} style="width: 100px;text-overflow: ellipsis;overflow: hidden;white-space: nowrap;">
                                                                    {item.Title}
                                                                </div>
                                                                <p>
                                                                    <!-- <a data-fileid ={item.documentId} onclick={previweAtt}> -->
                                                                    <a href={item.attUrl} target="_blank">
                                                                        预览
                                                                    </a>&nbsp;·&nbsp;
                                                                    <a href={item.downloadUrl}>
                                                                        下载
                                                                    </a>&nbsp;·&nbsp;
                                                                    <a data-fileid={item.Id} onclick={deleteAtt}>
                                                                        删除
                                                                    </a>
                                                                </p>
                                                                <!-- <p>{item.updateDate} · {item.ownerName}</p> -->
                                                            </lightning-layout-item>
                                                        </template>
                                                    </lightning-layout>
                                                </lightning-card>
                                            </lightning-layout-item>
                                        </lightning-layout>
                                    </lightning-record-edit-form>
                                </template>
                                <!--发票信息 编辑用 -->
                                <template if:true={isEditInvoice}>
                                    <lightning-record-edit-form object-api-name="Consumable_order__c" record-id={cocId}
                                        onload={handleLoad2}>
                                        <!-- 发票号 状态 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5">
                                                <lightning-input label="发票号" value={OrderCode} data-field="OrderCode"
                                                    onchange={dataChange} variant="label-inline" required
                                                    class="inputFont"></lightning-input>
                                            </lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5" style="padding-left: 100px;">
                                                <lightning-output-field
                                                    field-name="Invoice_status__c"></lightning-output-field>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                        </lightning-layout>
                                        <!-- 发票日期 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5">
                                                <lightning-input type="date" label="发票日期" variant="label-inline"
                                                    value={InvoiceDate} onchange={invoiceDateChange} required
                                                    class="inputFont"></lightning-input>
                                            </lightning-layout-item>
                                        </lightning-layout>
                                        <!-- 客户名 二级经销商 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5">
                                                <div
                                                    class="slds-form-element__control slds-input-has-icon slds-input-has-icon_right">
                                                    <lightning-icon size="x-small"
                                                        class="iconMargin slds-icon slds-input__icon slds-input__icon_right slds-icon-text-default hideHelpText"
                                                        icon-name="utility:search"></lightning-icon>
                                                    <lightning-input type="text" name="HospitalName" label="客户名"
                                                        value={HospitalName} variant="label-inline"
                                                        onclick={searchHospitalNameModal} data-field="HospitalName"
                                                        onchange={clearAgencyI} class="inputFont"></lightning-input>
                                                </div>
                                            </lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5" style="padding-left: 100px;">
                                                <lightning-combobox data-field="secondaryDistributor"
                                                    name="secondaryDistributor" label="二级经销商"
                                                    value={secondaryDistributor} placeholder="请选择..."
                                                    options={provinceOptsMap} variant="label-inline"
                                                    onchange={dataChange} class="inputFont"></lightning-combobox>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                        </lightning-layout>
                                        <!-- 科室 经销商(录入) -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5">
                                                <lightning-input-field onchange={dataChange}
                                                    data-field="ForCustomerText" value={ForCustomerText}
                                                    field-name="Order_ForCustomerText__c"
                                                    class="inputFont"></lightning-input-field>
                                            </lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5" style="padding-left: 100px;">
                                                <lightning-output-field
                                                    field-name="Order_ForDealerText__c"></lightning-output-field>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                        </lightning-layout>
                                        <!-- 备注 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5">
                                                <lightning-input-field onchange={dataChange} data-field="InvoiceNote"
                                                    value={InvoiceNote} field-name="Invoice_Note__c"
                                                    class="inputFont"></lightning-input-field>
                                            </lightning-layout-item>
                                        </lightning-layout>
                                    </lightning-record-edit-form>
                                </template>
                            </div>
                        </div>
                    </div>
                    <!-- 出库单一览 -->
                    <div class="borderCss">
                        <div class="headerDorderCss">
                            <lightning-layout>
                                <lightning-layout-item padding="around-small">
                                    <p style="font-size: 18px">
                                        <strong>出库单一览</strong>
                                    </p>
                                </lightning-layout-item>
                                <lightning-layout-item size="2" padding="around-small">
                                </lightning-layout-item>
                                <template if:false={hideCheckbox}>
                                    <lightning-layout-item padding="around-small">
                                        <!-- <lightning-button label="&#12288;检索&#12288;"
                      <lightning-layout-item class="hehe-layoutItem" size="5">
                        <lightning-input-field
                          onchange={dataChange}
                          data-field="InvoiceNote"
                          value={InvoiceNote}
                          field-name="Invoice_Note__c"
                          class="inputFont"
                        ></lightning-input-field>
                      </lightning-layout-item>
                    </lightning-layout>
                  </lightning-record-edit-form>
                </template>
              </div>
            </div>
          </div>
          <!-- 出库单一览 -->
          <div class="borderCss">
            <div class="headerDorderCss">
              <lightning-layout>
                <lightning-layout-item padding="around-small">
                  <p style="font-size: 18px">
                    <strong>出库单一览</strong>
                  </p>
                </lightning-layout-item>
                <lightning-layout-item size="2" padding="around-small">
                </lightning-layout-item>
                <template if:false={hideCheckbox}>
                  <lightning-layout-item padding="around-small">
                    <!-- <lightning-button label="&#12288;检索&#12288;"
                                            onclick={InvoiceorderSearchJs}></lightning-button> -->
                                        <button
                                            class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                                            onclick={InvoiceorderSearchJs}>检索</button>
                                    </lightning-layout-item>
                                </template>
                    <button
                      class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                      onclick={InvoiceorderSearchJs}
                    >
                      检索
                    </button>
                  </lightning-layout-item>
                </template>
              </lightning-layout>
            </div>
                            </lightning-layout>
                        </div>
                        <!-- <template if:false={hideCheckbox}>
            <!-- <template if:false={hideCheckbox}>
                            <div style="padding: 10px">
                                <div lwc:dom="manual" class="resultDiv"></div>
                                <div draggable="false">
@@ -517,45 +771,61 @@
                            </div>
                        </template> -->
                        <div style="padding: 7px">
                            <div lwc:dom="manual" class="resultDiv"></div>
                            <div draggable="false">
                                <lightning-datatable key-field="Id" data={outboundData} columns={outboundColumns}
                                    hide-checkbox-column={hideCheckbox} onrowselection={getSelectedRows}
                                    selected-rows={selectedRows} class="wrapped-header-datatable" data-field="outbound">
                                </lightning-datatable>
                                <lightning-datatable key-field="id" data={outboundDataSumPrice}
                                    columns={outboundColumns} hide-checkbox-column hide-table-header
                                    class="wrapped-header-datatable">
                                </lightning-datatable>
                            </div>
                        </div>
                    </div>
                    <!-- 发票明细 -->
                    <template if:true={done}>
                        <div class="borderCss">
                            <div class="headerDorderCss">
                                <lightning-layout>
                                    <lightning-layout-item padding="around-small">
                                        <p style="font-size: 18px">
                                            <strong>发票明细</strong>
                                        </p>
                                    </lightning-layout-item>
                                </lightning-layout>
                            </div>
                            <div style="padding: 7px">
                                <div lwc:dom="manual" class="resultDiv"></div>
                                <div draggable="false">
                                    <lightning-datatable key-field="id" data={invoiceOrderdetail1Recoeds}
                                        columns={invoiceDetailsColumns} hide-checkbox-column
                                        class="wrapped-header-datatable">
                                    </lightning-datatable>
                                </div>
                            </div>
                        </div>
                    </template>
                    <!-- 上传附件 -->
                    <!-- <template if:false={EditAble}>
            <div style="padding: 7px">
              <div lwc:dom="manual" class="resultDiv"></div>
              <div draggable="false">
                <lightning-datatable
                  key-field="Id"
                  data={outboundData}
                  columns={outboundColumns}
                  hide-checkbox-column={hideCheckbox}
                  onrowselection={getSelectedRows}
                  selected-rows={selectedRows}
                  class="wrapped-header-datatable"
                  data-field="outbound"
                >
                </lightning-datatable>
                <lightning-datatable
                  key-field="id"
                  data={outboundDataSumPrice}
                  columns={outboundColumns}
                  hide-checkbox-column
                  hide-table-header
                  class="wrapped-header-datatable"
                >
                </lightning-datatable>
              </div>
            </div>
          </div>
          <!-- 发票明细 -->
          <template if:true={done}>
            <div class="borderCss">
              <div class="headerDorderCss">
                <lightning-layout>
                  <lightning-layout-item padding="around-small">
                    <p style="font-size: 18px">
                      <strong>发票明细</strong>
                    </p>
                  </lightning-layout-item>
                </lightning-layout>
              </div>
              <div style="padding: 7px">
                <div lwc:dom="manual" class="resultDiv"></div>
                <div draggable="false">
                  <lightning-datatable
                    key-field="id"
                    data={invoiceOrderdetail1Recoeds}
                    columns={invoiceDetailsColumns}
                    hide-checkbox-column
                    class="wrapped-header-datatable"
                  >
                  </lightning-datatable>
                </div>
              </div>
            </div>
          </template>
          <!-- 上传附件 -->
          <!-- <template if:false={EditAble}>
                        <div class="borderCss">
                            <div class="headerDorderCss">
                                <lightning-layout>
@@ -599,253 +869,331 @@
                            </div>
                        </div>
                    </template> -->
                </div>
            </div>
        </template>
        <template if:true={isConInvoiceList}>
            <div class="outerBorderCss">
                <div style="padding:5px;">
                    <!-- 新建发票 -->
                    <div class="borderCss">
                        <div style="padding:15px;">
                            <div lwc:dom="manual" class="resultDiv"></div>
                            <div draggable="false">
                                <!-- <lightning-button label="新建发票" onclick={newInvoiceJs}></lightning-button> -->
                                <button class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                    onclick={newInvoiceJs}>新建发票</button>
                            </div>
                        </div>
                    </div>
                    <!-- 检索条件 -->
                    <div class="borderCss" style="margin-top: 5px;">
                        <div class="headerDorderCss">
                            <lightning-layout>
                                <lightning-layout-item padding="around-small">
                                    <p style="font-size: 18px">
                                        <strong>检索条件</strong>
                                    </p>
                                </lightning-layout-item>
                            </lightning-layout>
                        </div>
                        <div style="padding: 15px">
                            <div lwc:dom="manual" class="resultDiv"></div>
                            <div draggable="false">
                                <lightning-layout multiple-rows>
                                    <lightning-layout-item flexibility="auto">
                                        <div class="slds-text-align_center">
                                            <div class="slds-grid slds-grid_vertical-align-center">
                                                <div class="slds-form-element__label ">出库日&#12288;从</div>
                                                <lightning-input type="date" variant="label-hidden" label="出库日 从"
                                                    onchange={dataChange} data-field="deliveryFromDate"
                                                    value={deliveryFromDate} class="inputFont"
                                                    style="max-width: 150px;"></lightning-input>
                                            </div>
                                            </br>
                                            <div class="slds-grid slds-grid_vertical-align-center">
                                                <div class="slds-form-element__label ">&#12288;&#12288;&#12288;&#12288;到
                                                </div>
                                                <lightning-input type="date" variant="label-hidden" label="到"
                                                    onchange={dataChange} data-field="deliveryToDate"
                                                    value={deliveryToDate} class="inputFont"
                                                    style="max-width: 150px;"></lightning-input>
                                            </div>
                                        </div>
                                    </lightning-layout-item>
                                    <lightning-layout-item flexibility="auto">
                                        <div class="slds-grid slds-grid_vertical-align-center">
                                            <div class="slds-form-element__label ">发票号</div>
                                            <lightning-input variant="label-hidden" label="发票号" onchange={dataChange}
                                                data-field="category1" value={category1} class="inputFont"
                                                style="max-width: 150px;"></lightning-input>
                                        </div>
                                    </lightning-layout-item>
                                    <lightning-layout-item flexibility="auto">
                                        <div class="slds-grid slds-grid_vertical-align-center">
                                            <div class="slds-form-element__label ">客户名</div>
                                            <lightning-input variant="label-hidden" label="客户名" onchange={dataChange}
                                                data-field="category2" value={category2} class="inputFont"
                                                style="max-width: 150px;"></lightning-input>
                                        </div>
                                    </lightning-layout-item>
                                    <lightning-layout-item flexibility="auto">
                                        <div class="slds-grid slds-grid_vertical-align-center">
                                            <div class="slds-form-element__label ">状态</div>
                                            <lightning-combobox data-field="invoiceStatus" name="invoiceStatus"
                                                label="状态" value={invoiceStatusValue} placeholder="请选择..."
                                                options={Options} variant="label-hidden" onchange={dataChange}
                                                style="min-width: 100px;max-width: 200px;"
                                                class="inputFont"></lightning-combobox>
                                        </div>
                                    </lightning-layout-item>
                                    <lightning-layout-item flexibility="auto">
                                        <div class="slds-grid slds-grid_vertical-align-center">
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                                                onclick={invoiceCodeSearchJs} style="max-width: 110px;">检索</button>
                                        </div>
                                    </lightning-layout-item>
                                    <lightning-layout-item flexibility="auto">
                                        <div class="slds-grid slds-grid_vertical-align-center">
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
                                                onclick={ClearJs} style="max-width: 110px;">清空</button>
                                        </div>
                                    </lightning-layout-item>
                                </lightning-layout>
                            </div>
                        </div>
                    </div>
                    <!-- 发票一览 -->
                    <div class="borderCss" style="margin-top: 5px;">
                        <div class="headerDorderCss">
                            <lightning-layout>
                                <lightning-layout-item padding="around-small">
                                    <p style="font-size: 18px">
                                        <strong>发票一览</strong>
                                    </p>
                                </lightning-layout-item>
                            </lightning-layout>
                        </div>
                        <div style="padding: 7px">
                            <div lwc:dom="manual" class="resultDiv"></div>
                            <div draggable="false">
                                <lightning-datatable key-field="id" data={invoiceData} columns={invoiceColumns}
                                    hide-checkbox-column="true" class="wrapped-header-datatable">
                                </lightning-datatable>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </template>
        </div>
      </div>
    </template>
    <template if:true={isDetailsShow}>
        <div class="outerBorderCss">
            <div style="padding:5px;">
                <!-- 确定 -->
                <div class="borderCss">
                    <div style="padding:10px;">
                        <div lwc:dom="manual" class="resultDiv"></div>
                        <div draggable="false">
                            <!-- <lightning-button label="确定" onclick={detailsSaveJs}></lightning-button> -->
                            <button class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                onclick={detailsSaveJs}>确定</button>
                        </div>
                    </div>
                </div>
    <template if:true={isConInvoiceList}>
      <div class="outerBorderCss">
        <div style="padding: 5px">
          <!-- 新建发票 -->
          <div class="borderCss">
            <div style="padding: 15px">
              <div lwc:dom="manual" class="resultDiv"></div>
              <div draggable="false">
                <!-- <lightning-button label="新建发票" onclick={newInvoiceJs}></lightning-button> -->
                <button
                  class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                  onclick={newInvoiceJs}
                >
                  新建发票
                </button>
              </div>
            </div>
          </div>
                <!-- 发票信息 -->
                <div class="borderCss" style="margin-top: 5px;">
                    <div class="headerDorderCss">
                        <lightning-layout>
                            <lightning-layout-item padding="around-small">
                                <p style="font-size: 18px">
                                    <strong>发票信息</strong>
                                </p>
                            </lightning-layout-item>
                        </lightning-layout>
                    </div>
                    <div style="padding: 7px">
                        <div lwc:dom="manual" class="resultDiv"></div>
                        <div draggable="false">
                            <lightning-record-edit-form object-api-name="Consumable_order__c"
                                record-id={detailsInvoiceId} onload={handleLoad2}>
                                <lightning-layout multiple-rows="true">
                                    <lightning-layout-item size="1"></lightning-layout-item>
                                    <lightning-layout-item size="5">
                                        <lightning-output-field field-name="Name"></lightning-output-field>
                                    </lightning-layout-item>
                                </lightning-layout>
                                <lightning-layout multiple-rows="true">
                                    <lightning-layout-item size="1"></lightning-layout-item>
                                    <lightning-layout-item size="5" class="hehe-layoutItem">
                                        <lightning-output-field field-name="ShipmentAccount__c"
                                            class="hideHelpText"></lightning-output-field>
                                    </lightning-layout-item>
                                </lightning-layout>
                                <lightning-layout multiple-rows="true">
                                    <lightning-layout-item size="1"></lightning-layout-item>
                                    <lightning-layout-item size="5">
                                        <lightning-output-field
                                            field-name="Order_ForCustomerText__c"></lightning-output-field>
                                    </lightning-layout-item>
                                </lightning-layout>
                            </lightning-record-edit-form>
          <!-- 检索条件 -->
          <div class="borderCss" style="margin-top: 5px">
            <div class="headerDorderCss">
              <lightning-layout>
                <lightning-layout-item padding="around-small">
                  <p style="font-size: 18px">
                    <strong>检索条件</strong>
                  </p>
                </lightning-layout-item>
              </lightning-layout>
            </div>
            <div style="padding: 15px">
              <div lwc:dom="manual" class="resultDiv"></div>
              <div draggable="false">
                <lightning-layout multiple-rows>
                  <lightning-layout-item flexibility="auto">
                    <div class="slds-text-align_center">
                      <div class="slds-grid slds-grid_vertical-align-center">
                        <div class="slds-form-element__label">
                          出库日&#12288;从
                        </div>
                    </div>
                </div>
                        <lightning-input
                          type="date"
                          variant="label-hidden"
                          label="出库日 从"
                          onchange={dataChange}
                          data-field="deliveryFromDate"
                          value={deliveryFromDate}
                          class="inputFont"
                          style="max-width: 150px"
                        ></lightning-input>
                      </div>
                <!-- 出库单 -->
                <div class="borderCss" style="margin-top: 5px;">
                    <div class="headerDorderCss">
                        <lightning-layout>
                            <lightning-layout-item padding="around-small">
                                <p style="font-size: 18px">
                                    <strong>出库单</strong>
                                </p>
                            </lightning-layout-item>
                        </lightning-layout>
                    </div>
                    <div style="padding: 7px">
                        <div lwc:dom="manual" class="resultDiv"></div>
                        <div draggable="false">
                            <lightning-record-edit-form object-api-name="Consumable_order__c" record-id={detailsCocId}>
                                <lightning-layout multiple-rows="true">
                                    <lightning-layout-item size="1"></lightning-layout-item>
                                    <lightning-layout-item size="5">
                                        <lightning-output-field field-name="Name"></lightning-output-field>
                                    </lightning-layout-item>
                                </lightning-layout>
                                <lightning-layout multiple-rows="true">
                                    <lightning-layout-item size="1"></lightning-layout-item>
                                    <lightning-layout-item size="5">
                                        <lightning-output-field field-name="Outbound_Date__c"></lightning-output-field>
                                    </lightning-layout-item>
                                </lightning-layout>
                            </lightning-record-edit-form>
                      <!-- </br> -->
                      <div class="slds-grid slds-grid_vertical-align-center">
                        <div class="slds-form-element__label">
                          &#12288;&#12288;&#12288;&#12288;到
                        </div>
                        <lightning-input
                          type="date"
                          variant="label-hidden"
                          label="到"
                          onchange={dataChange}
                          data-field="deliveryToDate"
                          value={deliveryToDate}
                          class="inputFont"
                          style="max-width: 150px"
                        ></lightning-input>
                      </div>
                    </div>
                </div>
                  </lightning-layout-item>
                  <lightning-layout-item flexibility="auto">
                    <div class="slds-grid slds-grid_vertical-align-center">
                      <div class="slds-form-element__label">发票号</div>
                      <lightning-input
                        variant="label-hidden"
                        label="发票号"
                        onchange={dataChange}
                        data-field="category1"
                        value={category1}
                        class="inputFont"
                        style="max-width: 150px"
                      ></lightning-input>
                    </div>
                  </lightning-layout-item>
                  <lightning-layout-item flexibility="auto">
                    <div class="slds-grid slds-grid_vertical-align-center">
                      <div class="slds-form-element__label">客户名</div>
                      <lightning-input
                        variant="label-hidden"
                        label="客户名"
                        onchange={dataChange}
                        data-field="category2"
                        value={category2}
                        class="inputFont"
                        style="max-width: 150px"
                      ></lightning-input>
                    </div>
                  </lightning-layout-item>
                  <lightning-layout-item flexibility="auto">
                    <div class="slds-grid slds-grid_vertical-align-center">
                      <div class="slds-form-element__label">状态</div>
                      <lightning-combobox
                        data-field="invoiceStatus"
                        name="invoiceStatus"
                        label="状态"
                        value={invoiceStatusValue}
                        placeholder="请选择..."
                        options={Options}
                        variant="label-hidden"
                        onchange={dataChange}
                        style="min-width: 100px; max-width: 200px"
                        class="inputFont"
                      ></lightning-combobox>
                    </div>
                  </lightning-layout-item>
                  <lightning-layout-item flexibility="auto">
                    <div class="slds-grid slds-grid_vertical-align-center">
                      <button
                        class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                        onclick={invoiceCodeSearchJs}
                        style="max-width: 110px"
                      >
                        检索
                      </button>
                    </div>
                  </lightning-layout-item>
                  <lightning-layout-item flexibility="auto">
                    <div class="slds-grid slds-grid_vertical-align-center">
                      <button
                        class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
                        onclick={ClearJs}
                        style="max-width: 110px"
                      >
                        清空
                      </button>
                    </div>
                  </lightning-layout-item>
                </lightning-layout>
              </div>
            </div>
          </div>
                <!-- 出库单明细 -->
                <div class="borderCss" style="margin-top: 5px;">
                    <div class="headerDorderCss">
                        <lightning-layout>
                            <lightning-layout-item padding="around-small">
                                <p style="font-size: 18px">
                                    <strong>出库单明细</strong>
                                </p>
                            </lightning-layout-item>
                        </lightning-layout>
                    </div>
                    <div style="padding: 7px">
                        <div lwc:dom="manual" class="resultDiv"></div>
                        <div draggable="false">
                            <!-- <lightning-datatable class="datatabel slds-border_top" key-field="id"
          <!-- 发票一览 -->
          <div class="borderCss" style="margin-top: 5px">
            <div class="headerDorderCss">
              <lightning-layout>
                <lightning-layout-item padding="around-small">
                  <p style="font-size: 18px">
                    <strong>发票一览</strong>
                  </p>
                </lightning-layout-item>
              </lightning-layout>
            </div>
            <div style="padding: 7px">
              <div lwc:dom="manual" class="resultDiv"></div>
              <div draggable="false">
                <lightning-datatable
                  key-field="id"
                  data={invoiceData}
                  columns={invoiceColumns}
                  hide-checkbox-column="true"
                  class="wrapped-header-datatable"
                >
                </lightning-datatable>
              </div>
            </div>
          </div>
        </div>
      </div>
    </template>
  </template>
  <template if:true={isDetailsShow}>
    <div class="outerBorderCss">
      <div style="padding: 5px">
        <!-- 确定 -->
        <div class="borderCss">
          <div style="padding: 10px">
            <div lwc:dom="manual" class="resultDiv"></div>
            <div draggable="false">
              <!-- <lightning-button label="确定" onclick={detailsSaveJs}></lightning-button> -->
              <button
                class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                onclick={detailsSaveJs}
              >
                确定
              </button>
            </div>
          </div>
        </div>
        <!-- 发票信息 -->
        <div class="borderCss" style="margin-top: 5px">
          <div class="headerDorderCss">
            <lightning-layout>
              <lightning-layout-item padding="around-small">
                <p style="font-size: 18px">
                  <strong>发票信息</strong>
                </p>
              </lightning-layout-item>
            </lightning-layout>
          </div>
          <div style="padding: 7px">
            <div lwc:dom="manual" class="resultDiv"></div>
            <div draggable="false">
              <lightning-record-edit-form
                object-api-name="Consumable_order__c"
                record-id={detailsInvoiceId}
                onload={handleLoad2}
              >
                <lightning-layout multiple-rows="true">
                  <lightning-layout-item size="1"></lightning-layout-item>
                  <lightning-layout-item size="5">
                    <lightning-output-field
                      field-name="Name"
                    ></lightning-output-field>
                  </lightning-layout-item>
                </lightning-layout>
                <lightning-layout multiple-rows="true">
                  <lightning-layout-item size="1"></lightning-layout-item>
                  <lightning-layout-item size="5" class="hehe-layoutItem">
                    <lightning-output-field
                      field-name="ShipmentAccount__c"
                      class="hideHelpText"
                    ></lightning-output-field>
                  </lightning-layout-item>
                </lightning-layout>
                <lightning-layout multiple-rows="true">
                  <lightning-layout-item size="1"></lightning-layout-item>
                  <lightning-layout-item size="5">
                    <lightning-output-field
                      field-name="Order_ForCustomerText__c"
                    ></lightning-output-field>
                  </lightning-layout-item>
                </lightning-layout>
              </lightning-record-edit-form>
            </div>
          </div>
        </div>
        <!-- 出库单 -->
        <div class="borderCss" style="margin-top: 5px">
          <div class="headerDorderCss">
            <lightning-layout>
              <lightning-layout-item padding="around-small">
                <p style="font-size: 18px">
                  <strong>出库单</strong>
                </p>
              </lightning-layout-item>
            </lightning-layout>
          </div>
          <div style="padding: 7px">
            <div lwc:dom="manual" class="resultDiv"></div>
            <div draggable="false">
              <lightning-record-edit-form
                object-api-name="Consumable_order__c"
                record-id={detailsCocId}
              >
                <lightning-layout multiple-rows="true">
                  <lightning-layout-item size="1"></lightning-layout-item>
                  <lightning-layout-item size="5">
                    <lightning-output-field
                      field-name="Name"
                    ></lightning-output-field>
                  </lightning-layout-item>
                </lightning-layout>
                <lightning-layout multiple-rows="true">
                  <lightning-layout-item size="1"></lightning-layout-item>
                  <lightning-layout-item size="5">
                    <lightning-output-field
                      field-name="Outbound_Date__c"
                    ></lightning-output-field>
                  </lightning-layout-item>
                </lightning-layout>
              </lightning-record-edit-form>
            </div>
          </div>
        </div>
        <!-- 出库单明细 -->
        <div class="borderCss" style="margin-top: 5px">
          <div class="headerDorderCss">
            <lightning-layout>
              <lightning-layout-item padding="around-small">
                <p style="font-size: 18px">
                  <strong>出库单明细</strong>
                </p>
              </lightning-layout-item>
            </lightning-layout>
          </div>
          <div style="padding: 7px">
            <div lwc:dom="manual" class="resultDiv"></div>
            <div draggable="false">
              <!-- <lightning-datatable class="datatabel slds-border_top" key-field="id"
                                data={detaisData} columns={detailsColumns}>
                            </lightning-datatable> -->
                            <c-lex-custom-lightning-datatable key-field="Id" data={detailsData} columns={detailsColumns}
                                onunitchange={handleUnitChange} onshipmentnumber={handleShipmentNumber}
                                onrowselection={detailsGetSelectedRows} selected-rows={detailsSelectedRows}
                                style="word-wrap:break-word; word-break:break-all; " class="wrapped-header-datatable"
                                min-column-width="115">
                            </c-lex-custom-lightning-datatable>
                            <lightning-datatable class="datatabel slds-border_top wrapped-header-datatable"
                                key-field="id" data={invoiceAllpriceData} columns={detailsColumns} hide-checkbox-column
                                hide-table-header>
                            </lightning-datatable>
                        </div>
                    </div>
                </div>
              <c-lex-custom-lightning-datatable
                key-field="Id"
                data={detailsData}
                columns={detailsColumns}
                onunitchange={handleUnitChange}
                onshipmentnumber={handleShipmentNumber}
                onrowselection={detailsGetSelectedRows}
                selected-rows={detailsSelectedRows}
                style="word-wrap: break-word; word-break: break-all"
                class="wrapped-header-datatable"
              >
              </c-lex-custom-lightning-datatable>
              <lightning-datatable
                class="datatabel slds-border_top wrapped-header-datatable"
                key-field="id"
                data={invoiceAllpriceData}
                columns={detailsColumns}
                hide-checkbox-column
                hide-table-header
              >
              </lightning-datatable>
            </div>
          </div>
        </div>
    </template>
</template>
      </div>
    </div>
  </template>
</template>
force-app/main/default/lwc/lexConInvoiceView/lexConInvoiceView.js
@@ -1,4 +1,4 @@
import { LightningElement, api, track, wire } from 'lwc';
import { LightningElement, api, track, wire } from "lwc";
import { ShowToastEvent } from "lightning/platformShowToastEvent";
import init from "@salesforce/apex/LexConInvoiceViewController.init";
import save from "@salesforce/apex/LexConInvoiceViewController.save";
@@ -13,1777 +13,2020 @@
import serContact from "@salesforce/apex/lexSearchAgencyHospitalController.serContact";
import detailsInit from "@salesforce/apex/LexConInvoicedetailsController.init";
import detailsSave from "@salesforce/apex/LexConInvoicedetailsController.save";
import deleteAtt from '@salesforce/apex/LexSummonsCreatController.deleteAtt';
import deleteAtt from "@salesforce/apex/LexSummonsCreatController.deleteAtt";
import { NavigationMixin } from "lightning/navigation";
//table css
//table css
import { loadStyle } from "lightning/platformResourceLoader";
import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
import LexConInvoiceViewReport from '@salesforce/label/c.LexConInvoiceViewReport';
import LexConInvoiceViewReport from "@salesforce/label/c.LexConInvoiceViewReport";
const hospitalColumns = [
    {
        label: "",
        fieldName: "Id1",
        type: "button",
        initialWidth: 90,
        hideDefaultActions: true,
        typeAttributes: {
            label: "选择",
            name: "Id2",
            size: 1,
        },
    },
    {
        label: "医院名称",
        fieldName: "Name",
        hideDefaultActions: true,
        wrapText: true,
    },
    {
        label: "省份",
        fieldName: "stateMasterName",
        hideDefaultActions: true,
  {
    label: "",
    fieldName: "Id1",
    type: "button",
    initialWidth: 90,
    hideDefaultActions: true,
    typeAttributes: {
      label: "选择",
      name: "Id2",
      size: 1
    }
  },
  {
    label: "医院名称",
    fieldName: "Name",
    hideDefaultActions: true,
    wrapText: true
  },
  {
    label: "省份",
    fieldName: "stateMasterName",
    hideDefaultActions: true
  }
];
const invoiceDetailsColumns = [
    {
        label: "出库日期",
        fieldName: "esdetProductOutDate",
        hideDefaultActions: true,
        wrapText: true,
    },
    {
        label: "出库单编码",
        fieldName: "esdetInvoicedet1ODlinkName",
        wrapText: true,
        hideDefaultActions: true,
        wrapText: true,
    },
    {
        label: "产品型号",
        fieldName: "esdetAssetModelNo",
        hideDefaultActions: true,
        wrapText: true,
        initialWidth: 400,
    },
    {
        label: "单位",
        fieldName: "esdetInvoiceUnit",
        hideDefaultActions: true,
        wrapText: true,
        initialWidth: 50,
    },
    {
        label: "发票单价",
        fieldName: "esdetInvoiceUnitprice",
        hideDefaultActions: true,
        wrapText: true,
        type: "number",
        typeAttributes: {
            minimumFractionDigits: 2,
        },
    },
    {
        label: "发票数量",
        fieldName: "esdetInvoicedCount",
        cellAttributes: { alignment: 'right' },
        hideDefaultActions: true,
        wrapText: true,
    },
    {
        label: "发票票面金额(元)",
        fieldName: "esdetInvoicedProCostRMB",
        hideDefaultActions: true,
        wrapText: true,
        cellAttributes: { alignment: 'right' },
        initialWidth:145,
        type: "number",
        typeAttributes: {
            minimumFractionDigits: 2,
        },
    },
  {
    label: "出库日期",
    fieldName: "esdetProductOutDate",
    hideDefaultActions: true,
    wrapText: true
  },
  {
    label: "出库单编码",
    fieldName: "esdetInvoicedet1ODlinkName",
    wrapText: true,
    hideDefaultActions: true,
    wrapText: true
  },
  {
    label: "产品型号",
    fieldName: "esdetAssetModelNo",
    hideDefaultActions: true,
    wrapText: true,
    initialWidth: 400
  },
  {
    label: "单位",
    fieldName: "esdetInvoiceUnit",
    hideDefaultActions: true,
    wrapText: true,
    initialWidth: 50
  },
  {
    label: "发票单价",
    fieldName: "esdetInvoiceUnitprice",
    hideDefaultActions: true,
    wrapText: true,
    type: "number",
    typeAttributes: {
      minimumFractionDigits: 2
    }
  },
  {
    label: "发票数量",
    fieldName: "esdetInvoicedCount",
    cellAttributes: { alignment: "right" },
    hideDefaultActions: true,
    wrapText: true
  },
  {
    label: "发票票面金额(元)",
    fieldName: "esdetInvoicedProCostRMB",
    hideDefaultActions: true,
    wrapText: true,
    cellAttributes: { alignment: "right" },
    initialWidth: 145,
    type: "number",
    typeAttributes: {
      minimumFractionDigits: 2
    }
  }
];
const invoiceColumns = [
    {
        label: "发票日期",
        fieldName: "Invoice_Date__c",
        hideDefaultActions: true,
        initialWidth: 150
  {
    label: "发票日期",
    fieldName: "Invoice_Date__c",
    hideDefaultActions: true,
    initialWidth: 150
  },
  {
    label: "发票号",
    type: "url",
    fieldName: "NameUrl",
    typeAttributes: {
      label: { fieldName: "Name" }
    },
    {
        label: "发票号",
        type: 'url',
        fieldName: "NameUrl",
        typeAttributes: {
            label: { fieldName: "Name" },
        },
        hideDefaultActions: true,
    hideDefaultActions: true
  },
  {
    label: "客户名",
    fieldName: "ShipmentAccount__c",
    hideDefaultActions: true,
    wrapText: true
  },
  {
    label: "发票状态",
    fieldName: "Invoice_status__c",
    hideDefaultActions: true,
    initialWidth: 100
  },
  {
    label: "发票账面金额(元)",
    fieldName: "Invoice_total_amount__c",
    hideDefaultActions: true,
    type: "number",
    typeAttributes: {
      minimumFractionDigits: 2
    },
    {
        label: "客户名",
        fieldName: "ShipmentAccount__c",
        hideDefaultActions: true,
        wrapText: true,
    },
    {
        label: "发票状态",
        fieldName: "Invoice_status__c",
        hideDefaultActions: true,
        initialWidth: 100
    },
    {
        label: "发票账面金额(元)",
        fieldName: "Invoice_total_amount__c",
        hideDefaultActions: true,
        type: "number",
        typeAttributes: {
            minimumFractionDigits: 2,
        },
        initialWidth: 180
    },
    {
        label: "发票附件",
        fieldName: "Invoice_attachment__c",
        type: 'boolean',
        hideDefaultActions: true,
        initialWidth: 120
    },
    {
        label: "发票明细附件",
        fieldName: "Invoicedet_attachment__c",
        type: 'boolean',
        hideDefaultActions: true,
        initialWidth: 120
    },
    initialWidth: 180
  },
  {
    label: "发票附件",
    fieldName: "Invoice_attachment__c",
    type: "boolean",
    hideDefaultActions: true,
    initialWidth: 120
  },
  {
    label: "发票明细附件",
    fieldName: "Invoicedet_attachment__c",
    type: "boolean",
    hideDefaultActions: true,
    initialWidth: 120
  }
];
const detailsColumns = [
    {
        label: "产品型号",
        fieldName: "esdAssetModelNo",
        hideDefaultActions: true,
        initialWidth: 200,
        wrapText: true,
  {
    label: "产品型号",
    fieldName: "esdAssetModelNo",
    hideDefaultActions: true,
    initialWidth: 150,
    wrapText: true
  },
  {
    label: "规格",
    fieldName: "packingListManual",
    hideDefaultActions: true,
    initialWidth: 50
  },
  {
    label: "出货单价(元)",
    fieldName: "esdDeliveryListRMB",
    hideDefaultActions: true,
    initialWidth: 100,
    type: "number",
    typeAttributes: {
      minimumFractionDigits: 2
    }
  },
  {
    label: "出货数量",
    fieldName: "esdShipmentCount",
    hideDefaultActions: true
  },
  {
    label: "返品数量",
    fieldName: "esdRrturnProCount",
    hideDefaultActions: true
  },
  {
    label: "出库单位",
    fieldName: "esdBoxPiece",
    hideDefaultActions: true
  },
  {
    label: "已发票数量",
    fieldName: "esdInvoicedProcount",
    hideDefaultActions: true,
    type: "number",
    typeAttributes: {
      minimumFractionDigits: 2
    }
  },
  {
    label: "还没发票数量",
    fieldName: "esdInvoiceProNotCount",
    hideDefaultActions: true,
    initialWidth: 100,
    type: "number",
    typeAttributes: {
      minimumFractionDigits: 2
    }
  },
  {
    label: "开票单位",
    hideDefaultActions: true,
    type: "customUnit",
    typeAttributes: {
      unitValue: { fieldName: "unitValue" },
      unitOptions: { fieldName: "unitOptions" },
      recordId: { fieldName: "recordId" },
      isDisabled: { fieldName: "isDisabled" }
    }
  },
  {
    label: "发票单价",
    fieldName: "esdInvoiceUnitprice",
    hideDefaultActions: true,
    type: "number",
    typeAttributes: {
      minimumFractionDigits: 2
    },
    {
        label: "规格",
        fieldName: "packingListManual",
        hideDefaultActions: true,
        initialWidth: 30
    },
    {
        label: "出货单价(元)",
        fieldName: "esdDeliveryListRMB",
        hideDefaultActions: true,
        type: "number",
        typeAttributes: {
            minimumFractionDigits: 2,
        },
    },
    {
        label: "出货数量",
        fieldName: "esdShipmentCount",
        hideDefaultActions: true,
    },
    {
        label: "返品数量",
        fieldName: "esdRrturnProCount",
        hideDefaultActions: true,
    },
    {
        label: "出库单位",
        fieldName: "esdBoxPiece",
        hideDefaultActions: true,
    },
    {
        label: "已发票数量",
        fieldName: "esdInvoicedProcount",
        hideDefaultActions: true,
        type: "number",
        typeAttributes: {
            minimumFractionDigits: 2,
        },
    },
    {
        label: "还没发票数量",
        fieldName: "esdInvoiceProNotCount",
        hideDefaultActions: true,
        type: "number",
        typeAttributes: {
            minimumFractionDigits: 2,
        },
    },
    {
        label: "开票单位",
        hideDefaultActions: true,
        type: "customUnit",
        typeAttributes: {
            unitValue: { fieldName: "unitValue" },
            unitOptions: { fieldName: "unitOptions" },
            recordId: { fieldName: "recordId" },
            isDisabled: { fieldName: "isDisabled" },
        },
    },
    {
        label: "发票单价",
        fieldName: "esdInvoiceUnitprice",
        hideDefaultActions: true,
        type: "number",
        typeAttributes: {
            minimumFractionDigits: 2,
        },
        initialWidth: 130
    },
    {
        label: "发票数量",
        //fieldName: "invoiceCount",
        hideDefaultActions: true,
        type: "customShipment",
        cellAttributes: { alignment: 'right' },
        typeAttributes: {
            recordId: { fieldName: "recordId" },
            shipmentNumber: { fieldName: "shipmentNumber" },
            isConinvoice: { fieldName: "isConinvoice" },
            esdInvoiceProNotCount: { fieldName: "esdInvoiceProNotCount" },
        },
    },
    {
        label: "发票票面金额(元)",
        cellAttributes: { alignment: 'right' },
        fieldName: "invoiceAllprice",
        hideDefaultActions: true,
        type: "number",
        initialWidth: 150,
        typeAttributes: {
            minimumFractionDigits: 2,
        },
    },
]
    initialWidth: 130
  },
  {
    label: "发票数量",
    //fieldName: "invoiceCount",
    hideDefaultActions: true,
    type: "customShipment",
    cellAttributes: { alignment: "right" },
    typeAttributes: {
      recordId: { fieldName: "recordId" },
      shipmentNumber: { fieldName: "shipmentNumber" },
      isConinvoice: { fieldName: "isConinvoice" },
      esdInvoiceProNotCount: { fieldName: "esdInvoiceProNotCount" }
    }
  },
  {
    label: "发票票面金额(元)",
    cellAttributes: { alignment: "right" },
    fieldName: "invoiceAllprice",
    hideDefaultActions: true,
    type: "number",
    initialWidth: 150,
    typeAttributes: {
      minimumFractionDigits: 2
    }
  }
];
const customLabel = {
    LexConInvoiceViewReport
}
export default class LexConInvoiceView extends NavigationMixin(LightningElement) {
  LexConInvoiceViewReport
};
export default class LexConInvoiceView extends NavigationMixin(
  LightningElement
) {
  @track label = customLabel;
  invoiceColumns = invoiceColumns;
  detailsColumns = detailsColumns;
  @track outboundColumns = [
    {
      label: "出库日期",
      fieldName: "esdOutboundDate",
      hideDefaultActions: true,
      wrapText: true
    },
    {
      label: "出库单编码",
      fieldName: "esdNameUrl",
      type: "url",
      typeAttributes: {
        label: { fieldName: "esdName" },
        target: "_blank"
      },
      hideDefaultActions: true,
      wrapText: true
    }
  ];
  @track outboundData = [];
  @track outboundDataSumPrice = [];
  @track invoiceData = [];
  @track invoiceAllpriceData = [];
  @track detailsSelectedRows = [];
  @track showAttPop = false;
    @track label = customLabel;
    invoiceColumns = invoiceColumns;
    detailsColumns = detailsColumns;
    @track outboundColumns = [
        {
            label: "出库日期",
            fieldName: "esdOutboundDate",
            hideDefaultActions: true,
            wrapText: true,
        },
        {
            label: "出库单编码",
            fieldName: "esdNameUrl",
            type: 'url',
            typeAttributes: {
                label: { fieldName: "esdName" },
                target: "_blank",
            },
            hideDefaultActions: true,
            wrapText: true,
  @track invoiceId = "";
  @track orderId = "";
  @track userWorkLocation = "";
  @track deliveryId = "";
  @track cocId = "";
  @track statusEdit = "";
  @track coc = {};
  @track EditAble = false;
  @track isChange = false;
  @track sumPrice = 0.0;
  @track OrderCode = "";
  @track ExistOutbound = false;
  @track reopen = "";
  @track invoiceOrderRecoedschange = [];
  @track isNew = "";
  @track outOrderStringListLwc = [];
  @track outordercountMapLwc = {};
  @track selectedRows = [];
  @track detailsInvoiceId = "";
  @track detailsCocId = "";
  @track detailsData = [];
  @track invoiceAllprice = 0.0;
  //状态
  @track invoiceStatusValue = "";
  @track invoiceStatusOptions = [];
  get Options() {
    return this.invoiceStatusOptions;
  }
  //出库从
  @track deliveryFromDate = "";
  //出库到
  @track deliveryToDate = "";
  //发票号
  @track category1 = "";
  //客户名
  @track category2 = "";
  @track ConInvoiceListAccountId = "";
  @track ConInvoiceListUserWorkLocation = "";
  @track ConInvoiceListAgencyProType = "";
  //二级经销商
  @track provinceOptsMap = [];
  @track secondaryDistributor = "";
  //客户名
  @track isModalOpen = false;
  @track HospitalName = "";
  @track HospitalInfo = "";
  @track searchHospitalName = "";
  @track isDisabledHospitalName = false;
  @track agencyProType = "";
  @track accountid = "";
  @track hospitalList = [];
  hospitalColumns = hospitalColumns;
  //发票日期
  @track InvoiceDate = "";
  //科室
  @track ForCustomerText = "";
  //备注
  @track InvoiceNote = "";
  //发票明细
  @track invoiceOrderdetail1Recoeds = [];
  invoiceDetailsColumns = invoiceDetailsColumns;
  //显示
  @track isShowSecondaryDistributor = false;
  @track isEditInvoice = false;
  @track isShowSpinner = true;
  @track hideCheckbox = true;
  @track done = false;
  @track isConInvoiceList = true;
  @track isDetailsShow = false;
  //disable
  @track isDisabledEdit = false;
  @track isDisabledReopen = false;
  @track isDisabledDelete = false;
  @track isDisabledAttachment = false;
  @track isOpenReportDisabled = true;
  //文件上传
  @track showLoadingSpinner = false;
  @track showPopSpinner = false;
  @track UploadFile = "Upload File";
  @track fileName = "";
  @track fileData = [];
  @track fileColumns = [
    {
      label: "标题",
      fieldName: "url",
      type: "url",
      typeAttributes: { label: { fieldName: "Title" }, target: "_blank" },
      hideDefaultActions: true
    },
    {
      label: "创建人",
      type: "url",
      fieldName: "CreatedByNameUrl",
      typeAttributes: {
        label: { fieldName: "CreatedByName" },
        target: "_blank"
      },
      hideDefaultActions: true
    },
    {
      label: "上传日期",
      type: "date",
      typeAttributes: {
        year: "numeric",
        month: "long",
        day: "2-digit",
        hour: "2-digit",
        minute: "2-digit"
      },
      fieldName: "CreatedDate",
      hideDefaultActions: true
    },
    {
      label: "附件类型",
      type: "customAttachmentType",
      typeAttributes: {
        typeValue: { fieldName: "typeValue" },
        typeOptions: { fieldName: "typeOptions" },
        recordId: { fieldName: "recordId" },
        isDisabledAttachment: { fieldName: "isDisabledAttachment" }
      },
      hideDefaultActions: true
    },
    {
      label: "",
      type: "tableCellIcon",
      typeAttributes: {
        iconName: "utility:delete",
        recordId: {
          fieldName: "Id"
        }
    ]
    @track outboundData = [];
    @track outboundDataSumPrice = [];
    @track invoiceData = [];
    @track invoiceAllpriceData = [];
    @track detailsSelectedRows = [];
    @track showAttPop = false;
    @track invoiceId = '';
    @track orderId = '';
    @track userWorkLocation = '';
    @track deliveryId = '';
    @track cocId = '';
    @track statusEdit = '';
    @track coc = {};
    @track EditAble = false;
    @track isChange = false;
    @track sumPrice = 0.00;
    @track OrderCode = '';
    @track ExistOutbound = false;
    @track reopen = '';
    @track invoiceOrderRecoedschange = [];
    @track isNew = '';
    @track outOrderStringListLwc = [];
    @track outordercountMapLwc = {};
    @track selectedRows = [];
    @track detailsInvoiceId = '';
    @track detailsCocId = '';
    @track detailsData = [];
    @track invoiceAllprice = 0.00;
    //状态
    @track invoiceStatusValue = '';
    @track invoiceStatusOptions = [];
    get Options() {
        return this.invoiceStatusOptions;
      },
      initialWidth: 50,
      hideDefaultActions: true
    }
    //出库从
    @track deliveryFromDate = '';
    //出库到
    @track deliveryToDate = '';
    //发票号
    @track category1 = '';
    //客户名
    @track category2 = '';
    @track ConInvoiceListAccountId = '';
    @track ConInvoiceListUserWorkLocation = '';
    @track ConInvoiceListAgencyProType = '';
  ];
  filesUploaded = [];
  fileContents;
  fileReader;
  content;
  MAX_FILE_SIZE = 1500000;
    //二级经销商
    @track provinceOptsMap = [];
    @track secondaryDistributor = '';
    //客户名
    @track isModalOpen = false;
    @track HospitalName = "";
    @track HospitalInfo = "";
    @track searchHospitalName = "";
    @track isDisabledHospitalName = false;
    @track agencyProType = '';
    @track accountid = '';
    @track hospitalList = [];
    hospitalColumns = hospitalColumns;
    //发票日期
    @track InvoiceDate = '';
    //科室
    @track ForCustomerText = '';
    //备注
    @track InvoiceNote = '';
    //发票明细
    @track invoiceOrderdetail1Recoeds = [];
    invoiceDetailsColumns = invoiceDetailsColumns;
    //显示
    @track isShowSecondaryDistributor = false;
    @track isEditInvoice = false;
    @track isShowSpinner = true;
    @track hideCheckbox = true;
    @track done = false;
    @track isConInvoiceList = true;
    @track isDetailsShow = false;
    //disable
    @track isDisabledEdit = false;
    @track isDisabledReopen = false;
    @track isDisabledDelete = false;
    @track isDisabledAttachment = false;
    @track isOpenReportDisabled = true;
    //文件上传
    @track showLoadingSpinner = false;
    @track showPopSpinner = false;
    @track UploadFile = "Upload File";
    @track fileName = "";
    @track fileData = [];
    @track fileColumns = [
        {
            label: "标题",
            fieldName: "url",
            type: "url",
            typeAttributes: { label: { fieldName: "Title" }, target: "_blank" },
            hideDefaultActions: true,
        },
        {
            label: "创建人",
            type: "url",
            fieldName: "CreatedByNameUrl",
            typeAttributes: { label: { fieldName: "CreatedByName" }, target: "_blank" },
            hideDefaultActions: true,
        },
        {
            label: "上传日期",
            type: 'date',
            typeAttributes: {
                year: "numeric",
                month: "long",
                day: "2-digit",
                hour: "2-digit",
                minute: "2-digit"
            },
            fieldName: "CreatedDate",
            hideDefaultActions: true,
        },
        {
            label: "附件类型",
            type: "customAttachmentType",
            typeAttributes: {
                typeValue: { fieldName: "typeValue" },
                typeOptions: { fieldName: "typeOptions" },
                recordId: { fieldName: "recordId" },
                isDisabledAttachment: { fieldName: "isDisabledAttachment" },
            },
            hideDefaultActions: true,
        },
        {
            label: '',
            type: 'tableCellIcon',
            typeAttributes: {
                iconName: 'utility:delete',
                recordId: {
                    fieldName: 'Id'
                }
            },
            initialWidth: 50,
            hideDefaultActions: true
        },
    ];
    filesUploaded = [];
    fileContents;
    fileReader;
    content;
    MAX_FILE_SIZE = 1500000;
    stylesLoaded = false;
    renderedCallback() {
        if (!this.stylesLoaded) {
            Promise.all([loadStyle(this, WrappedHeaderTable)])
                .then(() => {
                    console.log("Custom styles loaded");
                    this.stylesLoaded = true;
                })
                .catch((error) => {
                    console.error("Error loading custom styles");
                });
        }
    }
    //获取链接参数
    getQueryString(name) {
        console.log("getQueryString name " + name);
        let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        let r = window.location.search.substr(1).match(reg);
        if (r != null) {
            return decodeURIComponent(r[2]);
        }
        return null;
    }
    connectedCallback() {
        this.init();
    }
    init() {
        this.isShowSpinner = true;
        this.deliveryId = this.getQueryString("deliveryId");
        this.deliveryId = this.deliveryId == null ? "" : this.deliveryId;
        this.invoiceId = this.getQueryString("invoiceId");
        this.invoiceId = this.invoiceId == null ? "" : this.invoiceId;
        this.orderId = this.getQueryString("orderId");
        this.orderId = this.orderId == null ? "" : this.orderId;
        this.statusEdit = this.getQueryString("KeyWords");
        this.statusEdit = this.statusEdit == null ? "" : this.statusEdit;
        this.reopen = this.getQueryString("reopen");
        this.reopen = this.reopen == null ? "" : this.reopen;
        this.isNew = this.getQueryString("isNew");
        this.isNew = this.isNew == null ? "" : this.isNew;
        console.log('this.deliveryId = ' + this.deliveryId + ' this.invoiceId = ' + this.invoiceId + ' this.statusEdit = ' + this.statusEdit);
        if (this.invoiceId != '' && this.orderId != '') {
            //进入coninvoiceDetails
            detailsInit({
                orderIdLwc: this.orderId,
                invoiceIdLwc: this.invoiceId
            }).then((r) => {
                r = JSON.parse(JSON.stringify(r));
                if (r.status == "Success") {
                    this.detailsInvoiceId = r.entity.invoicecode.Id;
                    this.detailsCocId = r.entity.coc.Id;
                    this.detailsData = r.entity.consumableorderdetails1Records;
                    for (var i in this.detailsData) {
                        this.detailsData[i]['Id'] = this.detailsData[i].esd.Id;
                        this.detailsData[i]['esdAssetModelNo'] = this.detailsData[i].esd.Asset_Model_No__c;
                        this.detailsData[i]['packingListManual'] = this.detailsData[i].Packing_list_manual;
                        this.detailsData[i]['esdDeliveryListRMB'] = this.detailsData[i].esd.Delivery_List_RMB__c;
                        this.detailsData[i]['esdShipmentCount'] = this.detailsData[i].esd.Shipment_Count__c;
                        this.detailsData[i]['esdRrturnProCount'] = this.detailsData[i].esd.RrturnPro_count__c;
                        this.detailsData[i]['esdBoxPiece'] = this.detailsData[i].esd.Box_Piece__c;
                        this.detailsData[i]['esdInvoicedProcount'] = this.detailsData[i].esd.Invoiced_Procount__c;
                        this.detailsData[i]['esdInvoiceProNotCount'] = this.detailsData[i].esd.InvoiceProNot_count__c;
                        //开票单位
                        //this.detailsData[i].esd.Box_Piece__c
                        //this.detailsData[i]['unitValue'] = this.detailsData[i].esd.Invoice_Unit__c;
                        this.detailsData[i]['unitValue'] = this.detailsData[i].esd.Box_Piece__c;
                        console.log('unitValue = ' + this.detailsData[i]['unitValue']);
                        this.detailsData[i]['recordId'] = this.detailsData[i].esd.Id;
                        //disabled="{!IF(records.esd.Box_Piece__c =='个' || (records.esd.Box_Piece__c =='盒' && records.Packing_list_manual ==1),true,false)}"
                        //this.detailsData[i]['isDisabled'] = (this.detailsData[i].esd.Box_Piece__c == '个' || (this.detailsData[i].esd.Box_Piece__c =='盒' && this.detailsData[i].Packing_list_manual ==1)) ? true:false;
                        this.detailsData[i]['isDisabled'] = true;
                        let unitOptions = [];
                        for (var key in this.detailsData[i].Invoice_UnitOptsMap) {
                            let unitOption = {};
                            unitOption["label"] = this.detailsData[i].Invoice_UnitOptsMap[key];
                            unitOption["value"] = key;
                            unitOptions.push(unitOption);
                        }
                        this.detailsData[i]["unitOptions"] = unitOptions;
                        this.detailsData[i]['esdInvoiceUnitprice'] = this.detailsData[i].esd.Invoice_Unitprice__c;
                        //发票数量
                        this.detailsData[i]['shipmentNumber'] = this.detailsData[i].invoiceCount;
                        this.detailsData[i]['isConinvoice'] = true;
                        this.detailsData[i]['invoiceAllprice'] = this.detailsData[i].invoiceAllprice;
                        if (this.detailsData[i].check) {
                            this.detailsSelectedRows.push(this.detailsData[i]['Id']);
                            this.invoiceAllprice += this.detailsData[i]['invoiceAllprice'];
                        }
                    }
                    console.log('this.detailsData = ' + JSON.stringify(this.detailsData));
                    let lastInvoiceAllprice = {
                        invoiceAllprice: this.invoiceAllprice
                    }
                    this.invoiceAllpriceData.push(lastInvoiceAllprice);
                    console.log('this.invoiceAllpriceData = ' + JSON.stringify(this.invoiceAllpriceData))
                    this.isShowSpinner = false;
                    this.isDetailsShow = true;
                } else {
                    this.showMyToast('初始化失败', r.msg, 'Error');
                }
            }).catch((error) => {
                this.isShowSpinner = false;
                console.log("error = " + JSON.stringify(error));
            });
        } else if (this.deliveryId == '' && this.invoiceId == '' && this.isNew == '') {
            console.log('conInvoiceListInit');
            conInvoiceListInit().then((r) => {
                r = JSON.parse(JSON.stringify(r));
                console.log("conInvoiceListInit r = " + JSON.stringify(r));
                if (r.status == "Success") {
                    this.ConInvoiceListAccountId = r.entity.accountid;
                    this.ConInvoiceListUserWorkLocation = r.entity.userWorkLocation;
                    this.ConInvoiceListAgencyProType = r.entity.agencyProType;
                    //if (this.ConInvoiceListAgencyProType != 'ET')
                        this.isOpenReportDisabled = false;
                    this.invoiceData = r.entity.raesList;
                    for (var i in this.invoiceData) {
                        this.invoiceData[i]['NameUrl'] = '/lexconinvoiceview?invoiceId=' + this.invoiceData[i].Id;
                    }
                    console.log("this.invoiceData = " + JSON.stringify(this.invoiceData));
                    for (var key in r.entity.statusMap) {
                        let object = {};
                        object["label"] = key;
                        object["value"] = r.entity.statusMap[key];
                        this.invoiceStatusOptions.push(object);
                    }
                    this.invoiceStatusOptions = [...this.invoiceStatusOptions];
                    console.log("this.invoiceStatusOptions = " + JSON.stringify(this.invoiceStatusOptions));
                    this.isShowSpinner = false;
                } else {
                    this.showMyToast('初始化失败', r.msg, 'Error');
                }
            }).catch((error) => {
                console.log("error = " + JSON.stringify(error));
            });
        } else {
            console.log('init');
            this.isConInvoiceList = false;
            init({
                invoiceId: this.invoiceId,
                statusEdit: this.statusEdit,
                deliveryId: this.deliveryId
            }).then((r) => {
                r = JSON.parse(JSON.stringify(r));
                console.log("r = " + JSON.stringify(r));
                if (r.status == "Success") {
                    this.coc = r.entity.coc;
                    this.cocId = this.coc.Id;
                    this.EditAble = r.entity.EditAble;
                    this.isChange = r.entity.isChange;
                    this.ExistOutbound = r.entity.ExistOutbound;
                    this.outboundData = r.entity.invoiceOrderRecoeds;
                    console.log('this.outboundData = ' + JSON.stringify(this.outboundData))
                    this.done = r.entity.done;
                    this.accountid = r.entity.accountid;
                    this.userWorkLocation = r.entity.userWorkLocation;
                    this.outOrderStringListLwc = r.entity.outOrderStringList;
                    this.outordercountMapLwc = r.entity.outordercountMap;
                    this.invoiceOrderRecoedschange = r.entity.invoiceOrderRecoedschange;
                    this.isDisabledEdit = (this.coc.Invoice_status__c == '提交' || this.coc.Invoice_status__c == '已完成') ? true : false;
                    this.isDisabledReopen = this.coc.Invoice_status__c == '提交' ? false : true;
                    this.isDisabledDelete = this.coc.Invoice_status__c == '草案中' ? false : true;
                    this.isDisabledAttachment = this.coc.Invoice_status__c == '已完成' ? true : false;
                    this.OrderCode = this.coc.Name;
                    this.InvoiceDate = this.coc.Invoice_Date__c;
                    for (var i in this.outboundData) {
                        this.outboundData[i].Id = this.outboundData[i].esd.Id;
                        if (this.outboundData[i].check)
                            this.selectedRows.push(this.outboundData[i].esd.Id);
                    }
                    this.selectedRows = [...this.selectedRows];
                    console.log('r.entity.attachmentRecoeds = ' + JSON.stringify(r.entity.attachmentRecoeds))
                    if (!this.EditAble) {
                        //附件显示
                        this.showLoadingSpinner = true;
                        this.fileData = r.entity.attachmentRecoeds;
                        for (var i in this.fileData) {
                            this.fileData[i]["Id"] = this.fileData[i].cvInfo.Id;
                            this.fileData[i]["recordId"] = this.fileData[i].cvInfo.Id;
                            this.fileData[i]["url"] = "/" + this.fileData[i].cvInfo.Id;
                            this.fileData[i]["Title"] = this.fileData[i].cvInfo.Title;
                            this.fileData[i]["CreatedByName"] = this.fileData[i].cvInfo.Owner.Name;
                            this.fileData[i]["CreatedByNameUrl"] = "/" + this.fileData[i].cvInfo.OwnerId;;
                            this.fileData[i]["CreatedDate"] = this.fileData[i].cvInfo.CreatedDate;
                            this.fileData[i]["attUrl"] = '/' + this.fileData[i].cvInfo.Id;
                            this.fileData[i]['downloadUrl'] = '/sfc/servlet.shepherd/document/download/' + this.fileData[i].cvInfo.ContentDocumentId + '?operationContext=S1';
                            if (this.isDisabledAttachment) {
                                console.log('进入this.isDisabledAttachment')
                                this.fileData[i]["isDisabledAttachment"] = true;
                            }
                            let typeOptions = [];
                            for (var key in this.fileData[i].mailSelectOptsMap) {
                                let typeOption = {};
                                typeOption["label"] = this.fileData[i].mailSelectOptsMap[key];
                                typeOption["value"] = key;
                                typeOptions.push(typeOption);
                            }
                            this.fileData[i]["typeValue"] = this.fileData[i].mailSelectOptsin == null ? typeOptions[0].value : this.fileData[i].mailSelectOptsin;
                            this.fileData[i]["typeOptions"] = typeOptions;
                            this.fileData[i]["mailSelectOptsin"] = this.fileData[i].mailSelectOptsin == null ? typeOptions[0].value : this.fileData[i].mailSelectOptsin;
                        }
                        console.log('this.fileData = ' + JSON.stringify(this.fileData))
                    }
                    //发票明细
                    this.invoiceOrderdetail1Recoeds = r.entity.invoiceOrderdetail1Recoeds;
                    for (var i in this.invoiceOrderdetail1Recoeds) {
                        this.invoiceOrderdetail1Recoeds[i]['esdetProductOutDate'] = this.invoiceOrderdetail1Recoeds[i].esdet.Product_OutDate__c;
                        this.invoiceOrderdetail1Recoeds[i]['esdetInvoicedet1ODlinkName'] = this.invoiceOrderdetail1Recoeds[i].esdet.Invoicedet1_OD_link__r.Name;
                        this.invoiceOrderdetail1Recoeds[i]['esdetAssetModelNo'] = this.invoiceOrderdetail1Recoeds[i].esdet.Asset_Model_No__c;
                        this.invoiceOrderdetail1Recoeds[i]['esdetInvoiceUnit'] = this.invoiceOrderdetail1Recoeds[i].esdet.Invoice_Unit__c;
                        this.invoiceOrderdetail1Recoeds[i]['esdetInvoiceUnitprice'] = this.invoiceOrderdetail1Recoeds[i].esdet.Invoice_Unitprice__c;
                        this.invoiceOrderdetail1Recoeds[i]['esdetInvoicedCount'] = this.invoiceOrderdetail1Recoeds[i].esdet.Invoiced_Count__c;
                        this.invoiceOrderdetail1Recoeds[i]['esdetInvoicedProCostRMB'] = this.invoiceOrderdetail1Recoeds[i].esdet.InvoicedProCost_RMB__c;
                    }
                    //客户名
                    this.HospitalName = r.entity.HospitalName;
                    this.HospitalInfo = r.entity.HospitalInfo;
                    this.agencyProType = r.entity.agencyProType;
                    //if (this.agencyProType != 'ET')
                        this.isOpenReportDisabled = false;
                    //科室
                    this.ForCustomerText = this.coc.Order_ForCustomerText__c;
                    //备注
                    this.InvoiceNote = this.coc.Invoice_Note__c;
                    //二级经销商
                    for (var key in r.entity.provinceOptsMap) {
                        let object = {};
                        object["label"] = r.entity.provinceOptsMap[key];
                        object["value"] = key;
                        this.provinceOptsMap.push(object);
                    }
                    //出货一览columns
                    if (this.EditAble) {
                        let object1 = {
                            label: '客户名',
                            fieldName: "hospitalName",
                            hideDefaultActions: true,
                            wrapText: true,
                        };
                        let object2 = {
                            label: '出货金额(元)',
                            fieldName: "shipmentAmount",
                            type: "number",
                            typeAttributes: {
                                minimumFractionDigits: 2,
                            },
                            hideDefaultActions: true,
                        };
                        let object3 = {
                            label: '返品金额(元)',
                            fieldName: "returnAmount",
                            type: "number",
                            typeAttributes: {
                                minimumFractionDigits: 2,
                            },
                            hideDefaultActions: true,
                        };
                        this.outboundColumns.push(object1)
                        this.outboundColumns.push(object2)
                        this.outboundColumns.push(object3)
                    }
                    let object4 = {
                        label: '未发票金额(元)',
                        fieldName: "uninvoicedAmount",
                        type: "number",
                        typeAttributes: {
                            minimumFractionDigits: 2,
                        },
                        hideDefaultActions: true,
                    };
                    this.outboundColumns.push(object4)
                    //出货一览Data
                    let index = 0;
                    for (var i in this.outboundData) {
                        this.outboundData[i]['esdOutboundDate'] = this.outboundData[i].esd.Outbound_Date__c;
                        this.outboundData[i]['esdNameUrl'] = '/s/lexsummonscreat?ESetid=' + this.outboundData[i].esd.Id;
                        this.outboundData[i]['esdName'] = this.outboundData[i].esd.Name;
                        if (this.EditAble) {
                            this.outboundData[i]['hospitalName'] = this.outboundData[i].esd.ShipmentAccount__c;
                            this.outboundData[i]['shipmentAmount'] = this.outboundData[i].esd.Shipment_total_amount__c;
                            this.outboundData[i]['returnAmount'] = this.outboundData[i].esd.RrturnPro_total_amount__c;
                        }
                        this.outboundData[i]['uninvoicedAmount'] = this.outboundData[i].esd.InvoiceNotPro_money__c;
                        this.outboundData[i]['invoiceFaceAmount'] = this.keepTwoDecimalStr(this.outboundData[i].needInvoiceCount);
                        if (!(this.outboundData[i].esd.Billed_Status__c == '全部开票' || this.EditAble || this.coc.Invoice_status__c != '草案中')) {
                            console.log('进入 if')
                            let url = "/lexconinvoiceview?orderId=" + this.outboundData[i].esd.Id + "&invoiceId=" + this.invoiceId;
                            this.outboundData[i]['invoiceFaceAmountUrl'] = url;
                            if (index == 0) {
                                let object5 = {
                                    label: '发票票面金额(元)',
                                    cellAttributes: { alignment: 'right' },
                                    type: 'url',
                                    fieldName: "invoiceFaceAmountUrl",
                                    typeAttributes: {
                                        label: { fieldName: "invoiceFaceAmount" },
                                        //target: "_blank",
                                    },
                                    hideDefaultActions: true,
                                };
                                this.outboundColumns.push(object5)
                                index++;
                            }
                        } else {
                            console.log('进入 else')
                            if (index == 0) {
                                let object5 = {
                                    label: '发票票面金额(元)',
                                    cellAttributes: { alignment: 'right' },
                                    fieldName: "invoiceFaceAmount",
                                    hideDefaultActions: true,
                                    type: "number",
                                    typeAttributes: {
                                        minimumFractionDigits: 2,
                                    },
                                };
                                this.outboundColumns.push(object5)
                                index++;
                            }
                        }
                        //计算发票票面金额
                        this.sumPrice += this.outboundData[i].needInvoiceCount;
                    }
                    //四舍五入
                    //this.sumPrice = this.sumPrice.toFixed(2);
                    //如果不四舍五入
                    console.log('start keepTwoDecimalStr')
                    this.sumPrice = this.keepTwoDecimalStr(this.sumPrice);
                    console.log('end keepTwoDecimalStr = ' + this.sumPrice)
                    //加最后一行显示金额
                    if (this.EditAble) {
                        let lastOutboundData = {
                            invoiceFaceAmount: this.sumPrice
                        }
                        this.outboundDataSumPrice.push(lastOutboundData);
                    }
                    this.outboundColumns = [...this.outboundColumns];
                    this.isEditInvoice = !(!this.EditAble || this.isChange);
                    if (this.coc.SummonsForDirction__c == '销售给二级经销商')
                        this.isShowSecondaryDistributor = true;
                    if (this.deliveryId == '' && !this.ExistOutbound && this.EditAble)
                        this.hideCheckbox = false;
                    this.isShowSpinner = false;
                    this.showLoadingSpinner = false;
                } else {
                    this.showMyToast('失败', r.msg, 'Error');
                }
            }).catch((error) => {
                console.log("error = " + JSON.stringify(error));
            });
        }
    }
    //上传配置单
    uploadOrder(event) {
        this.showAttPop = true;
    }
    //关闭附件弹窗
    closePop() {
        this.showAttPop = false;
        this.filesUploaded = [];
        this.fileName = null;
    }
    //附件change事件
    attChange(event) {
        if (event.target.files.length > 0) {
            this.filesUploaded = event.target.files;
            this.fileName = event.target.files[0].name;
            console.log('this.fileName:' + this.fileName);
        }
    }
    //移除附件
    removeAtt() {
        this.filesUploaded = [];
        this.fileName = '';
    }
    //是否显示附件移除
    get attDelBtn() {
        if (this.fileName != '' && this.fileName != null && this.fileName != '选择一个文件上传') {
            return true;
        } else {
            return false;
        }
    }
    keepTwoDecimalStr(num) {
        const result = Number(num.toString().match(/^\d+(?:\.\d{0,2})?/));
        let s = result.toString();
        let rs = s.indexOf('.');
        if (rs < 0) {
            rs = s.length;
            s += '.';
        }
        while (s.length <= rs + 2) {
            s += '0';
        }
        return s;
    };
    dataChange(event) {
        let fieldName = event.target.getAttribute("data-field");
        let value = event.detail.value;
        console.log("fieldName = " + fieldName + " value = " + value);
        switch (fieldName) {
            case "OrderCode":
                this.OrderCode = value;
                this.coc['Name'] = value;
                break;
            case "ForCustomerText":
                this.ForCustomerText = value;
                this.coc['Order_ForCustomerText__c'] = value;
                break;
            case "InvoiceDate":
                this.InvoiceDate = value;
                this.coc['Invoice_Date__c'] = value;
                break;
            case "secondaryDistributor":
                this.secondaryDistributor = value;
                break;
            case "deliveryFromDate":
                this.deliveryFromDate = value;
                break;
            case "deliveryToDate":
                this.deliveryToDate = value;
                break;
            case "category1":
                this.category1 = value;
                break;
            case "category2":
                this.category2 = value;
                break;
            case "invoiceStatus":
                this.invoiceStatusValue = value;
                break;
            case "searchHospitalName":
                this.searchHospitalName = value;
                break;
            case "InvoiceNote":
                this.InvoiceNote = value;
                this.coc['Invoice_Note__c'] = value;
                break;
        }
    }
    invoiceDateChange(event) {
        this.InvoiceDate = event.detail.value;
        this.coc['Invoice_Date__c'] = event.detail.value;
        console.log('this.InvoiceDate = ' + this.InvoiceDate);
    }
    //搜索客户名
    searchHospitalNameModal() {
        console.log("searchHospitalNameModal");
        hospitalInit({
            ctype: this.agencyProType,
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            if (r.status == "Success") {
                this.hospitalList = r.entity.at;
                for (var i in this.hospitalList) {
                    this.hospitalList[i]["stateMasterName"] = this.hospitalList[i].State_Master__r.Name;
                }
                console.log("hospitalInit r = " + JSON.stringify(this.hospitalList));
                this.isModalOpen = true;
            }
        });
    }
    searchHospital() {
        console.log("this.searchHospitalName = " + this.searchHospitalName);
        serContact({
            searchName: this.searchHospitalName,
            ctype: this.agencyProType,
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            if (r.status == "Success") {
                this.hospitalList = r.entity.at;
                for (var i in this.hospitalList) {
                    this.hospitalList[i]["stateMasterName"] =
                        this.hospitalList[i].State_Master__r.Name;
                }
                console.log("hospitalInit r = " + JSON.stringify(this.hospitalList));
            }
        });
    }
    //选择客户名
    searchHandleRowAction(event) {
        console.log("searchHandleRowAction");
        let row = event.detail.row;
        this.HospitalInfo = row.Id;
        this.HospitalName = row.Name;
        console.log("this.HospitalInfo = " + this.HospitalInfo + " this.HospitalName = " + this.HospitalName);
        this.isModalOpen = false;
    }
    //当客户名是空时。客户id也变为空
    clearAgencyI(event) {
        this.HospitalName = event.target.value;
        if (this.HospitalName == "" || this.HospitalName == null) {
            this.HospitalInfo = "";
        }
        console.log("this.HospitalName = " + this.HospitalName);
        console.log("this.HospitalInfo = " + this.HospitalInfo);
    }
    closeModal() {
        this.isModalOpen = false;
    }
    SaveJs() {
        this.isShowSpinner = true;
        let cloneData = this.outboundData
        debugger
        const selectedRows = this.template.querySelector("[data-field='outbound']").getSelectedRows();
        console.log('selectedRows = ' + JSON.stringify(selectedRows));
        for (var i in cloneData) {
            let b = false;
            for (var j in selectedRows) {
                if (cloneData[i].esd.Id == selectedRows[j].esd.Id) {
                    b = true;
                    cloneData[i].check = true;
                }
            }
            if (!b) {
                cloneData[i].check = false;
            }
            delete cloneData[i].esdOutboundDate;
            delete cloneData[i].esdNameUrl;
            delete cloneData[i].esdName;
            delete cloneData[i].hospitalName;
            delete cloneData[i].shipmentAmount;
            delete cloneData[i].returnAmount;
            delete cloneData[i].uninvoicedAmount;
            delete cloneData[i].invoiceFaceAmount;
            delete cloneData[i].invoiceFaceAmountUrl;
        }
        console.log('this.coc = ' + JSON.stringify(this.coc));
        console.log('this.HospitalName = ' + this.HospitalName);
        console.log('this.HospitalInfo = ' + this.HospitalInfo);
        console.log('this.secondaryDistributor = ' + this.secondaryDistributor);
        console.log('this.outboundData = ' + JSON.stringify(cloneData));
        console.log('this.deliveryId = ' + this.deliveryId);
        console.log('this.invoiceId = ' + this.invoiceId);
        console.log('this.accountid = ' + this.accountid);
        console.log('this.agencyProType = ' + this.agencyProType);
        console.log('this.reopen = ' + this.reopen);
        console.log('this.invoiceOrderRecoedschangeLwc = ' + JSON.stringify(this.invoiceOrderRecoedschange));
        save({
            cocLwc: this.coc,
            HospitalNameLwc: this.HospitalName,
            HospitalInfoLwc: this.HospitalInfo,
            SecondDealerLwc: this.secondaryDistributor,
            invoiceOrderRecoedsLwc: JSON.stringify(cloneData),
            deliveryIdLwc: this.deliveryId,
            invoiceIdLwc: this.invoiceId,
            accountidLwc: this.accountid,
            agencyProTypeLwc: this.agencyProType,
            reopenLwc: this.reopen,
            invoiceOrderRecoedschangeLwc: JSON.stringify(this.invoiceOrderRecoedschange)
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log("r = " + JSON.stringify(r));
            if (r.status == "Success" && r.msg == '') {
                this.isShowSpinner = false;
                console.log('save success');
                let url = "/lexconinvoiceview?invoiceId=" + r.entity.invoiceId;
                console.log('url = ' + url);
                this[NavigationMixin.Navigate]({
                    type: "standard__webPage",
                    attributes: {
                        url: url,
                    },
                });
            } else {
                this.showMyToast('保存失败', r.msg, 'Error');
            }
        }).catch((error) => {
            console.log("error = " + JSON.stringify(error));
        });
    }
    //上传附件,直接就保存好,然后展示
    handleFilesChange(event) {
        console.log("handleFilesChange");
        this.handleSave();
        // if (event.target.files.length > 0) {
            //     this.filesUploaded = event.target.files;
            //     this.fileName = event.target.files[0].name;
            //     this.handleSave();
            // }
        }
        handleSave() {
        console.log("saveFile");
        if (this.filesUploaded.length > 0) {
            this.showPopSpinner = true;
            this.file = this.filesUploaded[0];
            if (this.file.size > this.MAX_FILE_SIZE) {
                this.showMyToast('保存失败', '文件过大', 'Error');
                return;
            }
            this.fileReader = new FileReader();
            this.fileReader.onloadend = () => {
                this.fileContents = this.fileReader.result;
                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 = "选择一个文件上传";
        }
    }
    saveToFile() {
        console.log("saveToFile");
        console.log("invoiceId = " + this.invoiceId);
        console.log("fileName = " + this.fileName);
        console.log("base64Data = " + encodeURIComponent(this.fileContents));
        saveFile({
            recordId: this.invoiceId,
            fileName: this.fileName,
            base64Data: encodeURIComponent(this.fileContents),
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log("r = " + JSON.stringify(r));
            if (r != '') {
                this.showPopSpinner = false;
                this.showMyToast('上传成功', '', 'Success');
                this.closePop();
                this.init();
            } else {
                this.showMyToast('上传失败', r.msg, 'Error');
            }
        }).catch((error) => {
            console.log("error = " + error.message);
            this.showMyToast('错误', '上传失败', 'Error');
        });
    }
    handleTypeChange(event) {
        console.log("handleTypeChange");
        const typeDetail = event.detail;
        console.log("typeDetail = " + JSON.stringify(typeDetail));
        for (var i in this.fileData) {
            if (this.fileData[i].recordId == typeDetail.data.recordId) {
                this.fileData[i].typeValue = typeDetail.data.typeValue;
                this.fileData[i].mailSelectOptsin = typeDetail.data.typeValue;
            }
        }
        console.log("this.fileData = " + JSON.stringify(this.fileData));
    }
    newInvoiceJs() {
        let url = "/lexconinvoiceview?isNew=yes";
        console.log('url = ' + url);
        this[NavigationMixin.Navigate]({
            type: "standard__webPage",
            attributes: {
                url: url,
            },
        });
    }
    saveAttachmentJs() {
        debugger
        this.showLoadingSpinner = true;
        let cloneData = this.deepClone(this.fileData)
        for (var i in cloneData) {
            delete cloneData[i].Id;
            delete cloneData[i].recordId;
            delete cloneData[i].url;
            delete cloneData[i].Title;
            delete cloneData[i].CreatedByName;
            delete cloneData[i].CreatedByNameUrl;
            delete cloneData[i].CreatedDate;
            delete cloneData[i].typeValue;
            delete cloneData[i].typeOptions;
            delete cloneData[i].mailSelectOptsMap;
        }
        console.log('cloneData = ' + JSON.stringify(cloneData));
        saveAttachment({
            attachmentRecoedsLwc: JSON.stringify(cloneData),
            invoiceId: this.invoiceId
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log("r = " + JSON.stringify(r));
            if (r.status == "Success") {
                this.showLoadingSpinner = false;
                this.isShowSpinner = true;
                // const event = new ShowToastEvent({
                //     title: 'Success',
                //     variant: 'Success',
                //     message: '保存成功',
                // });
                // this.dispatchEvent(event);
                this.showMyToast('附件保存成功', '', 'Success');
                //this.init();
                setTimeout(function () {
                    //1秒后执行刷新
                    window.location.reload();
                }, 2000); //单位是毫秒
                // let url = "/lexconinvoiceview?invoiceId=" + this.invoiceId;
                // console.log('url = ' + url);
                // this[NavigationMixin.Navigate]({
                //     type: "standard__webPage",
                //     attributes: {
                //         url: url,
                //     },
                // });
            } else {
                this.showMyToast('上传失败', r.msg, 'Error');
            }
        }).catch((error) => {
            console.log("error = " + error.message);
            this.showMyToast('错误', '上传失败', 'Error');
        });
    }
    invoiceCodeSearchJs() {
        this.isShowSpinner = true;
        invoiceCodeSearch({
            orderDateLwc: this.deliveryFromDate == null ? null : new Date(this.deliveryFromDate),
            deliverDateLwc: this.deliveryToDate == null ? null : new Date(this.deliveryToDate),
            invoiceStatusLwc: this.invoiceStatusValue,
            category1Lwc: this.category1,
            category2Lwc: this.category2,
            accountidLwc: this.ConInvoiceListAccountId,
            userWorkLocationLwc: this.ConInvoiceListUserWorkLocation,
            agencyProTypeLwc: this.ConInvoiceListAgencyProType,
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log("r = " + JSON.stringify(r));
            if (r.status == "Success") {
                this.invoiceData = r.entity.raesList;
                for (var i in this.invoiceData) {
                    this.invoiceData[i]['NameUrl'] = '/lexconinvoiceview?invoiceId=' + this.invoiceData[i].Id;
                }
                console.log("this.invoiceData = " + JSON.stringify(this.invoiceData));
                this.isShowSpinner = false;
                if (r.entity.raesListSize > 0) {
                    this.showMyToast('搜索成功', '共检索到' + r.entity.raesListSize + '个发票', 'Success');
                } else {
                    this.showMyToast('搜索失败', '没有搜索到相关发票', 'Error');
                }
            } else {
                this.showMyToast('搜索失败', r.msg, 'Error');
            }
        }).catch((error) => {
            console.log("error = " + error.message);
            this.showMyToast('错误', '搜索失败', 'Error');
        });
    }
    ClearJs() {
        this.deliveryFromDate = '';
        this.deliveryToDate = '';
        this.category1 = '';
        this.category2 = '';
        this.invoiceStatusValue = '';
        this.isShowSpinner = true;
        conInvoiceListInit().then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log("conInvoiceListInit r = " + JSON.stringify(r));
            if (r.status == "Success") {
                this.invoiceData = r.entity.raesList;
                for (var i in this.invoiceData) {
                    this.invoiceData[i]['NameUrl'] = '/lexconinvoiceview?invoiceId=' + this.invoiceData[i].Id;
                }
                console.log("this.invoiceData = " + JSON.stringify(this.invoiceData));
                this.isShowSpinner = false;
            } else {
                this.showMyToast('搜索失败', r.msg, 'Error');
            }
        }).catch((error) => {
            console.log("error = " + JSON.stringify(error));
        });
    }
    InvoiceorderSearchJs() {
        this.isShowSpinner = true;
        debugger
        let cloneData = this.outboundData
        const selectedRows = this.template.querySelector("[data-field='outbound']").getSelectedRows();
        console.log('selectedRows ' + JSON.stringify(selectedRows));
        for (var i in cloneData) {
            let b = false;
            for (var j in selectedRows) {
                if (cloneData[i].esd.Id == selectedRows[j].esd.Id) {
                    b = true;
                    cloneData[i].check = true;
                }
            }
            if (!b) {
                cloneData[i].check = false;
            }
            delete cloneData[i].esdOutboundDate;
            delete cloneData[i].esdNameUrl;
            delete cloneData[i].esdName;
            delete cloneData[i].hospitalName;
            delete cloneData[i].shipmentAmount;
            delete cloneData[i].returnAmount;
            delete cloneData[i].uninvoicedAmount;
            delete cloneData[i].invoiceFaceAmount;
            delete cloneData[i].invoiceFaceAmountUrl;
        }
        console.log('this.coc = ' + JSON.stringify(this.coc));
        console.log('this.invoiceId = ' + this.invoiceId);
        console.log('this.accountid = ' + this.accountid);
        console.log('this.userWorkLocation = ' + this.userWorkLocation);
        console.log('this.agencyProType = ' + this.agencyProType);
        console.log('this.HospitalInfo = ' + this.HospitalInfo);
        console.log('SecondDealer = ' + this.secondaryDistributor);
        console.log('invoiceOrderRecoedsLwc = ' + JSON.stringify(cloneData));
        InvoiceorderSearch({
            cocLwc: this.coc,
            invoiceIdLwc: this.invoiceId,
            accountidLwc: this.accountid,
            userWorkLocationLwc: this.userWorkLocation,
            agencyProTypeLwc: this.agencyProType,
            HospitalInfoLwc: this.HospitalInfo,
            SecondDealerLwc: this.secondaryDistributor,
            invoiceOrderRecoedsLwc: JSON.stringify(cloneData),
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log("r = " + JSON.stringify(r));
            if (r.status == "Success") {
                this.outboundData = r.entity.invoiceOrderRecoeds;
                console.log('this.outboundData = ' + JSON.stringify(this.outboundData));
                let index = 0;
                this.selectedRows = [];
                for (var i in this.outboundData) {
                    if (this.outboundData[i].check)
                        this.selectedRows.push(this.outboundData[i].esd.Id)
                    this.outboundData[i].Id = this.outboundData[i].esd.Id;
                    this.outboundData[i]['esdOutboundDate'] = this.outboundData[i].esd.Outbound_Date__c;
                    this.outboundData[i]['esdNameUrl'] = '/s/lexsummonscreat?ESetid=' + this.outboundData[i].esd.Id;
                    this.outboundData[i]['esdName'] = this.outboundData[i].esd.Name;
                    if (this.EditAble) {
                        this.outboundData[i]['hospitalName'] = this.outboundData[i].esd.ShipmentAccount__c;
                        this.outboundData[i]['shipmentAmount'] = this.outboundData[i].esd.Shipment_total_amount__c;
                        this.outboundData[i]['returnAmount'] = this.outboundData[i].esd.RrturnPro_total_amount__c;
                    }
                    this.outboundData[i]['uninvoicedAmount'] = this.outboundData[i].esd.InvoiceNotPro_money__c;
                    this.outboundData[i]['invoiceFaceAmount'] = this.outboundData[i].needInvoiceCount;
                    if (!(this.outboundData[i].esd.Billed_Status__c == '全部开票' || this.EditAble || this.coc.Invoice_status__c != '草案中')) {
                        //let url = "/ConInvoicedetails?orderId=" + this.outboundData[i].esd.Id + "&invoiceId=" + this.invoiceId;
                        let url = "/s/lexconinvoiceview?orderId=" + this.outboundData[i].esd.Id + "&invoiceId=" + this.invoiceId;
                        this.outboundData[i]['invoiceFaceAmountUrl'] = url;
                        if (index == 0) {
                            let object5 = {
                                label: '发票票面金额(元)',
                                cellAttributes: { alignment: 'right' },
                                type: 'url',
                                fieldName: "invoiceFaceAmountUrl",
                                typeAttributes: {
                                    label: { fieldName: "invoiceFaceAmount" },
                                    target: "_blank",
                                },
                                hideDefaultActions: true,
                            };
                            this.outboundColumns.push(object5)
                            index++;
                        }
                    } else {
                        if (index == 0) {
                            let object5 = {
                                label: '发票票面金额(元)',
                                cellAttributes: { alignment: 'right' },
                                fieldName: "invoiceFaceAmount",
                                hideDefaultActions: true,
                            };
                            this.outboundColumns.push(object5)
                            index++;
                        }
                    }
                    //计算发票票面金额
                    this.sumPrice += this.outboundData[i].needInvoiceCount;
                }
                console.log('this.selectedRows = ' + JSON.stringify(this.selectedRows))
                this.isShowSpinner = false;
            } else {
                this.showMyToast('搜索失败', r.msg, 'Error');
            }
        }).catch((error) => {
            console.log("error = " + error.message);
            this.showMyToast('错误', '搜索失败', 'Error');
        });
    }
    getSelectedRows(event) {
        // console.log("getSelectedRows ");
        // for (var i in this.outboundData) {
        //     this.outboundData[i].check = false;
        // }
        // const selectedRows = event.detail.selectedRows;
        // for (var i in this.outboundData) {
        //     for (var j in selectedRows) {
        //         if (this.outboundData[i].esd.Id == selectedRows[j].esd.Id) {
        //             //this.outboundData[i].check = !this.outboundData[i].check;
        //             this.outboundData[i].check = true;
        //         }
        //     }
        // }
        // console.log('this.outboundData = ' + JSON.stringify(this.outboundData));
    }
    deleteButtonJs() {
        this.isShowSpinner = true;
        deleteButton({
            cocLwc: this.coc,
            invoiceIdLwc: this.invoiceId,
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log("r = " + JSON.stringify(r));
            if (r.status == "Success") {
                this.isShowSpinner = false
                let url = "/lexconinvoiceview";
                console.log('url = ' + url);
                this[NavigationMixin.Navigate]({
                    type: "standard__webPage",
                    attributes: {
                        url: url,
                    },
                });
            } else {
                this.showMyToast('删除失败', r.msg, 'Error');
            }
        }).catch((error) => {
            console.log("error = " + error.message);
        });
    }
    SetEditAbleJs() {
        let statusEditAbleJs = 'Redirect';
        let url = "/lexconinvoiceview?invoiceId=" + this.invoiceId + '&KeyWords=' + statusEditAbleJs;
        console.log('url = ' + url);
        this[NavigationMixin.Navigate]({
            type: "standard__webPage",
            attributes: {
                url: url,
            },
        });
    }
    approvalJs() {
        this.isShowSpinner = true;
        approval({
            outOrderStringListLwc: this.outOrderStringListLwc,
            outordercountMapLwc: this.outordercountMapLwc,
            invoiceIdLwc: this.invoiceId
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log("r = " + JSON.stringify(r));
            if (r.status == "Success") {
                this.isShowSpinner = false
                let url = "/s/lexconinvoiceview?invoiceId=" + this.invoiceId;
                console.log('url = ' + url);
                window.open(url, '_self');
                // this[NavigationMixin.Navigate]({
                //     type: "standard__webPage",
                //     attributes: {
                //         url: url,
                //     },
                // });
            } else {
                this.showMyToast('错误', r.msg, 'Error');
            }
        }).catch((error) => {
            console.log("error = " + error.message);
        });
    }
    openReportJs() {
        console.log("openReportJs");
        let reportUrl = this.label.LexConInvoiceViewReport;
        let reportFilters = '[{"operator":"equals","value":"' + this.OrderCode + '","column":"FK_NAME"}]';
        console.log('reportUrl = ' + reportUrl);
        let url = "/s/report/" + reportUrl + "?reportFilters=" + encodeURIComponent(reportFilters);
        window.open(url);
        // this[NavigationMixin.Navigate]({
        //     type: "standard__webPage",
        //     attributes: {
        //         url: url,
        //         target: '_blank'
        //     },
        // });
    }
    reopenJs() {
        // statusEdit = 'Redirect';
        // PageReference ref = new Pagereference('/ConInvoiceView?invoiceId=' + invoiceId + '&reopen=isreopen' + '&KeyWords=' + statusEdit);
        let statusEditAbleJs = 'Redirect';
        let url = "/lexconinvoiceview?invoiceId=" + this.invoiceId + '&reopen=isreopen' + '&KeyWords=' + statusEditAbleJs;
        console.log('url = ' + url);
        this[NavigationMixin.Navigate]({
            type: "standard__webPage",
            attributes: {
                url: url,
            },
        });
    }
    showMyToast(title, message, variant) {
        this.isShowSpinner = false;
        this.showLoadingSpinner = false;
        this.showPopSpinner = false;
        this.showAttPop = false;
        this.filesUploaded = [];
        this.fileName = null;
        console.log('show custom message');
        var iconName = '';
        var content = '';
        if (variant.toLowerCase() == 'success') {
            iconName = 'utility:check';
        } else {
            iconName = 'utility:error';
        }
        if (message != '') {
            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);
    }
    handleLoad() {
        console.log('handleLoad')
        try {
            const style = document.createElement('style');
            style.innerText = '.hehe-layoutItem .slds-button__icon {display: none;}';
            this.template.querySelector('.hideHelpText').appendChild(style);
            const style2 = document.createElement('style');
            style2.innerText = '.hehe-layoutItem  .slds-form-element__label {padding : 0px}';
            this.template.querySelector('.hideHelpText').appendChild(style2);
            const style3 = document.createElement('style');
            style3.innerText = '.readOnly  .slds-form-element__label {padding-top: 7px;}';
            this.template.querySelector('.hideHelpText').appendChild(style3);
        } catch (error) {
            console.log(error);
        }
    }
    keepTwoDecimalStr(num) {
        const result = Number(num.toString().match(/^\d+(?:\.\d{0,2})?/));
        let s = result.toString();
        let rs = s.indexOf('.');
        if (rs < 0) {
            rs = s.length;
            s += '.';
        }
        while (s.length <= rs + 2) {
            s += '0';
        }
        return s;
    };
    handleLoad2() {
        console.log('handleLoad2')
        try {
            const style = document.createElement('style');
            style.innerText = '.hehe-layoutItem .slds-button__icon {display: none;}';
            this.template.querySelector('.hideHelpText').appendChild(style);
            const style2 = document.createElement('style');
            style2.innerText = '.hehe-layoutItem  .slds-form-element__label {padding : 0px}';
            this.template.querySelector('.hideHelpText').appendChild(style2);
        } catch (error) {
            console.log(error);
        }
    }
    handleUnitChange(event) {
        console.log("handleUnitChange");
        this.invoiceAllpriceData[0].invoiceAllprice = 0.00;
        const unitDetail = event.detail;
        console.log("unitDetail = " + JSON.stringify(unitDetail));
        for (var i in this.detailsData) {
            if (this.detailsData[i].recordId == unitDetail.data.recordId) {
                this.detailsData[i].unitValue = unitDetail.data.unitValue;
                this.detailsData[i].esd.Invoice_Unit__c = unitDetail.data.unitValue;
                if (this.detailsSelectedRows.indexOf(this.detailsData[i].recordId) == -1)
                    this.detailsSelectedRows.push(this.detailsData[i].recordId);
            }
        }
        this.detailsSelectedRows = [...this.detailsSelectedRows];
        console.log('this.detailsSelectedRows = ' + JSON.stringify(this.detailsSelectedRows))
        for (var i in this.detailsData) {
            this.detailsData[i].invoiceAllprice = 0.00;
            for (var j in this.detailsSelectedRows) {
                console.log('this.detailsData[i].Id = ' + this.detailsData[i].Id);
                console.log('this.detailsSelectedRows[j] = ' + this.detailsSelectedRows[j]);
                if (this.detailsData[i].Id == this.detailsSelectedRows[j]) {
                    this.detailsData[i].invoiceAllprice = this.amend(this.detailsData[i].shipmentNumber, this.detailsData[i].esdInvoiceUnitprice, '*');
                    console.log('this.detailsData[i].invoiceAllprice = ' + this.detailsData[i].invoiceAllprice);
                }
            }
            this.invoiceAllpriceData[0].invoiceAllprice = this.amend(this.invoiceAllpriceData[0].invoiceAllprice, this.detailsData[i].invoiceAllprice, '+');
        }
        this.detailsData = [...this.detailsData];
        this.invoiceAllpriceData = [...this.invoiceAllpriceData];
    }
    handleShipmentNumber(event) {
        console.log("handleShipmentNumber");
        this.invoiceAllpriceData[0].invoiceAllprice = 0.00;
        const numberDetail = event.detail;
        console.log('numberDetail = ' + JSON.stringify(numberDetail))
        if (numberDetail.data.shipmentnumber == 0) {
            if (this.detailsSelectedRows.indexOf(numberDetail.data.recordId) != -1) {
                this.detailsSelectedRows.splice(this.detailsSelectedRows.indexOf(numberDetail.data.recordId), 1);
            }
        }
        console.log("start this.detailsSelectedRows = " + JSON.stringify(this.detailsSelectedRows));
        console.log("numberDetail = " + JSON.stringify(numberDetail));
        for (var i in this.detailsData) {
            if (this.detailsData[i].recordId == numberDetail.data.recordId) {
                this.detailsData[i].shipmentNumber = Number(numberDetail.data.shipmentnumber);
                this.detailsData[i].invoiceCount = Number(numberDetail.data.shipmentnumber);
                if (this.detailsSelectedRows.indexOf(this.detailsData[i].recordId) == -1 && numberDetail.data.shipmentnumber != 0)
                    this.detailsSelectedRows.push(this.detailsData[i].recordId);
            }
        }
        console.log("end this.detailsSelectedRows = " + JSON.stringify(this.detailsSelectedRows));
        this.detailsSelectedRows = [...this.detailsSelectedRows];
        console.log('this.detailsSelectedRows = ' + JSON.stringify(this.detailsSelectedRows));
        for (var i in this.detailsData) {
            this.detailsData[i].invoiceAllprice = 0.00;
            for (var j in this.detailsSelectedRows) {
                console.log('this.detailsData[i].Id = ' + this.detailsData[i].Id);
                console.log('this.detailsSelectedRows[j] = ' + this.detailsSelectedRows[j]);
                if (this.detailsData[i].Id == this.detailsSelectedRows[j]) {
                    this.detailsData[i].invoiceAllprice = this.amend(this.detailsData[i].shipmentNumber, this.detailsData[i].esdInvoiceUnitprice, '*');
                    console.log('this.detailsData[i].invoiceAllprice = ' + this.detailsData[i].invoiceAllprice);
                }
            }
            this.invoiceAllpriceData[0].invoiceAllprice = this.amend(this.invoiceAllpriceData[0].invoiceAllprice, this.detailsData[i].invoiceAllprice, '+');
        }
        this.detailsData = [...this.detailsData];
        this.invoiceAllpriceData = [...this.invoiceAllpriceData];
    }
    detailsGetSelectedRows(event) {
        console.log("detailsGetSelectedRows ");
        this.invoiceAllpriceData[0].invoiceAllprice = 0.00;
        let selectedRows = event.detail.selectedRows;
        for (var i in this.detailsData) {
            this.detailsData[i].invoiceAllprice = 0.00;
            for (var j in selectedRows) {
                if (this.detailsData[i].Id == selectedRows[j].esd.Id) {
                    this.detailsData[i].invoiceAllprice = this.amend(this.detailsData[i].shipmentNumber, this.detailsData[i].esdInvoiceUnitprice, '*');
                    console.log('this.detailsData[i].invoiceAllprice = ' + this.detailsData[i].invoiceAllprice);
                }
            }
            this.invoiceAllpriceData[0].invoiceAllprice = this.amend(this.invoiceAllpriceData[0].invoiceAllprice, this.detailsData[i].invoiceAllprice, '+');
            console.log('this.invoiceAllpriceData[0].invoiceAllprice = ' + this.invoiceAllpriceData[0].invoiceAllprice);
        }
        console.log('start this.detailsData = ' + JSON.stringify(this.detailsData));
        this.detailsData = [...this.detailsData];
        console.log('end this.detailsData = ' + JSON.stringify(this.detailsData));
        this.invoiceAllpriceData = [...this.invoiceAllpriceData];
    }
    ComputePrice(index, number, price) {
        console.log("index = " + index);
        console.log("number = " + number);
        console.log("price = " + price);
        let shipmentAmount = this.amend(number, price, "*");
        console.log("shipmentAmount = " + shipmentAmount);
        let sumPrice = 0.0;
        this.data[index].shipmentAmount = shipmentAmount;
        for (var i in this.data) {
            if (this.data[i].shipmentAmount) sumPrice += this.data[i].shipmentAmount;
        }
        this.sumPrice = sumPrice + "元";
        //存下选择行,不会被清空
        if (this.selectedRows.indexOf(this.data[index].Id) == -1)
            this.selectedRows.push(this.data[index].Id);
        this.data = [...this.data];
        this.selectedRows = [...this.selectedRows]
        console.log("this.selectedRows = " + JSON.stringify(this.selectedRows));
        console.log("this.data = " + JSON.stringify(this.data));
    }
    deepClone(obj) {
        return JSON.parse(JSON.stringify(obj));
    }
    detailsSaveJs() {
        this.isShowSpinner = true;
        let cloneData = this.deepClone(this.detailsData);
        let selectedRows = this.template.querySelector('c-lex-custom-lightning-datatable').getSelectedRows();
        console.log('selectedRows = ' + JSON.stringify(selectedRows));
        for (var i in cloneData) {
            delete cloneData[i].Id;
            delete cloneData[i].esdAssetModelNo;
            delete cloneData[i].packingListManual;
            delete cloneData[i].esdDeliveryListRMB;
            delete cloneData[i].esdShipmentCount;
            delete cloneData[i].esdRrturnProCount;
            delete cloneData[i].esdBoxPiece;
            delete cloneData[i].esdInvoicedProcount;
            delete cloneData[i].esdInvoiceProNotCount;
            delete cloneData[i].unitValue;
            delete cloneData[i].recordId;
            delete cloneData[i].unitOptions;
            delete cloneData[i].esdInvoiceUnitprice;
            delete cloneData[i].shipmentNumber;
            delete cloneData[i].invoiceAllprice;
            for (var j in selectedRows) {
                if (cloneData[i].esd.Id == selectedRows[j].esd.Id) {
                    cloneData[i]['check'] = true;
                }
            }
        }
        console.log('cloneData = ' + JSON.stringify(cloneData));
        detailsSave({
            consumableorderdetails1RecordsLwc: JSON.stringify(cloneData),
            invoiceIdLwc: this.invoiceId,
            orderIdLwc: this.orderId
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log("r = " + JSON.stringify(r));
            if (r.status == "Success") {
                let url = "/lexconinvoiceview?invoiceId=" + this.invoiceId;
                this[NavigationMixin.Navigate]({
                    type: "standard__webPage",
                    attributes: {
                        url: url,
                    },
                });
            } else {
                this.showMyToast('保存失败', r.msg, 'Error');
            }
        }).catch((error) => {
            console.log("error = " + error.message);
        });
    }
    //num1 num2传入两个值  symbol +-*/符号
    amend(num1, num2, symbol) {
        var str1 = num1.toString(),
            str2 = num2.toString(),
            result,
            str1Length,
            str2Length;
        //解决整数没有小数点方法
        try {
            str1Length = str1.split(".")[1].length;
        } catch (error) {
            str1Length = 0;
        }
        try {
            str2Length = str2.split(".")[1].length;
        } catch (error) {
            str2Length = 0;
        }
        var step = Math.pow(10, Math.max(str1Length, str2Length));
        switch (symbol) {
            case "+":
                result = (num1 * step + num2 * step) / step;
                break;
            case "-":
                result = (num1 * step - num2 * step) / step;
                break;
            case "*":
                result = (num1 * step * (num2 * step)) / step / step;
                break;
            case "/":
                result = (num1 * step) / (num2 * step);
                break;
            default:
                break;
        }
        return result;
    }
    //删除附件
    deleteAtt(event) {
        this.isShowSpinner = true;
        //var recordId = event.detail.data.recordId;
        var recordId = event.target.getAttribute("data-fileid");
        console.log('attid:' + recordId);
        deleteAtt({
            contentVersionId: recordId
        }).then(r => {
            r = JSON.parse(JSON.stringify(r));
            if (r.status == "Success") {
                this.showMyToast('删除成功', '', 'Success');
                if (this.fileData.length == 1)
                    window.location.reload();
                else
                    this.init();
            } else {
                this.showMyToast('删除失败', r.msg, 'Error');
            }
        }).catch(error => {
            this.showMyToast('错误', error.message, 'Error');
  stylesLoaded = false;
  renderedCallback() {
    if (!this.stylesLoaded) {
      Promise.all([loadStyle(this, WrappedHeaderTable)])
        .then(() => {
          console.log("Custom styles loaded");
          this.stylesLoaded = true;
        })
        .catch((error) => {
          console.error("Error loading custom styles");
        });
    }
}
  }
  //获取链接参数
  getQueryString(name) {
    console.log("getQueryString name " + name);
    let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    let r = window.location.search.substr(1).match(reg);
    if (r != null) {
      return decodeURIComponent(r[2]);
    }
    return null;
  }
  connectedCallback() {
    this.init();
  }
  init() {
    this.isShowSpinner = true;
    this.deliveryId = this.getQueryString("deliveryId");
    this.deliveryId = this.deliveryId == null ? "" : this.deliveryId;
    this.invoiceId = this.getQueryString("invoiceId");
    this.invoiceId = this.invoiceId == null ? "" : this.invoiceId;
    this.orderId = this.getQueryString("orderId");
    this.orderId = this.orderId == null ? "" : this.orderId;
    this.statusEdit = this.getQueryString("KeyWords");
    this.statusEdit = this.statusEdit == null ? "" : this.statusEdit;
    this.reopen = this.getQueryString("reopen");
    this.reopen = this.reopen == null ? "" : this.reopen;
    this.isNew = this.getQueryString("isNew");
    this.isNew = this.isNew == null ? "" : this.isNew;
    console.log(
      "this.deliveryId = " +
        this.deliveryId +
        " this.invoiceId = " +
        this.invoiceId +
        " this.statusEdit = " +
        this.statusEdit
    );
    if (this.invoiceId != "" && this.orderId != "") {
      //进入coninvoiceDetails
      detailsInit({
        orderIdLwc: this.orderId,
        invoiceIdLwc: this.invoiceId
      })
        .then((r) => {
          r = JSON.parse(JSON.stringify(r));
          if (r.status == "Success") {
            this.detailsInvoiceId = r.entity.invoicecode.Id;
            this.detailsCocId = r.entity.coc.Id;
            this.detailsData = r.entity.consumableorderdetails1Records;
            for (var i in this.detailsData) {
              this.detailsData[i]["Id"] = this.detailsData[i].esd.Id;
              this.detailsData[i]["esdAssetModelNo"] =
                this.detailsData[i].esd.Asset_Model_No__c;
              this.detailsData[i]["packingListManual"] =
                this.detailsData[i].Packing_list_manual;
              this.detailsData[i]["esdDeliveryListRMB"] =
                this.detailsData[i].esd.Delivery_List_RMB__c;
              this.detailsData[i]["esdShipmentCount"] =
                this.detailsData[i].esd.Shipment_Count__c;
              this.detailsData[i]["esdRrturnProCount"] =
                this.detailsData[i].esd.RrturnPro_count__c;
              this.detailsData[i]["esdBoxPiece"] =
                this.detailsData[i].esd.Box_Piece__c;
              this.detailsData[i]["esdInvoicedProcount"] =
                this.detailsData[i].esd.Invoiced_Procount__c;
              this.detailsData[i]["esdInvoiceProNotCount"] =
                this.detailsData[i].esd.InvoiceProNot_count__c;
              //开票单位
              //this.detailsData[i].esd.Box_Piece__c
              //this.detailsData[i]['unitValue'] = this.detailsData[i].esd.Invoice_Unit__c;
              this.detailsData[i]["unitValue"] =
                this.detailsData[i].esd.Box_Piece__c;
              console.log("unitValue = " + this.detailsData[i]["unitValue"]);
              this.detailsData[i]["recordId"] = this.detailsData[i].esd.Id;
              //disabled="{!IF(records.esd.Box_Piece__c =='个' || (records.esd.Box_Piece__c =='盒' && records.Packing_list_manual ==1),true,false)}"
              //this.detailsData[i]['isDisabled'] = (this.detailsData[i].esd.Box_Piece__c == '个' || (this.detailsData[i].esd.Box_Piece__c =='盒' && this.detailsData[i].Packing_list_manual ==1)) ? true:false;
              this.detailsData[i]["isDisabled"] = true;
              let unitOptions = [];
              for (var key in this.detailsData[i].Invoice_UnitOptsMap) {
                let unitOption = {};
                unitOption["label"] =
                  this.detailsData[i].Invoice_UnitOptsMap[key];
                unitOption["value"] = key;
                unitOptions.push(unitOption);
              }
              this.detailsData[i]["unitOptions"] = unitOptions;
              this.detailsData[i]["esdInvoiceUnitprice"] =
                this.detailsData[i].esd.Invoice_Unitprice__c;
              //发票数量
              this.detailsData[i]["shipmentNumber"] =
                this.detailsData[i].invoiceCount;
              this.detailsData[i]["isConinvoice"] = true;
              this.detailsData[i]["invoiceAllprice"] =
                this.detailsData[i].invoiceAllprice;
              if (this.detailsData[i].check) {
                this.detailsSelectedRows.push(this.detailsData[i]["Id"]);
                this.invoiceAllprice += this.detailsData[i]["invoiceAllprice"];
              }
            }
            console.log(
              "this.detailsData = " + JSON.stringify(this.detailsData)
            );
            let lastInvoiceAllprice = {
              invoiceAllprice: this.invoiceAllprice
            };
            this.invoiceAllpriceData.push(lastInvoiceAllprice);
            console.log(
              "this.invoiceAllpriceData = " +
                JSON.stringify(this.invoiceAllpriceData)
            );
            this.isShowSpinner = false;
            this.isDetailsShow = true;
          } else {
            this.showMyToast("初始化失败", r.msg, "Error");
          }
        })
        .catch((error) => {
          this.isShowSpinner = false;
          console.log("error = " + JSON.stringify(error));
        });
    } else if (
      this.deliveryId == "" &&
      this.invoiceId == "" &&
      this.isNew == ""
    ) {
      console.log("conInvoiceListInit");
      conInvoiceListInit()
        .then((r) => {
          r = JSON.parse(JSON.stringify(r));
          console.log("conInvoiceListInit r = " + JSON.stringify(r));
          if (r.status == "Success") {
            this.ConInvoiceListAccountId = r.entity.accountid;
            this.ConInvoiceListUserWorkLocation = r.entity.userWorkLocation;
            this.ConInvoiceListAgencyProType = r.entity.agencyProType;
            //if (this.ConInvoiceListAgencyProType != 'ET')
            this.isOpenReportDisabled = false;
            this.invoiceData = r.entity.raesList;
            for (var i in this.invoiceData) {
              this.invoiceData[i]["NameUrl"] =
                "/lexconinvoiceview?invoiceId=" + this.invoiceData[i].Id;
            }
            console.log(
              "this.invoiceData = " + JSON.stringify(this.invoiceData)
            );
            for (var key in r.entity.statusMap) {
              let object = {};
              object["label"] = key;
              object["value"] = r.entity.statusMap[key];
              this.invoiceStatusOptions.push(object);
            }
            this.invoiceStatusOptions = [...this.invoiceStatusOptions];
            console.log(
              "this.invoiceStatusOptions = " +
                JSON.stringify(this.invoiceStatusOptions)
            );
            this.isShowSpinner = false;
          } else {
            this.showMyToast("初始化失败", r.msg, "Error");
          }
        })
        .catch((error) => {
          console.log("error = " + JSON.stringify(error));
        });
    } else {
      console.log("init");
      this.isConInvoiceList = false;
      init({
        invoiceId: this.invoiceId,
        statusEdit: this.statusEdit,
        deliveryId: this.deliveryId
      })
        .then((r) => {
          r = JSON.parse(JSON.stringify(r));
          console.log("r = " + JSON.stringify(r));
          if (r.status == "Success") {
            this.coc = r.entity.coc;
            this.cocId = this.coc.Id;
            this.EditAble = r.entity.EditAble;
            this.isChange = r.entity.isChange;
            this.ExistOutbound = r.entity.ExistOutbound;
            this.outboundData = r.entity.invoiceOrderRecoeds;
            console.log(
              "this.outboundData = " + JSON.stringify(this.outboundData)
            );
            this.done = r.entity.done;
            this.accountid = r.entity.accountid;
            this.userWorkLocation = r.entity.userWorkLocation;
            this.outOrderStringListLwc = r.entity.outOrderStringList;
            this.outordercountMapLwc = r.entity.outordercountMap;
            this.invoiceOrderRecoedschange = r.entity.invoiceOrderRecoedschange;
            this.isDisabledEdit =
              this.coc.Invoice_status__c == "提交" ||
              this.coc.Invoice_status__c == "已完成"
                ? true
                : false;
            this.isDisabledReopen =
              this.coc.Invoice_status__c == "提交" ? false : true;
            this.isDisabledDelete =
              this.coc.Invoice_status__c == "草案中" ? false : true;
            this.isDisabledAttachment =
              this.coc.Invoice_status__c == "已完成" ? true : false;
            this.OrderCode = this.coc.Name;
            this.InvoiceDate = this.coc.Invoice_Date__c;
            for (var i in this.outboundData) {
              this.outboundData[i].Id = this.outboundData[i].esd.Id;
              if (this.outboundData[i].check)
                this.selectedRows.push(this.outboundData[i].esd.Id);
            }
            this.selectedRows = [...this.selectedRows];
            console.log(
              "r.entity.attachmentRecoeds = " +
                JSON.stringify(r.entity.attachmentRecoeds)
            );
            if (!this.EditAble) {
              //附件显示
              this.showLoadingSpinner = true;
              this.fileData = r.entity.attachmentRecoeds;
              for (var i in this.fileData) {
                this.fileData[i]["Id"] = this.fileData[i].cvInfo.Id;
                this.fileData[i]["recordId"] = this.fileData[i].cvInfo.Id;
                this.fileData[i]["url"] = "/" + this.fileData[i].cvInfo.Id;
                this.fileData[i]["Title"] = this.fileData[i].cvInfo.Title;
                this.fileData[i]["CreatedByName"] =
                  this.fileData[i].cvInfo.Owner.Name;
                this.fileData[i]["CreatedByNameUrl"] =
                  "/" + this.fileData[i].cvInfo.OwnerId;
                this.fileData[i]["CreatedDate"] =
                  this.fileData[i].cvInfo.CreatedDate;
                this.fileData[i]["attUrl"] = "/" + this.fileData[i].cvInfo.Id;
                this.fileData[i]["downloadUrl"] =
                  "/sfc/servlet.shepherd/document/download/" +
                  this.fileData[i].cvInfo.ContentDocumentId +
                  "?operationContext=S1";
                if (this.isDisabledAttachment) {
                  console.log("进入this.isDisabledAttachment");
                  this.fileData[i]["isDisabledAttachment"] = true;
                }
                let typeOptions = [];
                for (var key in this.fileData[i].mailSelectOptsMap) {
                  let typeOption = {};
                  typeOption["label"] = this.fileData[i].mailSelectOptsMap[key];
                  typeOption["value"] = key;
                  typeOptions.push(typeOption);
                }
                this.fileData[i]["typeValue"] =
                  this.fileData[i].mailSelectOptsin == null
                    ? typeOptions[0].value
                    : this.fileData[i].mailSelectOptsin;
                this.fileData[i]["typeOptions"] = typeOptions;
                this.fileData[i]["mailSelectOptsin"] =
                  this.fileData[i].mailSelectOptsin == null
                    ? typeOptions[0].value
                    : this.fileData[i].mailSelectOptsin;
              }
              console.log("this.fileData = " + JSON.stringify(this.fileData));
            }
            //发票明细
            this.invoiceOrderdetail1Recoeds =
              r.entity.invoiceOrderdetail1Recoeds;
            for (var i in this.invoiceOrderdetail1Recoeds) {
              this.invoiceOrderdetail1Recoeds[i]["esdetProductOutDate"] =
                this.invoiceOrderdetail1Recoeds[i].esdet.Product_OutDate__c;
              this.invoiceOrderdetail1Recoeds[i]["esdetInvoicedet1ODlinkName"] =
                this.invoiceOrderdetail1Recoeds[
                  i
                ].esdet.Invoicedet1_OD_link__r.Name;
              this.invoiceOrderdetail1Recoeds[i]["esdetAssetModelNo"] =
                this.invoiceOrderdetail1Recoeds[i].esdet.Asset_Model_No__c;
              this.invoiceOrderdetail1Recoeds[i]["esdetInvoiceUnit"] =
                this.invoiceOrderdetail1Recoeds[i].esdet.Invoice_Unit__c;
              this.invoiceOrderdetail1Recoeds[i]["esdetInvoiceUnitprice"] =
                this.invoiceOrderdetail1Recoeds[i].esdet.Invoice_Unitprice__c;
              this.invoiceOrderdetail1Recoeds[i]["esdetInvoicedCount"] =
                this.invoiceOrderdetail1Recoeds[i].esdet.Invoiced_Count__c;
              this.invoiceOrderdetail1Recoeds[i]["esdetInvoicedProCostRMB"] =
                this.invoiceOrderdetail1Recoeds[i].esdet.InvoicedProCost_RMB__c;
            }
            //客户名
            this.HospitalName = r.entity.HospitalName;
            this.HospitalInfo = r.entity.HospitalInfo;
            this.agencyProType = r.entity.agencyProType;
            //if (this.agencyProType != 'ET')
            this.isOpenReportDisabled = false;
            //科室
            this.ForCustomerText = this.coc.Order_ForCustomerText__c;
            //备注
            this.InvoiceNote = this.coc.Invoice_Note__c;
            //二级经销商
            for (var key in r.entity.provinceOptsMap) {
              let object = {};
              object["label"] = r.entity.provinceOptsMap[key];
              object["value"] = key;
              this.provinceOptsMap.push(object);
            }
            //出货一览columns
            if (this.EditAble) {
              let object1 = {
                label: "客户名",
                fieldName: "hospitalName",
                hideDefaultActions: true,
                wrapText: true
              };
              let object2 = {
                label: "出货金额(元)",
                fieldName: "shipmentAmount",
                type: "number",
                typeAttributes: {
                  minimumFractionDigits: 2
                },
                hideDefaultActions: true
              };
              let object3 = {
                label: "返品金额(元)",
                fieldName: "returnAmount",
                type: "number",
                typeAttributes: {
                  minimumFractionDigits: 2
                },
                hideDefaultActions: true
              };
              this.outboundColumns.push(object1);
              this.outboundColumns.push(object2);
              this.outboundColumns.push(object3);
            }
            let object4 = {
              label: "未发票金额(元)",
              fieldName: "uninvoicedAmount",
              type: "number",
              typeAttributes: {
                minimumFractionDigits: 2
              },
              hideDefaultActions: true
            };
            this.outboundColumns.push(object4);
            //出货一览Data
            let index = 0;
            for (var i in this.outboundData) {
              this.outboundData[i]["esdOutboundDate"] =
                this.outboundData[i].esd.Outbound_Date__c;
              this.outboundData[i]["esdNameUrl"] =
                "/s/lexsummonscreat?ESetid=" + this.outboundData[i].esd.Id;
              this.outboundData[i]["esdName"] = this.outboundData[i].esd.Name;
              if (this.EditAble) {
                this.outboundData[i]["hospitalName"] =
                  this.outboundData[i].esd.ShipmentAccount__c;
                this.outboundData[i]["shipmentAmount"] =
                  this.outboundData[i].esd.Shipment_total_amount__c;
                this.outboundData[i]["returnAmount"] =
                  this.outboundData[i].esd.RrturnPro_total_amount__c;
              }
              this.outboundData[i]["uninvoicedAmount"] =
                this.outboundData[i].esd.InvoiceNotPro_money__c;
              this.outboundData[i]["invoiceFaceAmount"] =
                this.keepTwoDecimalStr(this.outboundData[i].needInvoiceCount);
              if (
                !(
                  this.outboundData[i].esd.Billed_Status__c == "全部开票" ||
                  this.EditAble ||
                  this.coc.Invoice_status__c != "草案中"
                )
              ) {
                console.log("进入 if");
                let url =
                  "/lexconinvoiceview?orderId=" +
                  this.outboundData[i].esd.Id +
                  "&invoiceId=" +
                  this.invoiceId;
                this.outboundData[i]["invoiceFaceAmountUrl"] = url;
                if (index == 0) {
                  let object5 = {
                    label: "发票票面金额(元)",
                    cellAttributes: { alignment: "right" },
                    type: "url",
                    fieldName: "invoiceFaceAmountUrl",
                    typeAttributes: {
                      label: {
                        fieldName: "invoiceFaceAmount"
                      }
                      //target: "_blank",
                    },
                    hideDefaultActions: true
                  };
                  this.outboundColumns.push(object5);
                  index++;
                }
              } else {
                console.log("进入 else");
                if (index == 0) {
                  let object5 = {
                    label: "发票票面金额(元)",
                    cellAttributes: { alignment: "right" },
                    fieldName: "invoiceFaceAmount",
                    hideDefaultActions: true,
                    type: "number",
                    typeAttributes: {
                      minimumFractionDigits: 2
                    }
                  };
                  this.outboundColumns.push(object5);
                  index++;
                }
              }
              //计算发票票面金额
              this.sumPrice += this.outboundData[i].needInvoiceCount;
            }
            //四舍五入
            //this.sumPrice = this.sumPrice.toFixed(2);
            //如果不四舍五入
            console.log("start keepTwoDecimalStr");
            this.sumPrice = this.keepTwoDecimalStr(this.sumPrice);
            console.log("end keepTwoDecimalStr = " + this.sumPrice);
            //加最后一行显示金额
            if (this.EditAble) {
              let lastOutboundData = {
                invoiceFaceAmount: this.sumPrice
              };
              this.outboundDataSumPrice.push(lastOutboundData);
            }
            this.outboundColumns = [...this.outboundColumns];
            this.isEditInvoice = !(!this.EditAble || this.isChange);
            if (this.coc.SummonsForDirction__c == "销售给二级经销商")
              this.isShowSecondaryDistributor = true;
            if (this.deliveryId == "" && !this.ExistOutbound && this.EditAble)
              this.hideCheckbox = false;
            this.isShowSpinner = false;
            this.showLoadingSpinner = false;
          } else {
            this.showMyToast("失败", r.msg, "Error");
          }
        })
        .catch((error) => {
          console.log("error = " + JSON.stringify(error));
        });
    }
  }
  //上传配置单
  uploadOrder(event) {
    this.showAttPop = true;
  }
  //关闭附件弹窗
  closePop() {
    this.showAttPop = false;
    this.filesUploaded = [];
    this.fileName = null;
  }
  //附件change事件
  attChange(event) {
    if (event.target.files.length > 0) {
      this.filesUploaded = event.target.files;
      this.fileName = event.target.files[0].name;
      console.log("this.fileName:" + this.fileName);
    }
  }
  //移除附件
  removeAtt() {
    this.filesUploaded = [];
    this.fileName = "";
  }
  //是否显示附件移除
  get attDelBtn() {
    if (
      this.fileName != "" &&
      this.fileName != null &&
      this.fileName != "选择一个文件上传"
    ) {
      return true;
    } else {
      return false;
    }
  }
  keepTwoDecimalStr(num) {
    const result = Number(num.toString().match(/^\d+(?:\.\d{0,2})?/));
    let s = result.toString();
    let rs = s.indexOf(".");
    if (rs < 0) {
      rs = s.length;
      s += ".";
    }
    while (s.length <= rs + 2) {
      s += "0";
    }
    return s;
  }
  dataChange(event) {
    let fieldName = event.target.getAttribute("data-field");
    let value = event.detail.value;
    console.log("fieldName = " + fieldName + " value = " + value);
    switch (fieldName) {
      case "OrderCode":
        this.OrderCode = value;
        this.coc["Name"] = value;
        break;
      case "ForCustomerText":
        this.ForCustomerText = value;
        this.coc["Order_ForCustomerText__c"] = value;
        break;
      case "InvoiceDate":
        this.InvoiceDate = value;
        this.coc["Invoice_Date__c"] = value;
        break;
      case "secondaryDistributor":
        this.secondaryDistributor = value;
        break;
      case "deliveryFromDate":
        this.deliveryFromDate = value;
        break;
      case "deliveryToDate":
        this.deliveryToDate = value;
        break;
      case "category1":
        this.category1 = value;
        break;
      case "category2":
        this.category2 = value;
        break;
      case "invoiceStatus":
        this.invoiceStatusValue = value;
        break;
      case "searchHospitalName":
        this.searchHospitalName = value;
        break;
      case "InvoiceNote":
        this.InvoiceNote = value;
        this.coc["Invoice_Note__c"] = value;
        break;
    }
  }
  invoiceDateChange(event) {
    this.InvoiceDate = event.detail.value;
    this.coc["Invoice_Date__c"] = event.detail.value;
    console.log("this.InvoiceDate = " + this.InvoiceDate);
  }
  //搜索客户名
  searchHospitalNameModal() {
    console.log("searchHospitalNameModal");
    hospitalInit({
      ctype: this.agencyProType
    }).then((r) => {
      r = JSON.parse(JSON.stringify(r));
      if (r.status == "Success") {
        this.hospitalList = r.entity.at;
        for (var i in this.hospitalList) {
          this.hospitalList[i]["stateMasterName"] =
            this.hospitalList[i].State_Master__r.Name;
        }
        console.log("hospitalInit r = " + JSON.stringify(this.hospitalList));
        this.isModalOpen = true;
      }
    });
  }
  searchHospital() {
    console.log("this.searchHospitalName = " + this.searchHospitalName);
    serContact({
      searchName: this.searchHospitalName,
      ctype: this.agencyProType
    }).then((r) => {
      r = JSON.parse(JSON.stringify(r));
      if (r.status == "Success") {
        this.hospitalList = r.entity.at;
        for (var i in this.hospitalList) {
          this.hospitalList[i]["stateMasterName"] =
            this.hospitalList[i].State_Master__r.Name;
        }
        console.log("hospitalInit r = " + JSON.stringify(this.hospitalList));
      }
    });
  }
  //选择客户名
  searchHandleRowAction(event) {
    console.log("searchHandleRowAction");
    let row = event.detail.row;
    this.HospitalInfo = row.Id;
    this.HospitalName = row.Name;
    console.log(
      "this.HospitalInfo = " +
        this.HospitalInfo +
        " this.HospitalName = " +
        this.HospitalName
    );
    this.isModalOpen = false;
  }
  //当客户名是空时。客户id也变为空
  clearAgencyI(event) {
    this.HospitalName = event.target.value;
    if (this.HospitalName == "" || this.HospitalName == null) {
      this.HospitalInfo = "";
    }
    console.log("this.HospitalName = " + this.HospitalName);
    console.log("this.HospitalInfo = " + this.HospitalInfo);
  }
  closeModal() {
    this.isModalOpen = false;
  }
  SaveJs() {
    this.isShowSpinner = true;
    let cloneData = this.outboundData;
    debugger;
    const selectedRows = this.template
      .querySelector("[data-field='outbound']")
      .getSelectedRows();
    console.log("selectedRows = " + JSON.stringify(selectedRows));
    for (var i in cloneData) {
      let b = false;
      for (var j in selectedRows) {
        if (cloneData[i].esd.Id == selectedRows[j].esd.Id) {
          b = true;
          cloneData[i].check = true;
        }
      }
      if (!b) {
        cloneData[i].check = false;
      }
      delete cloneData[i].esdOutboundDate;
      delete cloneData[i].esdNameUrl;
      delete cloneData[i].esdName;
      delete cloneData[i].hospitalName;
      delete cloneData[i].shipmentAmount;
      delete cloneData[i].returnAmount;
      delete cloneData[i].uninvoicedAmount;
      delete cloneData[i].invoiceFaceAmount;
      delete cloneData[i].invoiceFaceAmountUrl;
    }
    console.log("this.coc = " + JSON.stringify(this.coc));
    console.log("this.HospitalName = " + this.HospitalName);
    console.log("this.HospitalInfo = " + this.HospitalInfo);
    console.log("this.secondaryDistributor = " + this.secondaryDistributor);
    console.log("this.outboundData = " + JSON.stringify(cloneData));
    console.log("this.deliveryId = " + this.deliveryId);
    console.log("this.invoiceId = " + this.invoiceId);
    console.log("this.accountid = " + this.accountid);
    console.log("this.agencyProType = " + this.agencyProType);
    console.log("this.reopen = " + this.reopen);
    console.log(
      "this.invoiceOrderRecoedschangeLwc = " +
        JSON.stringify(this.invoiceOrderRecoedschange)
    );
    save({
      cocLwc: this.coc,
      HospitalNameLwc: this.HospitalName,
      HospitalInfoLwc: this.HospitalInfo,
      SecondDealerLwc: this.secondaryDistributor,
      invoiceOrderRecoedsLwc: JSON.stringify(cloneData),
      deliveryIdLwc: this.deliveryId,
      invoiceIdLwc: this.invoiceId,
      accountidLwc: this.accountid,
      agencyProTypeLwc: this.agencyProType,
      reopenLwc: this.reopen,
      invoiceOrderRecoedschangeLwc: JSON.stringify(
        this.invoiceOrderRecoedschange
      )
    })
      .then((r) => {
        r = JSON.parse(JSON.stringify(r));
        console.log("r = " + JSON.stringify(r));
        if (r.status == "Success" && r.msg == "") {
          this.isShowSpinner = false;
          console.log("save success");
          let url = "/lexconinvoiceview?invoiceId=" + r.entity.invoiceId;
          console.log("url = " + url);
          this[NavigationMixin.Navigate]({
            type: "standard__webPage",
            attributes: {
              url: url
            }
          });
        } else {
          this.showMyToast("保存失败", r.msg, "Error");
        }
      })
      .catch((error) => {
        console.log("error = " + JSON.stringify(error));
      });
  }
  //上传附件,直接就保存好,然后展示
  handleFilesChange(event) {
    console.log("handleFilesChange");
    this.handleSave();
    // if (event.target.files.length > 0) {
    //     this.filesUploaded = event.target.files;
    //     this.fileName = event.target.files[0].name;
    //     this.handleSave();
    // }
  }
  handleSave() {
    console.log("saveFile");
    if (this.filesUploaded.length > 0) {
      this.showPopSpinner = true;
      this.file = this.filesUploaded[0];
      if (this.file.size > this.MAX_FILE_SIZE) {
        this.showMyToast("保存失败", "文件过大", "Error");
        return;
      }
      this.fileReader = new FileReader();
      this.fileReader.onloadend = () => {
        this.fileContents = this.fileReader.result;
        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 = "选择一个文件上传";
    }
  }
  saveToFile() {
    console.log("saveToFile");
    console.log("invoiceId = " + this.invoiceId);
    console.log("fileName = " + this.fileName);
    console.log("base64Data = " + encodeURIComponent(this.fileContents));
    saveFile({
      recordId: this.invoiceId,
      fileName: this.fileName,
      base64Data: encodeURIComponent(this.fileContents)
    })
      .then((r) => {
        r = JSON.parse(JSON.stringify(r));
        console.log("r = " + JSON.stringify(r));
        if (r != "") {
          this.showPopSpinner = false;
          this.showMyToast("上传成功", "", "Success");
          this.closePop();
          this.init();
        } else {
          this.showMyToast("上传失败", r.msg, "Error");
        }
      })
      .catch((error) => {
        console.log("error = " + error.message);
        this.showMyToast("错误", "上传失败", "Error");
      });
  }
  handleTypeChange(event) {
    console.log("handleTypeChange");
    const typeDetail = event.detail;
    console.log("typeDetail = " + JSON.stringify(typeDetail));
    for (var i in this.fileData) {
      if (this.fileData[i].recordId == typeDetail.data.recordId) {
        this.fileData[i].typeValue = typeDetail.data.typeValue;
        this.fileData[i].mailSelectOptsin = typeDetail.data.typeValue;
      }
    }
    console.log("this.fileData = " + JSON.stringify(this.fileData));
  }
  newInvoiceJs() {
    let url = "/lexconinvoiceview?isNew=yes";
    console.log("url = " + url);
    this[NavigationMixin.Navigate]({
      type: "standard__webPage",
      attributes: {
        url: url
      }
    });
  }
  saveAttachmentJs() {
    debugger;
    this.showLoadingSpinner = true;
    let cloneData = this.deepClone(this.fileData);
    for (var i in cloneData) {
      delete cloneData[i].Id;
      delete cloneData[i].recordId;
      delete cloneData[i].url;
      delete cloneData[i].Title;
      delete cloneData[i].CreatedByName;
      delete cloneData[i].CreatedByNameUrl;
      delete cloneData[i].CreatedDate;
      delete cloneData[i].typeValue;
      delete cloneData[i].typeOptions;
      delete cloneData[i].mailSelectOptsMap;
    }
    console.log("cloneData = " + JSON.stringify(cloneData));
    saveAttachment({
      attachmentRecoedsLwc: JSON.stringify(cloneData),
      invoiceId: this.invoiceId
    })
      .then((r) => {
        r = JSON.parse(JSON.stringify(r));
        console.log("r = " + JSON.stringify(r));
        if (r.status == "Success") {
          this.showLoadingSpinner = false;
          this.isShowSpinner = true;
          // const event = new ShowToastEvent({
          //     title: 'Success',
          //     variant: 'Success',
          //     message: '保存成功',
          // });
          // this.dispatchEvent(event);
          this.showMyToast("附件保存成功", "", "Success");
          //this.init();
          setTimeout(function () {
            //1秒后执行刷新
            window.location.reload();
          }, 2000); //单位是毫秒
          // let url = "/lexconinvoiceview?invoiceId=" + this.invoiceId;
          // console.log('url = ' + url);
          // this[NavigationMixin.Navigate]({
          //     type: "standard__webPage",
          //     attributes: {
          //         url: url,
          //     },
          // });
        } else {
          this.showMyToast("上传失败", r.msg, "Error");
        }
      })
      .catch((error) => {
        console.log("error = " + error.message);
        this.showMyToast("错误", "上传失败", "Error");
      });
  }
  invoiceCodeSearchJs() {
    this.isShowSpinner = true;
    invoiceCodeSearch({
      orderDateLwc:
        this.deliveryFromDate == null ? null : new Date(this.deliveryFromDate),
      deliverDateLwc:
        this.deliveryToDate == null ? null : new Date(this.deliveryToDate),
      invoiceStatusLwc: this.invoiceStatusValue,
      category1Lwc: this.category1,
      category2Lwc: this.category2,
      accountidLwc: this.ConInvoiceListAccountId,
      userWorkLocationLwc: this.ConInvoiceListUserWorkLocation,
      agencyProTypeLwc: this.ConInvoiceListAgencyProType
    })
      .then((r) => {
        r = JSON.parse(JSON.stringify(r));
        console.log("r = " + JSON.stringify(r));
        if (r.status == "Success") {
          this.invoiceData = r.entity.raesList;
          for (var i in this.invoiceData) {
            this.invoiceData[i]["NameUrl"] =
              "/lexconinvoiceview?invoiceId=" + this.invoiceData[i].Id;
          }
          console.log("this.invoiceData = " + JSON.stringify(this.invoiceData));
          this.isShowSpinner = false;
          if (r.entity.raesListSize > 0) {
            this.showMyToast(
              "搜索成功",
              "共检索到" + r.entity.raesListSize + "个发票",
              "Success"
            );
          } else {
            this.showMyToast("搜索失败", "没有搜索到相关发票", "Error");
          }
        } else {
          this.showMyToast("搜索失败", r.msg, "Error");
        }
      })
      .catch((error) => {
        console.log("error = " + error.message);
        this.showMyToast("错误", "搜索失败", "Error");
      });
  }
  ClearJs() {
    this.deliveryFromDate = "";
    this.deliveryToDate = "";
    this.category1 = "";
    this.category2 = "";
    this.invoiceStatusValue = "";
    this.isShowSpinner = true;
    conInvoiceListInit()
      .then((r) => {
        r = JSON.parse(JSON.stringify(r));
        console.log("conInvoiceListInit r = " + JSON.stringify(r));
        if (r.status == "Success") {
          this.invoiceData = r.entity.raesList;
          for (var i in this.invoiceData) {
            this.invoiceData[i]["NameUrl"] =
              "/lexconinvoiceview?invoiceId=" + this.invoiceData[i].Id;
          }
          console.log("this.invoiceData = " + JSON.stringify(this.invoiceData));
          this.isShowSpinner = false;
        } else {
          this.showMyToast("搜索失败", r.msg, "Error");
        }
      })
      .catch((error) => {
        console.log("error = " + JSON.stringify(error));
      });
  }
  InvoiceorderSearchJs() {
    this.isShowSpinner = true;
    debugger;
    let cloneData = this.outboundData;
    const selectedRows = this.template
      .querySelector("[data-field='outbound']")
      .getSelectedRows();
    console.log("selectedRows " + JSON.stringify(selectedRows));
    for (var i in cloneData) {
      let b = false;
      for (var j in selectedRows) {
        if (cloneData[i].esd.Id == selectedRows[j].esd.Id) {
          b = true;
          cloneData[i].check = true;
        }
      }
      if (!b) {
        cloneData[i].check = false;
      }
      delete cloneData[i].esdOutboundDate;
      delete cloneData[i].esdNameUrl;
      delete cloneData[i].esdName;
      delete cloneData[i].hospitalName;
      delete cloneData[i].shipmentAmount;
      delete cloneData[i].returnAmount;
      delete cloneData[i].uninvoicedAmount;
      delete cloneData[i].invoiceFaceAmount;
      delete cloneData[i].invoiceFaceAmountUrl;
    }
    console.log("this.coc = " + JSON.stringify(this.coc));
    console.log("this.invoiceId = " + this.invoiceId);
    console.log("this.accountid = " + this.accountid);
    console.log("this.userWorkLocation = " + this.userWorkLocation);
    console.log("this.agencyProType = " + this.agencyProType);
    console.log("this.HospitalInfo = " + this.HospitalInfo);
    console.log("SecondDealer = " + this.secondaryDistributor);
    console.log("invoiceOrderRecoedsLwc = " + JSON.stringify(cloneData));
    InvoiceorderSearch({
      cocLwc: this.coc,
      invoiceIdLwc: this.invoiceId,
      accountidLwc: this.accountid,
      userWorkLocationLwc: this.userWorkLocation,
      agencyProTypeLwc: this.agencyProType,
      HospitalInfoLwc: this.HospitalInfo,
      SecondDealerLwc: this.secondaryDistributor,
      invoiceOrderRecoedsLwc: JSON.stringify(cloneData)
    })
      .then((r) => {
        r = JSON.parse(JSON.stringify(r));
        console.log("r = " + JSON.stringify(r));
        if (r.status == "Success") {
          this.outboundData = r.entity.invoiceOrderRecoeds;
          console.log(
            "this.outboundData = " + JSON.stringify(this.outboundData)
          );
          let index = 0;
          this.selectedRows = [];
          for (var i in this.outboundData) {
            if (this.outboundData[i].check)
              this.selectedRows.push(this.outboundData[i].esd.Id);
            this.outboundData[i].Id = this.outboundData[i].esd.Id;
            this.outboundData[i]["esdOutboundDate"] =
              this.outboundData[i].esd.Outbound_Date__c;
            this.outboundData[i]["esdNameUrl"] =
              "/s/lexsummonscreat?ESetid=" + this.outboundData[i].esd.Id;
            this.outboundData[i]["esdName"] = this.outboundData[i].esd.Name;
            if (this.EditAble) {
              this.outboundData[i]["hospitalName"] =
                this.outboundData[i].esd.ShipmentAccount__c;
              this.outboundData[i]["shipmentAmount"] =
                this.outboundData[i].esd.Shipment_total_amount__c;
              this.outboundData[i]["returnAmount"] =
                this.outboundData[i].esd.RrturnPro_total_amount__c;
            }
            this.outboundData[i]["uninvoicedAmount"] =
              this.outboundData[i].esd.InvoiceNotPro_money__c;
            this.outboundData[i]["invoiceFaceAmount"] =
              this.outboundData[i].needInvoiceCount;
            if (
              !(
                this.outboundData[i].esd.Billed_Status__c == "全部开票" ||
                this.EditAble ||
                this.coc.Invoice_status__c != "草案中"
              )
            ) {
              //let url = "/ConInvoicedetails?orderId=" + this.outboundData[i].esd.Id + "&invoiceId=" + this.invoiceId;
              let url =
                "/s/lexconinvoiceview?orderId=" +
                this.outboundData[i].esd.Id +
                "&invoiceId=" +
                this.invoiceId;
              this.outboundData[i]["invoiceFaceAmountUrl"] = url;
              if (index == 0) {
                let object5 = {
                  label: "发票票面金额(元)",
                  cellAttributes: { alignment: "right" },
                  type: "url",
                  fieldName: "invoiceFaceAmountUrl",
                  typeAttributes: {
                    label: {
                      fieldName: "invoiceFaceAmount"
                    },
                    target: "_blank"
                  },
                  hideDefaultActions: true
                };
                this.outboundColumns.push(object5);
                index++;
              }
            } else {
              if (index == 0) {
                let object5 = {
                  label: "发票票面金额(元)",
                  cellAttributes: { alignment: "right" },
                  fieldName: "invoiceFaceAmount",
                  hideDefaultActions: true
                };
                this.outboundColumns.push(object5);
                index++;
              }
            }
            //计算发票票面金额
            this.sumPrice += this.outboundData[i].needInvoiceCount;
          }
          console.log(
            "this.selectedRows = " + JSON.stringify(this.selectedRows)
          );
          this.isShowSpinner = false;
        } else {
          this.showMyToast("搜索失败", r.msg, "Error");
        }
      })
      .catch((error) => {
        console.log("error = " + error.message);
        this.showMyToast("错误", "搜索失败", "Error");
      });
  }
  getSelectedRows(event) {
    // console.log("getSelectedRows ");
    // for (var i in this.outboundData) {
    //     this.outboundData[i].check = false;
    // }
    // const selectedRows = event.detail.selectedRows;
    // for (var i in this.outboundData) {
    //     for (var j in selectedRows) {
    //         if (this.outboundData[i].esd.Id == selectedRows[j].esd.Id) {
    //             //this.outboundData[i].check = !this.outboundData[i].check;
    //             this.outboundData[i].check = true;
    //         }
    //     }
    // }
    // console.log('this.outboundData = ' + JSON.stringify(this.outboundData));
  }
  deleteButtonJs() {
    this.isShowSpinner = true;
    deleteButton({
      cocLwc: this.coc,
      invoiceIdLwc: this.invoiceId
    })
      .then((r) => {
        r = JSON.parse(JSON.stringify(r));
        console.log("r = " + JSON.stringify(r));
        if (r.status == "Success") {
          this.isShowSpinner = false;
          let url = "/lexconinvoiceview";
          console.log("url = " + url);
          this[NavigationMixin.Navigate]({
            type: "standard__webPage",
            attributes: {
              url: url
            }
          });
        } else {
          this.showMyToast("删除失败", r.msg, "Error");
        }
      })
      .catch((error) => {
        console.log("error = " + error.message);
      });
  }
  SetEditAbleJs() {
    let statusEditAbleJs = "Redirect";
    let url =
      "/lexconinvoiceview?invoiceId=" +
      this.invoiceId +
      "&KeyWords=" +
      statusEditAbleJs;
    console.log("url = " + url);
    this[NavigationMixin.Navigate]({
      type: "standard__webPage",
      attributes: {
        url: url
      }
    });
  }
  approvalJs() {
    this.isShowSpinner = true;
    approval({
      outOrderStringListLwc: this.outOrderStringListLwc,
      outordercountMapLwc: this.outordercountMapLwc,
      invoiceIdLwc: this.invoiceId
    })
      .then((r) => {
        r = JSON.parse(JSON.stringify(r));
        console.log("r = " + JSON.stringify(r));
        if (r.status == "Success") {
          this.isShowSpinner = false;
          let url = "/s/lexconinvoiceview?invoiceId=" + this.invoiceId;
          console.log("url = " + url);
          window.open(url, "_self");
          // this[NavigationMixin.Navigate]({
          //     type: "standard__webPage",
          //     attributes: {
          //         url: url,
          //     },
          // });
        } else {
          this.showMyToast("错误", r.msg, "Error");
        }
      })
      .catch((error) => {
        console.log("error = " + error.message);
      });
  }
  openReportJs() {
    console.log("openReportJs");
    let reportUrl = this.label.LexConInvoiceViewReport;
    let reportFilters =
      '[{"operator":"equals","value":"' +
      this.OrderCode +
      '","column":"FK_NAME"}]';
    console.log("reportUrl = " + reportUrl);
    let url =
      "/s/report/" +
      reportUrl +
      "?reportFilters=" +
      encodeURIComponent(reportFilters);
    window.open(url);
    // this[NavigationMixin.Navigate]({
    //     type: "standard__webPage",
    //     attributes: {
    //         url: url,
    //         target: '_blank'
    //     },
    // });
  }
  reopenJs() {
    // statusEdit = 'Redirect';
    // PageReference ref = new Pagereference('/ConInvoiceView?invoiceId=' + invoiceId + '&reopen=isreopen' + '&KeyWords=' + statusEdit);
    let statusEditAbleJs = "Redirect";
    let url =
      "/lexconinvoiceview?invoiceId=" +
      this.invoiceId +
      "&reopen=isreopen" +
      "&KeyWords=" +
      statusEditAbleJs;
    console.log("url = " + url);
    this[NavigationMixin.Navigate]({
      type: "standard__webPage",
      attributes: {
        url: url
      }
    });
  }
  showMyToast(title, message, variant) {
    this.isShowSpinner = false;
    this.showLoadingSpinner = false;
    this.showPopSpinner = false;
    this.showAttPop = false;
    this.filesUploaded = [];
    this.fileName = null;
    console.log("show custom message");
    var iconName = "";
    var content = "";
    if (variant.toLowerCase() == "success") {
      iconName = "utility:check";
    } else {
      iconName = "utility:error";
    }
    if (message != "") {
      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);
  }
  handleLoad() {
    console.log("handleLoad");
    try {
      const style = document.createElement("style");
      style.innerText = ".hehe-layoutItem .slds-button__icon {display: none;}";
      this.template.querySelector(".hideHelpText").appendChild(style);
      const style2 = document.createElement("style");
      style2.innerText =
        ".hehe-layoutItem  .slds-form-element__label {padding : 0px}";
      this.template.querySelector(".hideHelpText").appendChild(style2);
      const style3 = document.createElement("style");
      style3.innerText =
        ".readOnly  .slds-form-element__label {padding-top: 7px;}";
      this.template.querySelector(".hideHelpText").appendChild(style3);
    } catch (error) {
      console.log(error);
    }
  }
  keepTwoDecimalStr(num) {
    const result = Number(num.toString().match(/^\d+(?:\.\d{0,2})?/));
    let s = result.toString();
    let rs = s.indexOf(".");
    if (rs < 0) {
      rs = s.length;
      s += ".";
    }
    while (s.length <= rs + 2) {
      s += "0";
    }
    return s;
  }
  handleLoad2() {
    console.log("handleLoad2");
    try {
      const style = document.createElement("style");
      style.innerText = ".hehe-layoutItem .slds-button__icon {display: none;}";
      this.template.querySelector(".hideHelpText").appendChild(style);
      const style2 = document.createElement("style");
      style2.innerText =
        ".hehe-layoutItem  .slds-form-element__label {padding : 0px}";
      this.template.querySelector(".hideHelpText").appendChild(style2);
    } catch (error) {
      console.log(error);
    }
  }
  handleUnitChange(event) {
    console.log("handleUnitChange");
    this.invoiceAllpriceData[0].invoiceAllprice = 0.0;
    const unitDetail = event.detail;
    console.log("unitDetail = " + JSON.stringify(unitDetail));
    for (var i in this.detailsData) {
      if (this.detailsData[i].recordId == unitDetail.data.recordId) {
        this.detailsData[i].unitValue = unitDetail.data.unitValue;
        this.detailsData[i].esd.Invoice_Unit__c = unitDetail.data.unitValue;
        if (
          this.detailsSelectedRows.indexOf(this.detailsData[i].recordId) == -1
        )
          this.detailsSelectedRows.push(this.detailsData[i].recordId);
      }
    }
    this.detailsSelectedRows = [...this.detailsSelectedRows];
    console.log(
      "this.detailsSelectedRows = " + JSON.stringify(this.detailsSelectedRows)
    );
    for (var i in this.detailsData) {
      this.detailsData[i].invoiceAllprice = 0.0;
      for (var j in this.detailsSelectedRows) {
        console.log("this.detailsData[i].Id = " + this.detailsData[i].Id);
        console.log(
          "this.detailsSelectedRows[j] = " + this.detailsSelectedRows[j]
        );
        if (this.detailsData[i].Id == this.detailsSelectedRows[j]) {
          this.detailsData[i].invoiceAllprice = this.amend(
            this.detailsData[i].shipmentNumber,
            this.detailsData[i].esdInvoiceUnitprice,
            "*"
          );
          console.log(
            "this.detailsData[i].invoiceAllprice = " +
              this.detailsData[i].invoiceAllprice
          );
        }
      }
      this.invoiceAllpriceData[0].invoiceAllprice = this.amend(
        this.invoiceAllpriceData[0].invoiceAllprice,
        this.detailsData[i].invoiceAllprice,
        "+"
      );
    }
    this.detailsData = [...this.detailsData];
    this.invoiceAllpriceData = [...this.invoiceAllpriceData];
  }
  handleShipmentNumber(event) {
    console.log("handleShipmentNumber");
    this.invoiceAllpriceData[0].invoiceAllprice = 0.0;
    const numberDetail = event.detail;
    console.log("numberDetail = " + JSON.stringify(numberDetail));
    if (numberDetail.data.shipmentnumber == 0) {
      if (this.detailsSelectedRows.indexOf(numberDetail.data.recordId) != -1) {
        this.detailsSelectedRows.splice(
          this.detailsSelectedRows.indexOf(numberDetail.data.recordId),
          1
        );
      }
    }
    console.log(
      "start this.detailsSelectedRows = " +
        JSON.stringify(this.detailsSelectedRows)
    );
    console.log("numberDetail = " + JSON.stringify(numberDetail));
    for (var i in this.detailsData) {
      if (this.detailsData[i].recordId == numberDetail.data.recordId) {
        this.detailsData[i].shipmentNumber = Number(
          numberDetail.data.shipmentnumber
        );
        this.detailsData[i].invoiceCount = Number(
          numberDetail.data.shipmentnumber
        );
        if (
          this.detailsSelectedRows.indexOf(this.detailsData[i].recordId) ==
            -1 &&
          numberDetail.data.shipmentnumber != 0
        )
          this.detailsSelectedRows.push(this.detailsData[i].recordId);
      }
    }
    console.log(
      "end this.detailsSelectedRows = " +
        JSON.stringify(this.detailsSelectedRows)
    );
    this.detailsSelectedRows = [...this.detailsSelectedRows];
    console.log(
      "this.detailsSelectedRows = " + JSON.stringify(this.detailsSelectedRows)
    );
    for (var i in this.detailsData) {
      this.detailsData[i].invoiceAllprice = 0.0;
      for (var j in this.detailsSelectedRows) {
        console.log("this.detailsData[i].Id = " + this.detailsData[i].Id);
        console.log(
          "this.detailsSelectedRows[j] = " + this.detailsSelectedRows[j]
        );
        if (this.detailsData[i].Id == this.detailsSelectedRows[j]) {
          this.detailsData[i].invoiceAllprice = this.amend(
            this.detailsData[i].shipmentNumber,
            this.detailsData[i].esdInvoiceUnitprice,
            "*"
          );
          console.log(
            "this.detailsData[i].invoiceAllprice = " +
              this.detailsData[i].invoiceAllprice
          );
        }
      }
      this.invoiceAllpriceData[0].invoiceAllprice = this.amend(
        this.invoiceAllpriceData[0].invoiceAllprice,
        this.detailsData[i].invoiceAllprice,
        "+"
      );
    }
    this.detailsData = [...this.detailsData];
    this.invoiceAllpriceData = [...this.invoiceAllpriceData];
  }
  detailsGetSelectedRows(event) {
    console.log("detailsGetSelectedRows ");
    this.invoiceAllpriceData[0].invoiceAllprice = 0.0;
    let selectedRows = event.detail.selectedRows;
    for (var i in this.detailsData) {
      this.detailsData[i].invoiceAllprice = 0.0;
      for (var j in selectedRows) {
        if (this.detailsData[i].Id == selectedRows[j].esd.Id) {
          this.detailsData[i].invoiceAllprice = this.amend(
            this.detailsData[i].shipmentNumber,
            this.detailsData[i].esdInvoiceUnitprice,
            "*"
          );
          console.log(
            "this.detailsData[i].invoiceAllprice = " +
              this.detailsData[i].invoiceAllprice
          );
        }
      }
      this.invoiceAllpriceData[0].invoiceAllprice = this.amend(
        this.invoiceAllpriceData[0].invoiceAllprice,
        this.detailsData[i].invoiceAllprice,
        "+"
      );
      console.log(
        "this.invoiceAllpriceData[0].invoiceAllprice = " +
          this.invoiceAllpriceData[0].invoiceAllprice
      );
    }
    console.log("start this.detailsData = " + JSON.stringify(this.detailsData));
    this.detailsData = [...this.detailsData];
    console.log("end this.detailsData = " + JSON.stringify(this.detailsData));
    this.invoiceAllpriceData = [...this.invoiceAllpriceData];
  }
  ComputePrice(index, number, price) {
    console.log("index = " + index);
    console.log("number = " + number);
    console.log("price = " + price);
    let shipmentAmount = this.amend(number, price, "*");
    console.log("shipmentAmount = " + shipmentAmount);
    let sumPrice = 0.0;
    this.data[index].shipmentAmount = shipmentAmount;
    for (var i in this.data) {
      if (this.data[i].shipmentAmount) sumPrice += this.data[i].shipmentAmount;
    }
    this.sumPrice = sumPrice + "元";
    //存下选择行,不会被清空
    if (this.selectedRows.indexOf(this.data[index].Id) == -1)
      this.selectedRows.push(this.data[index].Id);
    this.data = [...this.data];
    this.selectedRows = [...this.selectedRows];
    console.log("this.selectedRows = " + JSON.stringify(this.selectedRows));
    console.log("this.data = " + JSON.stringify(this.data));
  }
  deepClone(obj) {
    return JSON.parse(JSON.stringify(obj));
  }
  detailsSaveJs() {
    this.isShowSpinner = true;
    let cloneData = this.deepClone(this.detailsData);
    let selectedRows = this.template
      .querySelector("c-lex-custom-lightning-datatable")
      .getSelectedRows();
    console.log("selectedRows = " + JSON.stringify(selectedRows));
    for (var i in cloneData) {
      delete cloneData[i].Id;
      delete cloneData[i].esdAssetModelNo;
      delete cloneData[i].packingListManual;
      delete cloneData[i].esdDeliveryListRMB;
      delete cloneData[i].esdShipmentCount;
      delete cloneData[i].esdRrturnProCount;
      delete cloneData[i].esdBoxPiece;
      delete cloneData[i].esdInvoicedProcount;
      delete cloneData[i].esdInvoiceProNotCount;
      delete cloneData[i].unitValue;
      delete cloneData[i].recordId;
      delete cloneData[i].unitOptions;
      delete cloneData[i].esdInvoiceUnitprice;
      delete cloneData[i].shipmentNumber;
      delete cloneData[i].invoiceAllprice;
      for (var j in selectedRows) {
        if (cloneData[i].esd.Id == selectedRows[j].esd.Id) {
          cloneData[i]["check"] = true;
        }
      }
    }
    console.log("cloneData = " + JSON.stringify(cloneData));
    detailsSave({
      consumableorderdetails1RecordsLwc: JSON.stringify(cloneData),
      invoiceIdLwc: this.invoiceId,
      orderIdLwc: this.orderId
    })
      .then((r) => {
        r = JSON.parse(JSON.stringify(r));
        console.log("r = " + JSON.stringify(r));
        if (r.status == "Success") {
          let url = "/lexconinvoiceview?invoiceId=" + this.invoiceId;
          this[NavigationMixin.Navigate]({
            type: "standard__webPage",
            attributes: {
              url: url
            }
          });
        } else {
          this.showMyToast("保存失败", r.msg, "Error");
        }
      })
      .catch((error) => {
        console.log("error = " + error.message);
      });
  }
  //num1 num2传入两个值  symbol +-*/符号
  amend(num1, num2, symbol) {
    var str1 = num1.toString(),
      str2 = num2.toString(),
      result,
      str1Length,
      str2Length;
    //解决整数没有小数点方法
    try {
      str1Length = str1.split(".")[1].length;
    } catch (error) {
      str1Length = 0;
    }
    try {
      str2Length = str2.split(".")[1].length;
    } catch (error) {
      str2Length = 0;
    }
    var step = Math.pow(10, Math.max(str1Length, str2Length));
    switch (symbol) {
      case "+":
        result = (num1 * step + num2 * step) / step;
        break;
      case "-":
        result = (num1 * step - num2 * step) / step;
        break;
      case "*":
        result = (num1 * step * (num2 * step)) / step / step;
        break;
      case "/":
        result = (num1 * step) / (num2 * step);
        break;
      default:
        break;
    }
    return result;
  }
  //删除附件
  deleteAtt(event) {
    this.isShowSpinner = true;
    //var recordId = event.detail.data.recordId;
    var recordId = event.target.getAttribute("data-fileid");
    console.log("attid:" + recordId);
    deleteAtt({
      contentVersionId: recordId
    })
      .then((r) => {
        r = JSON.parse(JSON.stringify(r));
        if (r.status == "Success") {
          this.showMyToast("删除成功", "", "Success");
          if (this.fileData.length == 1) window.location.reload();
          else this.init();
        } else {
          this.showMyToast("删除失败", r.msg, "Error");
        }
      })
      .catch((error) => {
        this.showMyToast("错误", error.message, "Error");
      });
  }
}
force-app/main/default/lwc/lexConsumable/lexConsumable.js
@@ -207,7 +207,7 @@
      wrapText: true,
      hideDefaultActions: true,
      sortable: true
      // initialWidth: 150
      // initialWidth: 136
    });
    cols.push({
      label: "规格",
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.html
@@ -1,20 +1,20 @@
<!-- sldsValidatorIgnore -->
<!-- sldsValidatorIgnore -->
<template>
    <c-common-toast></c-common-toast>
    <div class="outerBorderCss">
        <div style="padding: 5px">
            <div class="borderCss">
                <div style="padding: 15px">
                    <div lwc:dom="manual" class="resultDiv"></div>
                    <div draggable="false">
                        <!-- <div class="slds-m-top_small slds-m-bottom_medium"> -->
                        <!-- <lightning-button label="新建出库单" onclick={neworderhead}
  <c-common-toast></c-common-toast>
  <div class="outerBorderCss">
    <div style="padding: 5px">
      <div class="borderCss">
        <div style="padding: 15px">
          <div lwc:dom="manual" class="resultDiv"></div>
          <div draggable="false">
            <!-- <div class="slds-m-top_small slds-m-bottom_medium"> -->
            <!-- <lightning-button label="新建出库单" onclick={neworderhead}
                                class="slds-m-left_x-small" disabled></lightning-button>
                            <lightning-button label="上传已出库一览" onclick={editProductLimit}
                                class="slds-m-left_x-small"></lightning-button> -->
                         
                        <!-- <button class="slds-button slds-button_neutral slds-button_stretch lexBorder lexBorderWidth"
             
            <!-- <button class="slds-button slds-button_neutral slds-button_stretch lexBorder lexBorderWidth"
                            onclick={neworderhead}>
                            新建出库单
                        </button>
@@ -25,175 +25,233 @@
                            上传已出库一览
                        </button> -->
                        <lightning-layout multiple-rows>
                            <lightning-layout-item size="6">
                                <div class="slds-text-align_center">
                                    <div class="slds-grid slds-grid_vertical-align-center">
                                        <button
                                            class="slds-button slds-button_neutral slds-button_stretch lexBorder lexBorderWidth"
                                            onclick={neworderhead}>
                                            新建出库单
                                        </button>
                                         
                                        <div class="slds-form-element__label searchName" style="visibility: hidden">
                                            出库日&#12288;从
                                        </div>
                                        <div class="slds-form-element__label searchName" style="visibility: hidden">
                                            &#12288;到
                                        </div>
                                        <button
                                            class="slds-button slds-button_neutral slds-button_stretch lexBorder lexBorderWidth"
                                            onclick={editProductLimit} style="margin-left: 4px;">
                                            上传已出库一览
                                        </button>
                                    </div>
                                </div>
                            </lightning-layout-item>
                        </lightning-layout>
                        <!-- </div> -->
            <lightning-layout multiple-rows>
              <lightning-layout-item size="6">
                <div class="slds-text-align_center">
                  <div class="slds-grid slds-grid_vertical-align-center">
                    <button
                      class="slds-button slds-button_neutral slds-button_stretch lexBorder lexBorderWidth"
                      onclick={neworderhead}
                    >
                      新建出库单
                    </button>
                     
                    <div
                      class="slds-form-element__label searchName"
                      style="visibility: hidden"
                    >
                      出库日&#12288;从
                    </div>
                </div>
            </div>
            <div class="borderCss">
                <div class="headerDorderCss">
                    <lightning-layout>
                        <lightning-layout-item padding="around-small">
                            <p style="font-size: 18px">
                                <strong>检索条件</strong>
                            </p>
                        </lightning-layout-item>
                    </lightning-layout>
                </div>
                <div style="padding: 15px">
                    <div lwc:dom="manual" class="resultDiv"></div>
                    <div draggable="false">
                        <lightning-layout multiple-rows>
                            <lightning-layout-item size="6">
                                <div class="slds-text-align_center">
                                    <lightning-layout multiple-rows>
                                        <lightning-layout-item size="6">
                                            <div class="slds-grid slds-grid_vertical-align-center">
                                                <div class="slds-form-element__label searchName">
                                                    出库日&#12288;从
                                                </div>
                                                <lightning-input type="date" variant="label-hidden" label="出库日 从"
                                                    onchange={dataChange} data-field="deliveryFromDate"
                                                    value={deliveryFromDate} class="inputFont"
                                                    style="max-width: 150px;"></lightning-input>
                                            </div>
                                        </lightning-layout-item>
                                        <lightning-layout-item size="6">
                                            <div class="slds-grid slds-grid_vertical-align-center">
                                                <div class="slds-form-element__label searchName">
                                                    到
                                                </div>
                                                <lightning-input type="date" variant="label-hidden" label="到"
                                                    onchange={dataChange} data-field="deliveryToDate"
                                                    value={deliveryToDate} class="inputFont"
                                                    style="max-width: 150px;"></lightning-input>
                                            </div>
                                        </lightning-layout-item>
                                    </lightning-layout>
                                </div>
                            </lightning-layout-item>
                            <lightning-layout-item size="3">
                                <div class="slds-text-align_center">
                                    <div class="slds-grid slds-grid_vertical-align-center">
                                        <div class="slds-form-element__label searchName">
                                            出库单号
                                        </div>
                                        <lightning-input variant="label-hidden" label="出库单号" onchange={dataChange}
                                            data-field="deliveryOrderNo" value={deliveryOrderNo} class="inputFont"
                                            style="max-width: 150px;"></lightning-input>
                                    </div>
                                </div>
                            </lightning-layout-item>
                            <lightning-layout-item>
                                <div class="slds-text-align_center">
                                    <div class="slds-grid slds-grid_vertical-align-center">
                                        <div class="slds-form-element__label searchName">
                                            客户名
                                        </div>
                                        <lightning-input variant="label-hidden" label="客户名" onchange={dataChange}
                                            data-field="contactName" value={contactName} class="inputFont"
                                            style="max-width: 150px;"></lightning-input>
                                    </div>
                                </div>
                            </lightning-layout-item>
                        </lightning-layout>
                        <lightning-layout multiple-rows style="margin-top: 20px">
                            <lightning-layout-item size="6">
                                <lightning-layout multiple-rows>
                                    <lightning-layout-item size="6">
                                        <button
                                            class="slds-button slds-button_neutral slds-button_stretch  lexsearchStyle"
                                            onclick={searchConsumableorderdetailsJs} style="min-width: 180px;">
                                            还没出库的出库单
                                        </button>
                                    </lightning-layout-item>
                                    <lightning-layout-item size="6">
                                        <button
                                            class="slds-button slds-button_neutral slds-button_stretch  lexsearchStyle"
                                            onclick={searchOrderInstatusJs} style="min-width: 215px;">
                                            已出库未开票的出库单
                                        </button>
                                    </lightning-layout-item>
                                </lightning-layout>
                            </lightning-layout-item>
                            <lightning-layout-item size="3">
                                <button class="slds-button slds-button_neutral slds-button_stretch  lexsearchStyle"
                                    onclick={searchConsumableorFinishJs} style="min-width: 225px">
                                    已出库已开票的出库单
                                </button>
                            </lightning-layout-item>
                            <lightning-layout-item>
                                <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
                                    onclick={clearJs} style="width: 206px;">
                                    清空
                                </button>
                            </lightning-layout-item>
                        </lightning-layout>
                    <div
                      class="slds-form-element__label searchName"
                      style="visibility: hidden"
                    >
                      &#12288;到
                    </div>
                    <button
                      class="slds-button slds-button_neutral slds-button_stretch lexBorder lexBorderWidth"
                      onclick={editProductLimit}
                      style="margin-left: 4px"
                    >
                      上传已出库一览
                    </button>
                  </div>
                </div>
            </div>
            <div class="borderCss">
                <template if:true={isShowSpinner}>
                    <div class="slds-spinner_container">
                        <div role="status" class="slds-spinner slds-spinner_medium slds-spinner_brand">
                            <span class="slds-assistive-text">Loading</span>
                            <div class="slds-spinner__dot-a"></div>
                            <div class="slds-spinner__dot-b"></div>
                        </div>
                    </div>
                </template>
                <div class="headerDorderCss">
                    <lightning-layout>
                        <lightning-layout-item padding="around-small">
                            <p style="font-size: 18px">
                                <strong>出库单一览表</strong>
                            </p>
                        </lightning-layout-item>
                    </lightning-layout>
                </div>
                <template if:true={showTable}>
                    <div style="padding: 7px; height: 500px">
                        <lightning-datatable key-field="id" data={data} columns={columns}
                            hide-checkbox-column default-sort-direction={defaultSortDirection}
                            sorted-direction={sortDirection} sorted-by={sortedBy} onsort={onHandleSort}
                            class="wrapped-header-datatable">
                        </lightning-datatable>
                    </div>
                </template>
            </div>
              </lightning-layout-item>
            </lightning-layout>
            <!-- </div> -->
          </div>
        </div>
      </div>
      <div class="borderCss">
        <div class="headerDorderCss">
          <lightning-layout>
            <lightning-layout-item padding="around-small">
              <p style="font-size: 18px">
                <strong>检索条件</strong>
              </p>
            </lightning-layout-item>
          </lightning-layout>
        </div>
        <div style="padding: 15px">
          <div lwc:dom="manual" class="resultDiv"></div>
          <div draggable="false">
            <lightning-layout multiple-rows>
              <lightning-layout-item size="6">
                <div class="slds-text-align_center">
                  <lightning-layout multiple-rows>
                    <lightning-layout-item size="6">
                      <div class="slds-grid slds-grid_vertical-align-center">
                        <div class="slds-form-element__label searchName">
                          出库日&#12288;从
                        </div>
                        <lightning-input
                          type="date"
                          variant="label-hidden"
                          label="出库日 从"
                          onchange={dataChange}
                          data-field="deliveryFromDate"
                          value={deliveryFromDate}
                          class="inputFont"
                          style="max-width: 150px"
                        ></lightning-input>
                      </div>
                    </lightning-layout-item>
                    <lightning-layout-item size="6">
                      <div class="slds-grid slds-grid_vertical-align-center">
                        <div class="slds-form-element__label searchName">
                          到
                        </div>
                        <lightning-input
                          type="date"
                          variant="label-hidden"
                          label="到"
                          onchange={dataChange}
                          data-field="deliveryToDate"
                          value={deliveryToDate}
                          class="inputFont"
                          style="max-width: 150px"
                        ></lightning-input>
                      </div>
                    </lightning-layout-item>
                  </lightning-layout>
                </div>
              </lightning-layout-item>
              <lightning-layout-item size="3">
                <div class="slds-text-align_center">
                  <div class="slds-grid slds-grid_vertical-align-center">
                    <div class="slds-form-element__label searchName">
                      出库单号
                    </div>
                    <lightning-input
                      variant="label-hidden"
                      label="出库单号"
                      onchange={dataChange}
                      data-field="deliveryOrderNo"
                      value={deliveryOrderNo}
                      class="inputFont"
                      style="max-width: 150px"
                    ></lightning-input>
                  </div>
                </div>
              </lightning-layout-item>
              <lightning-layout-item>
                <div class="slds-text-align_center">
                  <div class="slds-grid slds-grid_vertical-align-center">
                    <div class="slds-form-element__label searchName">
                      客户名
                    </div>
                    <lightning-input
                      variant="label-hidden"
                      label="客户名"
                      onchange={dataChange}
                      data-field="contactName"
                      value={contactName}
                      class="inputFont"
                      style="max-width: 150px"
                    ></lightning-input>
                  </div>
                </div>
              </lightning-layout-item>
            </lightning-layout>
            <lightning-layout multiple-rows style="margin-top: 20px">
              <lightning-layout-item size="6">
                <lightning-layout multiple-rows>
                  <lightning-layout-item size="6">
                    <button
                      class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                      onclick={searchConsumableorderdetailsJs}
                      style="min-width: 180px"
                    >
                      还没出库的出库单
                    </button>
                  </lightning-layout-item>
                  <lightning-layout-item size="6">
                    <button
                      class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                      onclick={searchOrderInstatusJs}
                      style="min-width: 215px"
                    >
                      已出库未开票的出库单
                    </button>
                  </lightning-layout-item>
                </lightning-layout>
              </lightning-layout-item>
              <lightning-layout-item size="3">
                <button
                  class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                  onclick={searchConsumableorFinishJs}
                  style="min-width: 225px"
                >
                  已出库已开票的出库单
                </button>
              </lightning-layout-item>
              <lightning-layout-item>
                <button
                  class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
                  onclick={clearJs}
                  style="width: 206px"
                >
                  清空
                </button>
              </lightning-layout-item>
            </lightning-layout>
          </div>
        </div>
      </div>
      <div class="borderCss">
        <template if:true={isShowSpinner}>
          <div class="slds-spinner_container">
                       
            <div
              role="status"
              class="slds-spinner slds-spinner_medium slds-spinner_brand"
            >
                             
              <span class="slds-assistive-text">Loading</span>                
              <div class="slds-spinner__dot-a"></div>
                             
              <div class="slds-spinner__dot-b"></div>
                     
            </div>
                   
          </div>
        </template>
        <div class="headerDorderCss">
          <lightning-layout>
            <lightning-layout-item padding="around-small">
              <p style="font-size: 18px">
                <strong>出库单一览表</strong>
              </p>
            </lightning-layout-item>
          </lightning-layout>
        </div>
        <template if:true={showTable}>
          <div style="padding: 7px; height: 500px">
            <lightning-datatable
              key-field="id"
              data={data}
              columns={columns}
              hide-checkbox-column
              default-sort-direction={defaultSortDirection}
              sorted-direction={sortDirection}
              sorted-by={sortedBy}
              onsort={onHandleSort}
              class="wrapped-header-datatable"
            >
            </lightning-datatable>
          </div>
        </template>
      </div>
    </div>
</template>
  </div>
</template>
force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js
@@ -1,409 +1,427 @@
import { LightningElement, wire, api, track } from 'lwc';
import { NavigationMixin } from 'lightning/navigation';
import init from '@salesforce/apex/LexSaleAndDeliveryController.init';//cleanUp
import cleanUp from '@salesforce/apex/LexSaleAndDeliveryController.cleanUp';
import { LightningElement, wire, api, track } from "lwc";
import { NavigationMixin } from "lightning/navigation";
import init from "@salesforce/apex/LexSaleAndDeliveryController.init"; //cleanUp
import cleanUp from "@salesforce/apex/LexSaleAndDeliveryController.cleanUp";
import { ShowToastEvent } from "lightning/platformShowToastEvent";
import searchOrderInstatus from '@salesforce/apex/LexSaleAndDeliveryController.searchOrderInstatus';
import searchConsumableorderdetails from '@salesforce/apex/LexSaleAndDeliveryController.searchConsumableorderdetails';
import searchConsumableorFinish from '@salesforce/apex/LexSaleAndDeliveryController.searchConsumableorFinish';
//table css
import searchOrderInstatus from "@salesforce/apex/LexSaleAndDeliveryController.searchOrderInstatus";
import searchConsumableorderdetails from "@salesforce/apex/LexSaleAndDeliveryController.searchConsumableorderdetails";
import searchConsumableorFinish from "@salesforce/apex/LexSaleAndDeliveryController.searchConsumableorFinish";
//table css
import { loadStyle } from "lightning/platformResourceLoader";
import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
const columns = [
    {
        label: '出库日',
        fieldName: 'Outbound_Date__c',
        type: 'date',
        hideDefaultActions: true,
        sortable: true,
        wrapText: true,
  {
    label: "出库日",
    fieldName: "Outbound_Date__c",
    type: "date",
    hideDefaultActions: true,
    sortable: true,
    wrapText: true
  },
  {
    label: "出库单号",
    fieldName: "url",
    type: "url",
    initialWidth: 250,
    typeAttributes: {
      label: {
        fieldName: "Name"
      },
      target: "_blank"
    },
    {
        label: '出库单号',
        fieldName: 'url',
        type: 'url',
        typeAttributes: {
            label: {
                fieldName: 'Name'
            },
            target: '_blank'
        },
        hideDefaultActions: true,
        sortable: true,
        wrapText: true,
    hideDefaultActions: true,
    sortable: true,
    wrapText: true
  },
  {
    label: "客户名",
    fieldName: "ShipmentAccount__c",
    hideDefaultActions: true,
    initialWidth: 250,
    wrapText: true,
    sortable: true
  },
  {
    label: "科室",
    fieldName: "Order_ForCustomerText__c",
    hideDefaultActions: true,
    initialWidth: 130,
    wrapText: true
  },
  {
    label: "出库单状态",
    fieldName: "SummonsStatus_c__c",
    hideDefaultActions: true,
    sortable: true,
    wrapText: true
  },
  {
    label: "开票状态",
    fieldName: "Billed_Status__c",
    hideDefaultActions: true,
    initialWidth: 130,
    sortable: true,
    wrapText: true
  },
  {
    label: "未发票金额(元)",
    fieldName: "InvoiceNotPro_money__c",
    hideDefaultActions: true,
    type: "number",
    typeAttributes: {
      minimumFractionDigits: 2
    },
    {
        label: '客户名',
        fieldName: 'ShipmentAccount__c',
        hideDefaultActions: true,
        wrapText: true,
        sortable: true
    },
    {
        label: '科室',
        fieldName: 'Order_ForCustomerText__c',
        hideDefaultActions: true,
        wrapText: true,
    },
    {
        label: '出库单状态',
        fieldName: 'SummonsStatus_c__c',
        hideDefaultActions: true,
        sortable: true,
        wrapText: true,
    },
    {
        label: '开票状态',
        fieldName: 'Billed_Status__c',
        hideDefaultActions: true,
        sortable: true,
        wrapText: true,
    },
    {
        label: '未发票金额(元)',
        fieldName: 'InvoiceNotPro_money__c',
        hideDefaultActions: true,
        type: "number",
        typeAttributes: {
            minimumFractionDigits: 2,
        },
        wrapText: true,
    },
    {
        label: '创建日期',
        fieldName: 'CreatedDate',
        hideDefaultActions: true,
        sortable: true,
        wrapText: true,
        type: "date",
        typeAttributes: {
            timeZone: "Asia/Shanghai",
            day: "numeric",
            month: "numeric",
            year: "numeric",
            hour: "2-digit",
            minute: "2-digit"
        },
    wrapText: true
  },
  {
    label: "创建日期",
    fieldName: "CreatedDate",
    hideDefaultActions: true,
    sortable: true,
    wrapText: true,
    type: "date",
    typeAttributes: {
      timeZone: "Asia/Shanghai",
      day: "numeric",
      month: "numeric",
      year: "numeric",
      hour: "2-digit",
      minute: "2-digit"
    }
  }
];
export default class LexSaleAndDelivery extends NavigationMixin(LightningElement) {
    columns = columns;
    @track isShowSpinner = true;
    @track message = '';
    @track deliveryFromDate = '';
    @track deliveryToDate = '';
    @track deliveryOrderNo = '';
    @track contactName = '';
    @track data = [];
    @track userinfoId = '';
    @track accountid = '';
    @track agencyProType = '';
    @track userWorkLocation = '';
    @track showTable = false;
    @track hidecheckboxcolumn = true;
export default class LexSaleAndDelivery extends NavigationMixin(
  LightningElement
) {
  columns = columns;
  @track isShowSpinner = true;
  @track message = "";
  @track deliveryFromDate = "";
  @track deliveryToDate = "";
  @track deliveryOrderNo = "";
  @track contactName = "";
  @track data = [];
  @track userinfoId = "";
  @track accountid = "";
  @track agencyProType = "";
  @track userWorkLocation = "";
  @track showTable = false;
  @track hidecheckboxcolumn = true;
    //排序
    defaultSortDirection = 'asc';
    sortDirection = 'asc';
    sortedBy;
  //排序
  defaultSortDirection = "asc";
  sortDirection = "asc";
  sortedBy;
    stylesLoaded = false;
    renderedCallback() {
        if (!this.stylesLoaded) {
            Promise.all([loadStyle(this, WrappedHeaderTable)])
                .then(() => {
                    console.log("Custom styles loaded");
                    this.stylesLoaded = true;
                })
                .catch((error) => {
                    console.error("Error loading custom styles");
                });
        }
    }
    connectedCallback() {
        init().then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log('r = ' + JSON.stringify(r));
            if (r.status == 'Success') {
                this.userinfoId = r.entity.userinfoId;
                this.accountid = r.entity.accountid;
                this.agencyProType = r.entity.agencyProType;
                this.userWorkLocation = r.entity.userWorkLocation;
                this.data = r.entity.raesList;
                for (var i in this.data) {
                    this.data[i]['url'] = '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
                }
                console.log('this.data = ' + JSON.stringify(this.data));
                this.isShowSpinner = false;
                this.showTable = true;
            } else {
                console.log('r = ' + JSON.stringify(r))
                this.showMyToast('初始化失败', r.msg,'Error');
            }
        }).catch((error) => {
            console.log('error = ' + JSON.stringify(error))
            this.showMyToast('错误', '初始化失败','Error');
  stylesLoaded = false;
  renderedCallback() {
    if (!this.stylesLoaded) {
      Promise.all([loadStyle(this, WrappedHeaderTable)])
        .then(() => {
          console.log("Custom styles loaded");
          this.stylesLoaded = true;
        })
    }
    //新建出库单
    neworderhead() {
        this[NavigationMixin.Navigate]({
            type: 'standard__webPage',
            attributes: {
                url: '/lexsummonscreat'
            }
        .catch((error) => {
          console.error("Error loading custom styles");
        });
    }
  }
    //已出库未开票的出库单
    searchOrderInstatusJs() {
        this.isShowSpinner = true;
        this.showTable = false;
        console.log('searchOrderInstatusJs');
        searchOrderInstatus({
            orderDate: this.deliveryFromDate,
            deliverDate: this.deliveryToDate,
            accountid: this.accountid,
            agencyProType: this.agencyProType,
            userWorkLocation: this.userWorkLocation,
            category1: this.deliveryOrderNo,
            category2: this.contactName
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log('r = ' + JSON.stringify(r));
            if (r.status == 'Success') {
                this.data = r.entity.raesList;
                for (var i in this.data) {
                    this.data[i]['url'] = '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
                }
                this.message = r.msg;
                if (this.message == '没有搜索到相关出库单') {
                    this.showMyToast('搜索失败', this.message,'Error');
                } else {
                    this.showMyToast('搜索成功', this.message,'Success');
                }
                this.isShowSpinner = false;
                //this.isCssLoaded = true
                this.showTable = true;
            } else {
                this.showMyToast('错误',  r.msg,'Error');
            }
        }).catch((error) => {
            console.log('error = ' + JSON.stringify(error))
        })
    }
    //还没出库的出库单
    searchConsumableorderdetailsJs() {
        this.isShowSpinner = true;
        this.showTable = false;
        console.log('searchConsumableorderdetailsJs');
        console.log('this.deliveryFromDate = ' + this.deliveryFromDate);
        console.log('this.deliveryToDate = ' + this.deliveryToDate);
        searchConsumableorderdetails({
            orderDate: this.deliveryFromDate,
            deliverDate: this.deliveryToDate,
            accountid: this.accountid,
            agencyProType: this.agencyProType,
            userWorkLocation: this.userWorkLocation,
            category1: this.deliveryOrderNo,
            category2: this.contactName
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log('r = ' + JSON.stringify(r));
            if (r.status == 'Success') {
                this.data = r.entity.raesList;
                for (var i in this.data) {
                    this.data[i]['url'] = '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
                }
                this.message = r.msg;
                if (this.message == '没有搜索到相关出库单') {
                    this.showMyToast('搜索失败', this.message,'Error');
                } else {
                    this.showMyToast('搜索成功', this.message,'Success');
                }
                this.isShowSpinner = false;
                this.showTable = true;
            } else {
                this.showMyToast('搜索失败', r.msg,'Error');
            }
        }).catch((error) => {
            console.log('error = ' + JSON.stringify(error))
            this.showMyToast('搜索失败', '搜索还没出库的出库单出错','Error');
        })
    }
    //已出库已开票的出库单
    searchConsumableorFinishJs() {
        this.isShowSpinner = true;
        this.showTable = false;
        console.log('searchConsumableorFinishJs');
        searchConsumableorFinish({
            orderDate: this.deliveryFromDate,
            deliverDate: this.deliveryToDate,
            accountid: this.accountid,
            agencyProType: this.agencyProType,
            userWorkLocation: this.userWorkLocation,
            category1: this.deliveryOrderNo,
            category2: this.contactName
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log('r = ' + JSON.stringify(r));
            if (r.status == 'Success') {
                this.data = r.entity.raesList;
                for (var i in this.data) {
                    this.data[i]['url'] = '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
                }
                this.message = r.msg;
                if (this.message == '没有搜索到相关出库单') {
                    this.showMyToast('搜索失败', this.message,'Error');
                } else {
                    this.showMyToast('搜索成功', this.message,'Success');
                }
                this.isShowSpinner = false;
                this.showTable = true;
            } else {
                this.showMyToast('搜索失败', r.msg,'Error');
            }
        }).catch((error) => {
            console.log('error = ' + JSON.stringify(error))
            this.showMyToast('搜索失败', '搜索已出库已开票的出库单出错','Error');
        })
    }
    //清空
    clearJs() {
        this.deliveryFromDate = '';
        this.deliveryToDate = '';
        this.deliveryOrderNo = '';
        this.contactName = '';
        this.isShowSpinner = true;
        this.showTable = false;
        cleanUp({
            accountid: this.accountid,
            agencyProType: this.agencyProType,
            userWorkLocation: this.userWorkLocation,
        }).then((r) => {
            r = JSON.parse(JSON.stringify(r));
            console.log('r = ' + JSON.stringify(r));
            if (r.status == 'Success') {
                this.data = r.entity.raesList;
                for (var i in this.data) {
                    this.data[i]['url'] = '/s/lexsummonscreat?ESetid=' + this.data[i].Id;
                }
                this.message = r.msg;
                if (this.message == '没有搜索到相关出库单') {
                    this.showMyToast('搜索失败', this.message,'Error');
                } else {
                    this.showMyToast('搜索成功', this.message,'Success');
                }
                this.isShowSpinner = false;
                this.showTable = true;
            } else {
                this.showMyToast('搜索失败', r.msg,'Error');
            }
        }).catch((error) => {
            console.log('error = ' + JSON.stringify(error))
            this.showMyToast('搜索失败', '搜索失败','Error');
        })
    }
    //Capture the event fired from the paginator component
    handlePaginatorChange(event) {
        this.recordsToDisplay = event.detail.recordsToDisplay;
        this.preSelected = event.detail.preSelected;
        if (this.recordsToDisplay && this.recordsToDisplay > 0) {
            this.rowNumberOffset = this.recordsToDisplay[0].rowNumber - 1;
  connectedCallback() {
    init()
      .then((r) => {
        r = JSON.parse(JSON.stringify(r));
        console.log("r = " + JSON.stringify(r));
        if (r.status == "Success") {
          this.userinfoId = r.entity.userinfoId;
          this.accountid = r.entity.accountid;
          this.agencyProType = r.entity.agencyProType;
          this.userWorkLocation = r.entity.userWorkLocation;
          this.data = r.entity.raesList;
          for (var i in this.data) {
            this.data[i]["url"] =
              "/s/lexsummonscreat?ESetid=" + this.data[i].Id;
          }
          console.log("this.data = " + JSON.stringify(this.data));
          this.isShowSpinner = false;
          this.showTable = true;
        } else {
            this.rowNumberOffset = 0;
          console.log("r = " + JSON.stringify(r));
          this.showMyToast("初始化失败", r.msg, "Error");
        }
      })
      .catch((error) => {
        console.log("error = " + JSON.stringify(error));
        this.showMyToast("错误", "初始化失败", "Error");
      });
  }
  //新建出库单
  neworderhead() {
    this[NavigationMixin.Navigate]({
      type: "standard__webPage",
      attributes: {
        url: "/lexsummonscreat"
      }
    });
  }
  //已出库未开票的出库单
  searchOrderInstatusJs() {
    this.isShowSpinner = true;
    this.showTable = false;
    console.log("searchOrderInstatusJs");
    searchOrderInstatus({
      orderDate: this.deliveryFromDate,
      deliverDate: this.deliveryToDate,
      accountid: this.accountid,
      agencyProType: this.agencyProType,
      userWorkLocation: this.userWorkLocation,
      category1: this.deliveryOrderNo,
      category2: this.contactName
    })
      .then((r) => {
        r = JSON.parse(JSON.stringify(r));
        console.log("r = " + JSON.stringify(r));
        if (r.status == "Success") {
          this.data = r.entity.raesList;
          for (var i in this.data) {
            this.data[i]["url"] =
              "/s/lexsummonscreat?ESetid=" + this.data[i].Id;
          }
          this.message = r.msg;
          if (this.message == "没有搜索到相关出库单") {
            this.showMyToast("搜索失败", this.message, "Error");
          } else {
            this.showMyToast("搜索成功", this.message, "Success");
          }
          this.isShowSpinner = false;
          //this.isCssLoaded = true
          this.showTable = true;
        } else {
          this.showMyToast("错误", r.msg, "Error");
        }
      })
      .catch((error) => {
        console.log("error = " + JSON.stringify(error));
      });
  }
  //还没出库的出库单
  searchConsumableorderdetailsJs() {
    this.isShowSpinner = true;
    this.showTable = false;
    console.log("searchConsumableorderdetailsJs");
    console.log("this.deliveryFromDate = " + this.deliveryFromDate);
    console.log("this.deliveryToDate = " + this.deliveryToDate);
    searchConsumableorderdetails({
      orderDate: this.deliveryFromDate,
      deliverDate: this.deliveryToDate,
      accountid: this.accountid,
      agencyProType: this.agencyProType,
      userWorkLocation: this.userWorkLocation,
      category1: this.deliveryOrderNo,
      category2: this.contactName
    })
      .then((r) => {
        r = JSON.parse(JSON.stringify(r));
        console.log("r = " + JSON.stringify(r));
        if (r.status == "Success") {
          this.data = r.entity.raesList;
          for (var i in this.data) {
            this.data[i]["url"] =
              "/s/lexsummonscreat?ESetid=" + this.data[i].Id;
          }
          this.message = r.msg;
          if (this.message == "没有搜索到相关出库单") {
            this.showMyToast("搜索失败", this.message, "Error");
          } else {
            this.showMyToast("搜索成功", this.message, "Success");
          }
          this.isShowSpinner = false;
          this.showTable = true;
        } else {
          this.showMyToast("搜索失败", r.msg, "Error");
        }
      })
      .catch((error) => {
        console.log("error = " + JSON.stringify(error));
        this.showMyToast("搜索失败", "搜索还没出库的出库单出错", "Error");
      });
  }
  //已出库已开票的出库单
  searchConsumableorFinishJs() {
    this.isShowSpinner = true;
    this.showTable = false;
    console.log("searchConsumableorFinishJs");
    searchConsumableorFinish({
      orderDate: this.deliveryFromDate,
      deliverDate: this.deliveryToDate,
      accountid: this.accountid,
      agencyProType: this.agencyProType,
      userWorkLocation: this.userWorkLocation,
      category1: this.deliveryOrderNo,
      category2: this.contactName
    })
      .then((r) => {
        r = JSON.parse(JSON.stringify(r));
        console.log("r = " + JSON.stringify(r));
        if (r.status == "Success") {
          this.data = r.entity.raesList;
          for (var i in this.data) {
            this.data[i]["url"] =
              "/s/lexsummonscreat?ESetid=" + this.data[i].Id;
          }
          this.message = r.msg;
          if (this.message == "没有搜索到相关出库单") {
            this.showMyToast("搜索失败", this.message, "Error");
          } else {
            this.showMyToast("搜索成功", this.message, "Success");
          }
          this.isShowSpinner = false;
          this.showTable = true;
        } else {
          this.showMyToast("搜索失败", r.msg, "Error");
        }
      })
      .catch((error) => {
        console.log("error = " + JSON.stringify(error));
        this.showMyToast("搜索失败", "搜索已出库已开票的出库单出错", "Error");
      });
  }
  //清空
  clearJs() {
    this.deliveryFromDate = "";
    this.deliveryToDate = "";
    this.deliveryOrderNo = "";
    this.contactName = "";
    this.isShowSpinner = true;
    this.showTable = false;
    cleanUp({
      accountid: this.accountid,
      agencyProType: this.agencyProType,
      userWorkLocation: this.userWorkLocation
    })
      .then((r) => {
        r = JSON.parse(JSON.stringify(r));
        console.log("r = " + JSON.stringify(r));
        if (r.status == "Success") {
          this.data = r.entity.raesList;
          for (var i in this.data) {
            this.data[i]["url"] =
              "/s/lexsummonscreat?ESetid=" + this.data[i].Id;
          }
          this.message = r.msg;
          if (this.message == "没有搜索到相关出库单") {
            this.showMyToast("搜索失败", this.message, "Error");
          } else {
            this.showMyToast("搜索成功", this.message, "Success");
          }
          this.isShowSpinner = false;
          this.showTable = true;
        } else {
          this.showMyToast("搜索失败", r.msg, "Error");
        }
      })
      .catch((error) => {
        console.log("error = " + JSON.stringify(error));
        this.showMyToast("搜索失败", "搜索失败", "Error");
      });
  }
  //Capture the event fired from the paginator component
  handlePaginatorChange(event) {
    this.recordsToDisplay = event.detail.recordsToDisplay;
    this.preSelected = event.detail.preSelected;
    if (this.recordsToDisplay && this.recordsToDisplay > 0) {
      this.rowNumberOffset = this.recordsToDisplay[0].rowNumber - 1;
    } else {
      this.rowNumberOffset = 0;
    }
  }
    //排序
    onHandleSort(event) {
        const { fieldName: sortedBy, sortDirection } = event.detail;
        const cloneData = [...this.data];
        cloneData.sort(this.sortBy(sortedBy, sortDirection === 'asc' ? 1 : -1));
        this.data = cloneData;
        this.sortDirection = sortDirection;
        this.sortedBy = sortedBy;
    }
  //排序
  onHandleSort(event) {
    const { fieldName: sortedBy, sortDirection } = event.detail;
    const cloneData = [...this.data];
    cloneData.sort(this.sortBy(sortedBy, sortDirection === "asc" ? 1 : -1));
    this.data = cloneData;
    this.sortDirection = sortDirection;
    this.sortedBy = sortedBy;
  }
    sortBy(field, reverse, primer) {
        const key = primer
            ? function (x) {
                return primer(x[field]);
            }
            : function (x) {
                return x[field];
            };
        return function (a, b) {
            a = key(a);
            b = key(b);
            return reverse * ((a > b) - (b > a));
  sortBy(field, reverse, primer) {
    const key = primer
      ? function (x) {
          return primer(x[field]);
        }
      : function (x) {
          return x[field];
        };
    return function (a, b) {
      a = key(a);
      b = key(b);
      return reverse * ((a > b) - (b > a));
    };
  }
  dataChange(event) {
    let fieldName = event.target.getAttribute("data-field");
    let value = event.detail.value;
    switch (fieldName) {
      case "deliveryFromDate":
        this.deliveryFromDate = value;
        break;
      case "deliveryToDate":
        this.deliveryToDate = value;
        break;
      case "deliveryOrderNo":
        this.deliveryOrderNo = value;
        break;
      case "contactName":
        this.contactName = value;
        break;
      default:
        console.log("no data");
    }
  }
  editProductLimit() {
    this[NavigationMixin.Navigate]({
      type: "standard__webPage",
      attributes: {
        url: "/lexoutboundorderimport"
      }
    });
  }
    dataChange(event) {
        let fieldName = event.target.getAttribute("data-field");
        let value = event.detail.value;
        switch (fieldName) {
            case 'deliveryFromDate':
                this.deliveryFromDate = value;
                break
            case 'deliveryToDate':
                this.deliveryToDate = value;
                break
            case 'deliveryOrderNo':
                this.deliveryOrderNo = value;
                break
            case 'contactName':
                this.contactName = value;
                break
            default:
                console.log('no data');
        }
  showMyToast(title, message, variant) {
    this.isShowSpinner = false;
    console.log("show custom message");
    var iconName = "";
    var content = "";
    if (variant.toLowerCase() == "success") {
      iconName = "utility:check";
    } else {
      iconName = "utility:error";
    }
    editProductLimit() {
        this[NavigationMixin.Navigate]({
            type: 'standard__webPage',
            attributes: {
                url: '/lexoutboundorderimport'
            }
        });
    if (message != "") {
      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);
  }
    showMyToast(title, message, variant) {
        this.isShowSpinner = false;
        console.log('show custom message');
        var iconName = '';
        var content = '';
        if (variant.toLowerCase() == 'success') {
            iconName = 'utility:check';
        } else {
            iconName = 'utility:error';
        }
        if (message != '') {
            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);
    }
    @track isModalOpen = false;
    openModal() {
        this.isModalOpen = true;
    }
}
  @track isModalOpen = false;
  openModal() {
    this.isModalOpen = true;
  }
}
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.html
@@ -1,901 +1,1299 @@
<!-- sldsValidatorIgnore -->
<!-- sldsValidatorIgnore -->
<template>
    <c-common-toast></c-common-toast>
    <template if:true={isShowSpinner}>
        <div class="slds-spinner_container">
            <div role="status" class="slds-spinner slds-spinner_medium slds-spinner_brand">
                <span class="slds-assistive-text">Loading</span>
                <div class="slds-spinner__dot-a"></div>
                <div class="slds-spinner__dot-b"></div>
            </div>
        </div>
    </template>
    <!-- 搜索客户名 -->
    <template if:true={isModalOpen}>
        <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true"
            aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open slds-modal_medium"
            style="border: 1px solid #D4D4D4;">
            <div class="slds-modal__container">
                <header class="slds-modal__header" style="background-color: #F3F3F3;">
                    <button style="" class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
                        title="Close" onclick={closeModal}>
                        <lightning-icon icon-name="utility:close" alternative-text="close" variant="inverse"
                            size="small"></lightning-icon>
                        <span class="slds-assistive-text">Close</span>
                    </button>
                    <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">经销商医院检索</h2>
                </header>
                <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1"
                    style="border: 1px solid #F3F3F3;">
                    <table style="width: 100%;">
                        <tbody>
                            <tr>
                                <td style="width: 74px;">
                                    <div style="color:#696969;font-size:16px;text-align: left;">医院名称</div>
                                </td>
                                <td style="width: 60%;"><lightning-input class="inputFont" label="医院名称"
                                        variant="label-hidden" placeholder="请输入医院名称" value={searchHospitalName}
                                        data-field="searchHospitalName" onchange={dataChange}></lightning-input></td>
                                <td style="width: 10px;"></td>
                                <td><button class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                                        style="height: 32px;" label="搜索" onclick={searchHospital}>搜索</button></td>
                            </tr>
                        </tbody>
                    </table>
                    <p style="height: 20px;"></p>
                    <!-- <p>已选择医院:{chooseHospital}</p> -->
                    <div
                        style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
                        <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
                            <lightning-layout>
                                <lightning-layout-item padding="around-small">
                                    <p style="font-size: 18px">
                                        <strong>搜索结果</strong>
                                    </p>
                                </lightning-layout-item>
                            </lightning-layout>
                            <!-- <p style="font-size: 16px;"><strong>搜索结果</strong></p> -->
                        </div>
                        <div class="myTable" style="padding:10px;">
                            <!-- <lightning-datatable class="wrapped-header-datatable" key-field="id"
  <c-common-toast></c-common-toast>
  <template if:true={isShowSpinner}>
    <div class="slds-spinner_container">
                 
      <div
        role="status"
        class="slds-spinner slds-spinner_medium slds-spinner_brand"
      >
                        <span class="slds-assistive-text">Loading</span>        
               
        <div class="slds-spinner__dot-a"></div>
                       
        <div class="slds-spinner__dot-b"></div>
               
      </div>
             
    </div>
  </template>
  <!-- 搜索客户名 -->
  <template if:true={isModalOpen}>
    <section
      role="dialog"
      tabindex="-1"
      aria-labelledby="modal-heading-01"
      aria-modal="true"
      aria-describedby="modal-content-id-1"
      class="slds-modal slds-fade-in-open slds-modal_medium"
      style="border: 1px solid #d4d4d4"
    >
      <div class="slds-modal__container">
        <header class="slds-modal__header" style="background-color: #f3f3f3">
          <button
            style=""
            class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
            title="Close"
            onclick={closeModal}
          >
            <lightning-icon
              icon-name="utility:close"
              alternative-text="close"
              variant="inverse"
              size="small"
            ></lightning-icon>
            <span class="slds-assistive-text">Close</span>
          </button>
          <h2
            id="modal-heading-01"
            class="slds-text-heading_medium slds-hyphenate"
          >
            经销商医院检索
          </h2>
        </header>
        <div
          class="slds-modal__content slds-p-around_medium"
          id="modal-content-id-1"
          style="border: 1px solid #f3f3f3"
        >
          <table style="width: 100%">
            <tbody>
              <tr>
                <td style="width: 74px">
                  <div
                    style="color: #696969; font-size: 16px; text-align: left"
                  >
                    医院名称
                  </div>
                </td>
                <td style="width: 60%">
                  <lightning-input
                    class="inputFont"
                    label="医院名称"
                    variant="label-hidden"
                    placeholder="请输入医院名称"
                    value={searchHospitalName}
                    data-field="searchHospitalName"
                    onchange={dataChange}
                  ></lightning-input>
                </td>
                <td style="width: 10px"></td>
                <td>
                  <button
                    class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                    style="height: 32px"
                    label="搜索"
                    onclick={searchHospital}
                  >
                    搜索
                  </button>
                </td>
              </tr>
            </tbody>
          </table>
          <p style="height: 20px"></p>
          <!-- <p>已选择医院:{chooseHospital}</p> -->
          <div
            style="
              border: 1px solid #d4d4d4;
              border-top: 3px solid #51606e;
              border-radius: 5px;
              margin-bottom: 7px;
            "
          >
            <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
              <lightning-layout>
                <lightning-layout-item padding="around-small">
                  <p style="font-size: 18px">
                    <strong>搜索结果</strong>
                  </p>
                </lightning-layout-item>
              </lightning-layout>
              <!-- <p style="font-size: 16px;"><strong>搜索结果</strong></p> -->
            </div>
            <div class="myTable" style="padding: 10px">
              <!-- <lightning-datatable class="wrapped-header-datatable" key-field="id"
                                hide-checkbox-column="true" data={hospitalList} columns={hosCols}
                                onrowaction={chooseHos}></lightning-datatable> -->
                            <lightning-datatable class="datatabel slds-border_top wrapped-header-datatable"
                                key-field="id" data={hospitalList} columns={hospitalColumns} hide-checkbox-column="true"
                                onrowaction={searchHandleRowAction}>
                            </lightning-datatable>
                        </div>
                    </div>
                </div>
                <footer class="slds-modal__footer">
                    <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" label="取消"
                        onclick={closeModal}>取消</button>
                </footer>
              <lightning-datatable
                class="datatabel slds-border_top wrapped-header-datatable"
                key-field="id"
                data={hospitalList}
                columns={hospitalColumns}
                hide-checkbox-column="true"
                onrowaction={searchHandleRowAction}
              >
              </lightning-datatable>
            </div>
        </section>
        <div class="slds-backdrop slds-backdrop_open"></div>
    </template>
          </div>
        </div>
        <footer class="slds-modal__footer">
          <button
            class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
            label="取消"
            onclick={closeModal}
          >
            取消
          </button>
        </footer>
      </div>
    </section>
    <div class="slds-backdrop slds-backdrop_open"></div>
  </template>
    <!-- 上传附件弹窗 -->
    <template if:true={showAttPop}>
        <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true"
            aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open slds-modal_small"
            style="border: 1px solid #D4D4D4;">
            <template if:true={showPopSpinner}>
                <lightning-spinner size="medium" variant="brand"></lightning-spinner>
            </template>
            <div class="slds-modal__container">
                <header class="slds-modal__header" style="background-color: #F3F3F3;">
                    <button style="" class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
                        title="Close" onclick={closePop}>
                        <lightning-icon icon-name="utility:close" alternative-text="close" variant="inverse"
                            size="small"></lightning-icon>
                        <span class="slds-assistive-text">Close</span>
                    </button>
                    <h2 id="modal-heading-02" class="slds-text-heading_medium slds-hyphenate">上传附件</h2>
                </header>
                <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-2"
                    style="border: 1px solid #F3F3F3;">
                    <div class="slds-m-top_medium slds-m-bottom_x-large">
                        <div class="slds-p-around_medium lgc-bg">
                            <lightning-input class="fileUpload" type="file" label="附件上传"
                                accept=".xlsx, .xls, .csv, .png, .doc, .docx, .pdf"
                                onchange={attChange}></lightning-input>
                        </div>
                        <p  style="font-size: 16px;">已选择文件:{fileName} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <template if:true={attDelBtn}>
                                <a onclick={removeAtt}>移除</a>
                            </template>
                        </p>
                    </div>
                </div>
                <footer class="slds-modal__footer">
                    <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="取消"
  <!-- 上传附件弹窗 -->
  <template if:true={showAttPop}>
    <section
      role="dialog"
      tabindex="-1"
      aria-labelledby="modal-heading-01"
      aria-modal="true"
      aria-describedby="modal-content-id-1"
      class="slds-modal slds-fade-in-open slds-modal_small"
      style="border: 1px solid #d4d4d4"
    >
      <template if:true={showPopSpinner}>
        <lightning-spinner size="medium" variant="brand"></lightning-spinner>
      </template>
      <div class="slds-modal__container">
        <header class="slds-modal__header" style="background-color: #f3f3f3">
          <button
            style=""
            class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
            title="Close"
            onclick={closePop}
          >
            <lightning-icon
              icon-name="utility:close"
              alternative-text="close"
              variant="inverse"
              size="small"
            ></lightning-icon>
            <span class="slds-assistive-text">Close</span>
          </button>
          <h2
            id="modal-heading-02"
            class="slds-text-heading_medium slds-hyphenate"
          >
            上传附件
          </h2>
        </header>
        <div
          class="slds-modal__content slds-p-around_medium"
          id="modal-content-id-2"
          style="border: 1px solid #f3f3f3"
        >
          <div class="slds-m-top_medium slds-m-bottom_x-large">
            <div class="slds-p-around_medium lgc-bg">
              <lightning-input
                class="fileUpload"
                type="file"
                label="附件上传"
                accept=".xlsx, .xls, .csv, .png, .doc, .docx, .pdf"
                onchange={attChange}
              ></lightning-input>
            </div>
            <p style="font-size: 16px">
              已选择文件:{fileName} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
              <template if:true={attDelBtn}>
                <a onclick={removeAtt}>移除</a>
              </template>
            </p>
          </div>
        </div>
        <footer class="slds-modal__footer">
          <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="取消"
                        onclick={closePop}></lightning-button>
                    <lightning-button style="margin-left: 10px;" variant="neutral" label="上传"
                        onclick={handleSave}></lightning-button> -->
                    <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" style="margin-left: 10px;" label="取消"
                        onclick={closePop}>取消</button>
                    <button class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle" style="margin-left: 10px;" label="上传"
                        onclick={handleSave}>上传</button>
                </footer>
            </div>
        </section>
        <div class="slds-backdrop slds-backdrop_open"></div>
    </template>
          <button
            class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
            style="margin-left: 10px"
            label="取消"
            onclick={closePop}
          >
            取消
          </button>
          <button
            class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
            style="margin-left: 10px"
            label="上传"
            onclick={handleSave}
          >
            上传
          </button>
        </footer>
      </div>
    </section>
    <div class="slds-backdrop slds-backdrop_open"></div>
  </template>
    <div class="outerBorderCss">
        <div style="padding: 5px">
            <template if:false={isShippingSales}>
                <!-- 按钮 -->
                <div class="borderCss">
                    <div style="padding: 15px">
                        <div lwc:dom="manual" class="resultDiv"></div>
                        <div draggable="false">
                            <table>
                                <colgroup>
                                    <col width="150px" />
                                    <col width="310px" />
                                    <col width="310px" />
                                    <col width="310px" />
                                    <col width="200px" />
                                    <col width="200px" />
                                    <col width="90px" />
                                    <col width="100px" />
                                    <col width="10px" />
                                    <col width="85px" />
                                    <col width="100px" />
                                    <col width="10px" />
                                    <col width="70px" />
                                    <col width="100px" />
                                </colgroup>
                                <tr>
                                    <td>
                                        <template if:true={isSaveShow}>
                                            <!-- <lightning-button label="保存" onclick={saveConfirmJs}
  <div class="outerBorderCss">
    <div style="padding: 5px">
      <template if:false={isShippingSales}>
        <!-- 按钮 -->
        <div class="borderCss">
          <div style="padding: 15px">
            <div lwc:dom="manual" class="resultDiv"></div>
            <div draggable="false">
              <table>
                <colgroup>
                  <col width="150px" />
                  <col width="310px" />
                  <col width="310px" />
                  <col width="310px" />
                  <col width="200px" />
                  <col width="200px" />
                  <col width="90px" />
                  <col width="100px" />
                  <col width="10px" />
                  <col width="85px" />
                  <col width="100px" />
                  <col width="10px" />
                  <col width="70px" />
                  <col width="100px" />
                </colgroup>
                <tr>
                  <td>
                    <template if:true={isSaveShow}>
                      <!-- <lightning-button label="保存" onclick={saveConfirmJs}
                                                style="width: 150px"></lightning-button> -->
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                                onclick={saveConfirmJs}>保存</button>
                                        </template>
                                    </td>
                                    <td colspan="4">
                                        <!-- <template if:true={isSaveShow}>
                      <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        onclick={saveConfirmJs}
                      >
                        保存
                      </button>
                    </template>
                  </td>
                  <td colspan="4">
                    <!-- <template if:true={isSaveShow}>
                                            <lightning-button label="保存" onclick={saveConfirmJs}
                                                style="width: 150px"></lightning-button>
                                        </template> -->
                                    </td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td>
                                        <template if:true={isEditShow}>
                                            <!-- <lightning-button label="编辑出库单" onclick={EditConsumable}
                  </td>
                </tr>
                <tr>
                  <td></td>
                  <td>
                    <template if:true={isEditShow}>
                      <!-- <lightning-button label="编辑出库单" onclick={EditConsumable}
                                                style="width: 150px" disabled={isEditDisabled}></lightning-button> -->
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                                onclick={EditConsumable} disabled={isEditDisabled}>编辑出库单</button>
                                        </template>
                                    </td>
                      <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        onclick={EditConsumable}
                        disabled={isEditDisabled}
                      >
                        编辑出库单
                      </button>
                    </template>
                  </td>
                                    <td>
                                        <template if:true={isDeliveryShow}>
                                            <!-- <lightning-button label="出货/销售" onclick={GoodsDeliveryJs}
                  <td>
                    <template if:true={isDeliveryShow}>
                      <!-- <lightning-button label="出货/销售" onclick={GoodsDeliveryJs}
                                                style="width: 150px;" disabled={isDeliveryDisabled}></lightning-button> -->
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                                onclick={GoodsDeliveryJs} disabled={isDeliveryDisabled}>出货/销售</button>
                                        </template>
                                    </td>
                      <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        onclick={GoodsDeliveryJs}
                        disabled={isDeliveryDisabled}
                      >
                        出货/销售
                      </button>
                    </template>
                  </td>
                                    <td>
                                        <template if:true={isOpenToInvoiceShow}>
                                            <!-- <lightning-button label="开票" onclick={openToInvoiceJs} style="width: 150px"
                  <td>
                    <template if:true={isOpenToInvoiceShow}>
                      <!-- <lightning-button label="开票" onclick={openToInvoiceJs} style="width: 150px"
                                                disabled={isOpenToInvoiceDisabled}></lightning-button> -->
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                                onclick={openToInvoiceJs} disabled={isOpenToInvoiceDisabled}>开票</button>
                                        </template>
                                    </td>
                      <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        onclick={openToInvoiceJs}
                        disabled={isOpenToInvoiceDisabled}
                      >
                        开票
                      </button>
                    </template>
                  </td>
                                    <td>
                                        <template if:false={EditAble}>
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                                onclick={uploadOrder}>上传附件</button>
                                        </template>
                                    </td>
                                </tr>
                                <tr style="height: 5px;"></tr>
                                <tr>
                                    <td></td>
                                    <td>
                                        <template if:true={isPraseToPDFShow}>
                                            <!-- <lightning-button label="打印指示单" onclick={PraseToPDFJs} style="width: 150px"
                  <td>
                    <template if:false={EditAble}>
                      <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        onclick={uploadOrder}
                      >
                        上传附件
                      </button>
                    </template>
                  </td>
                </tr>
                <tr style="height: 5px"></tr>
                <tr>
                  <td></td>
                  <td>
                    <template if:true={isPraseToPDFShow}>
                      <!-- <lightning-button label="打印指示单" onclick={PraseToPDFJs} style="width: 150px"
                                                disabled={isPraseToPDFDisabled}></lightning-button> -->
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                                onclick={PraseToPDFJs} disabled={isPraseToPDFDisabled}>打印指示单</button>
                                        </template>
                                    </td>
                      <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        onclick={PraseToPDFJs}
                        disabled={isPraseToPDFDisabled}
                      >
                        打印指示单
                      </button>
                    </template>
                  </td>
                                    <td>
                                        <template if:true={isOpenReportShow}>
                                            <!-- <lightning-button label="显示明细&ensp;" onclick={openReportJs}
                  <td>
                    <template if:true={isOpenReportShow}>
                      <!-- <lightning-button label="显示明细&ensp;" onclick={openReportJs}
                                                style="width: 150px" disabled={isOpenReportDisabled}></lightning-button> -->
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                                onclick={openReportJs} disabled={isOpenReportDisabled}>显示明细</button>
                                        </template>
                                    </td>
                                    <td>
                                        <template if:true={isDeleteShow}>
                                            <!-- <lightning-button label="删除" onclick={DeleteConsumable} style="width: 150px"
                      <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        onclick={openReportJs}
                        disabled={isOpenReportDisabled}
                      >
                        显示明细
                      </button>
                    </template>
                  </td>
                  <td>
                    <template if:true={isDeleteShow}>
                      <!-- <lightning-button label="删除" onclick={DeleteConsumable} style="width: 150px"
                                                disabled={isDeleteDisabled}></lightning-button> -->
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                                onclick={DeleteConsumable} disabled={isDeleteDisabled}>删除</button>
                                        </template>
                                    </td>
                                    <td></td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </div>
                      <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        onclick={DeleteConsumable}
                        disabled={isDeleteDisabled}
                      >
                        删除
                      </button>
                    </template>
                  </td>
                  <td></td>
                </tr>
              </table>
            </div>
          </div>
        </div>
                <!-- 出库单信息 EditAble = true -->
                <template if:true={EditAble}>
                    <div class="borderCss">
                        <div class="headerDorderCss">
                            <lightning-layout>
                                <lightning-layout-item padding="around-small">
                                    <p style="font-size: 18px">
                                        <strong>出库单信息</strong>
                                    </p>
                                </lightning-layout-item>
                            </lightning-layout>
                        </div>
                        <div style="padding: 7px">
                            <div lwc:dom="manual" class="resultDiv"></div>
                            <div draggable="false">
                                <!-- SummonsStatus_c__c == '价格未定' -->
                                <template if:true={summonsStatusPriceNotDetermined}>
                                    <lightning-record-edit-form object-api-name="Consumable_order__c" record-id={cocId}
                                        onload={handleLoad}>
                                        <!-- 出库单号 出库单状态 -->
                                        <lightning-layout multiple-rows="true">
                                            <template if:true={isSummonsFlag}>
                                                <lightning-layout-item size="1"></lightning-layout-item>
        <!-- 出库单信息 EditAble = true -->
        <template if:true={EditAble}>
          <div class="borderCss">
            <div class="headerDorderCss">
              <lightning-layout>
                <lightning-layout-item padding="around-small">
                  <p style="font-size: 18px">
                    <strong>出库单信息</strong>
                  </p>
                </lightning-layout-item>
              </lightning-layout>
            </div>
            <div style="padding: 7px">
              <div lwc:dom="manual" class="resultDiv"></div>
              <div draggable="false">
                <!-- SummonsStatus_c__c == '价格未定' -->
                <template if:true={summonsStatusPriceNotDetermined}>
                  <lightning-record-edit-form
                    object-api-name="Consumable_order__c"
                    record-id={cocId}
                    onload={handleLoad}
                  >
                    <!-- 出库单号 出库单状态 -->
                    <lightning-layout multiple-rows="true">
                      <template if:true={isSummonsFlag}>
                        <lightning-layout-item size="1"></lightning-layout-item>
                                                <lightning-layout-item size="5">
                                                    <lightning-output-field field-name="Name"
                                                        class="hehe-layoutItem"></lightning-output-field>
                                                </lightning-layout-item>
                        <lightning-layout-item size="5">
                          <lightning-output-field
                            field-name="Name"
                            class="hehe-layoutItem"
                          ></lightning-output-field>
                        </lightning-layout-item>
                                                <lightning-layout-item class="hehe-layoutItem" size="5"
                                                    style="padding-left: 100px;">
                                                    <lightning-output-field
                                                        field-name="SummonsStatus_c__c"></lightning-output-field>
                                                </lightning-layout-item>
                        <lightning-layout-item
                          class="hehe-layoutItem"
                          size="5"
                          style="padding-left: 100px"
                        >
                          <lightning-output-field
                            field-name="SummonsStatus_c__c"
                          ></lightning-output-field>
                        </lightning-layout-item>
                                                <lightning-layout-item size="1"></lightning-layout-item>
                        <lightning-layout-item size="1"></lightning-layout-item>
                      </template>
                    </lightning-layout>
                    <!-- 目的   开票状态 -->
                    <lightning-layout multiple-rows="true">
                      <lightning-layout-item size="1"></lightning-layout-item>
                                            </template>
                                        </lightning-layout>
                      <lightning-layout-item class="hehe-layoutItem" size="5">
                        <lightning-output-field
                          field-name="SummonsForDirction__c"
                          class="searchName"
                        ></lightning-output-field>
                      </lightning-layout-item>
                                        <!-- 目的   开票状态 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                      <lightning-layout-item
                        class="hehe-layoutItem"
                        size="5"
                        style="padding-left: 100px"
                      >
                        <lightning-output-field
                          field-name="Billed_Status__c"
                          class="searchName"
                        ></lightning-output-field>
                      </lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5">
                                                <lightning-output-field field-name="SummonsForDirction__c"
                                                    class="searchName"></lightning-output-field>
                                            </lightning-layout-item>
                      <lightning-layout-item size="1"></lightning-layout-item>
                    </lightning-layout>
                                            <lightning-layout-item class="hehe-layoutItem" size="5"
                                                style="padding-left: 100px;">
                                                <lightning-output-field field-name="Billed_Status__c"
                                                    class="searchName"></lightning-output-field>
                                            </lightning-layout-item>
                    <!-- 二级经销商 -->
                    <template if:true={isSummonsForDirctionTwoShow}>
                      <lightning-layout multiple-rows="true">
                        <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                        <lightning-layout-item class="hehe-layoutItem" size="5">
                          <lightning-output-field
                            field-name="Order_Dealer_Info__c"
                          ></lightning-output-field>
                        </lightning-layout-item>
                      </lightning-layout>
                    </template>
                    <!-- 客户名 发票-->
                    <lightning-layout multiple-rows="true">
                      <lightning-layout-item size="1"></lightning-layout-item>
                                        </lightning-layout>
                      <lightning-layout-item class="hehe-layoutItem" size="5">
                        <lightning-output-field
                          class="hideHelpText"
                          field-name="ShipmentAccount__c"
                        ></lightning-output-field>
                      </lightning-layout-item>
                                        <!-- 二级经销商 -->
                                        <template if:true={isSummonsForDirctionTwoShow}>
                                            <lightning-layout multiple-rows="true">
                      <lightning-layout-item
                        class="hehe-layoutItem"
                        size="5"
                        style="padding-left: 100px"
                      >
                        <lightning-input-field
                          data-field={ConInvoice_Code__c}
                          onchange={invoiceChange}
                          field-name="ConInvoice_Code__c"
                          class="inputFont"
                        ></lightning-input-field>
                      </lightning-layout-item>
                                                <lightning-layout-item size="1"></lightning-layout-item>
                      <lightning-layout-item size="1"></lightning-layout-item>
                    </lightning-layout>
                                                <lightning-layout-item class="hehe-layoutItem" size="5">
                                                    <lightning-output-field
                                                        field-name="Order_Dealer_Info__c"></lightning-output-field>
                                                </lightning-layout-item>
                    <!-- 科室 出库金额 -->
                    <lightning-layout multiple-rows="true">
                      <lightning-layout-item size="1"></lightning-layout-item>
                      <lightning-layout-item class="hehe-layoutItem" size="5">
                        <lightning-output-field
                          field-name="Order_ForCustomerText__c"
                        ></lightning-output-field>
                      </lightning-layout-item>
                                            </lightning-layout>
                                        </template>
                      <lightning-layout-item
                        class="hehe-layoutItem"
                        size="5"
                        style="padding-left: 100px"
                      >
                        <lightning-output-field
                          field-name="Shipment_total_amount__c"
                        ></lightning-output-field>
                      </lightning-layout-item>
                                        <!-- 客户名 发票-->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                      <lightning-layout-item size="1"></lightning-layout-item>
                    </lightning-layout>
                                            <lightning-layout-item class="hehe-layoutItem" size="5">
                                                <lightning-output-field class="hideHelpText"
                                                    field-name="ShipmentAccount__c"></lightning-output-field>
                                            </lightning-layout-item>
                    <!-- 没有确定价格 -->
                    <lightning-layout multiple-rows="true">
                      <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5"
                                                style="padding-left: 100px;">
                                                <lightning-input-field data-field={ConInvoice_Code__c}
                                                    onchange={invoiceChange} field-name="ConInvoice_Code__c"
                                                    class="inputFont"></lightning-input-field>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                        </lightning-layout>
                                        <!-- 科室 出库金额 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5">
                                                <lightning-output-field
                                                    field-name="Order_ForCustomerText__c"></lightning-output-field>
                                            </lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5"
                                                style="padding-left: 100px;">
                                                <lightning-output-field
                                                    field-name="Shipment_total_amount__c"></lightning-output-field>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                        </lightning-layout>
                                        <!-- 没有确定价格 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5">
                                                <lightning-output-field
                                                    field-name="NoConfirmedPrice__c"></lightning-output-field>
                                            </lightning-layout-item>
                                        </lightning-layout>
                                    </lightning-record-edit-form>
                                </template>
                                <!-- SummonsStatus_c__c != '价格未定' -->
                                <template if:false={summonsStatusPriceNotDetermined}>
                                    <lightning-record-edit-form object-api-name="Consumable_order__c" record-id={cocId}
                                        onsubmit={handleSubmit} onload={handleLoad}>
                                        <!-- 出库单号 出库单状态 -->
                                        <lightning-layout multiple-rows="true">
                                            <template if:true={isSummonsFlag}>
                                                <lightning-layout-item size="1"></lightning-layout-item>
                                                <lightning-layout-item class="hehe-layoutItem" size="5">
                                                    <lightning-output-field field-name="Name"></lightning-output-field>
                                                </lightning-layout-item>
                                                <lightning-layout-item class="hehe-layoutItem" size="5"
                                                    style="padding-left: 100px;">
                                                    <lightning-output-field
                                                        field-name="SummonsStatus_c__c"></lightning-output-field>
                                                </lightning-layout-item>
                                                <lightning-layout-item size="1"></lightning-layout-item>
                                            </template>
                                        </lightning-layout>
                                        <!-- 目的   二级经销商 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5">
                                                <lightning-input-field data-field="summonsForDirction"
                                                    value={summonsForDirction} field-name="SummonsForDirction__c"
                                                    required="true" onchange={ChangeDirction}
                                                    class="inputFont"></lightning-input-field>
                                            </lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5"
                                                style="padding-left: 100px;">
                                                <lightning-combobox data-field="secondaryDistributor"
                                                    name="secondaryDistributor" label="二级经销商"
                                                    value={secondaryDistributor} placeholder="请选择..."
                                                    options={secondaryDistributorOptions} variant="label-inline"
                                                    onchange={dataChange} disabled={isDisabledSecondaryDistributor}
                                                    class="inputFont"></lightning-combobox>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                        </lightning-layout>
                                        <!-- 客户名   经销商录入 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5">
                                                <div
                                                    class="slds-form-element__control slds-input-has-icon slds-input-has-icon_right">
                                                    <lightning-icon size="x-small"
                                                        class="iconMargin slds-icon slds-input__icon slds-input__icon_right slds-icon-text-default"
                                                        icon-name="utility:search"></lightning-icon>
                                                    <lightning-input type="text" name="HospitalName" label="客户名"
                                                        value={HospitalName} variant="label-inline"
                                                        onclick={searchHospitalNameModal} data-field="HospitalName"
                                                        disabled={isDisabledHospitalName} onchange={clearAgencyI}
                                                        class="inputFont"></lightning-input>
                                                </div>
                                            </lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5"
                                                style="padding-left: 100px;">
                                                <template if:true={isMutualTransferGoods}>
                                                    <c-lex-lookup onsearch={handleSearch}
                                                        onselectionchange={handleSelectionChange} label="经销商(录入)"
                                                        variant="label-inline" placeholder="搜索经销商"
                                                        onisdisabledfordealertext={isDisabledForDealerText}
                                                        account-value={accountValue} onblur={vpClear2Delay}
                                                        disabled={isDisabledForDealerText} class="inputFont">
                                                    </c-lex-lookup>
                                                </template>
                                                <template if:false={isMutualTransferGoods}>
                                                    <lightning-input type="text" name="Order_ForDealerText__c"
                                                        label="经销商(录入)" value={ForDealerText} onchange={dataChange}
                                                        data-field="Order_ForDealerText__c"
                                                        disabled={isDisabledForDealerText} variant="label-inline"
                                                        class="inputFont">
                                                    </lightning-input>
                                                </template>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                        </lightning-layout>
                                        <!-- 科室   总金额 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5">
                                                <lightning-input-field onchange={dataChange}
                                                    data-field="ForCustomerText" value={ForCustomerText}
                                                    field-name="Order_ForCustomerText__c"
                                                    disabled={isDisabledForCustomerText}
                                                    class="inputFont"></lightning-input-field>
                                            </lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5"
                                                style="padding-left: 100px;">
                                                <lightning-input type="text" name="sumPrice" label="总金额"
                                                    value={sumPrice} variant="label-inline" onchange={dataChange}
                                                    data-field="sumPrice" readonly></lightning-input>
                                            </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                        </lightning-layout>
                                        <!-- 没有确定价格 -->
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item class="hehe-layoutItem" size="5">
                                                <lightning-input-field value={NoConfirmedPrice}
                                                    field-name="NoConfirmedPrice__c" data-field="NoConfirmedPrice"
                                                    onchange={dataChange}></lightning-input-field>
                                            </lightning-layout-item>
                                        </lightning-layout>
                                    </lightning-record-edit-form>
                                </template>
                            </div>
                        </div>
                    </div>
                      <lightning-layout-item class="hehe-layoutItem" size="5">
                        <lightning-output-field
                          field-name="NoConfirmedPrice__c"
                        ></lightning-output-field>
                      </lightning-layout-item>
                    </lightning-layout>
                  </lightning-record-edit-form>
                </template>
                <!-- 出库单信息 EditAble = false -->
                <template if:false={EditAble}>
                    <div class="borderCss">
                        <div class="headerDorderCss">
                            <lightning-layout>
                                <lightning-layout-item padding="around-small">
                                    <p style="font-size: 18px">
                                        <strong>出库单信息</strong>
                                    </p>
                                </lightning-layout-item>
                            </lightning-layout>
                <!-- SummonsStatus_c__c != '价格未定' -->
                <template if:false={summonsStatusPriceNotDetermined}>
                  <lightning-record-edit-form
                    object-api-name="Consumable_order__c"
                    record-id={cocId}
                    onsubmit={handleSubmit}
                    onload={handleLoad}
                  >
                    <!-- 出库单号 出库单状态 -->
                    <lightning-layout multiple-rows="true">
                      <template if:true={isSummonsFlag}>
                        <lightning-layout-item size="1"></lightning-layout-item>
                        <lightning-layout-item class="hehe-layoutItem" size="5">
                          <lightning-output-field
                            field-name="Name"
                          ></lightning-output-field>
                        </lightning-layout-item>
                        <lightning-layout-item
                          class="hehe-layoutItem"
                          size="5"
                          style="padding-left: 100px"
                        >
                          <lightning-output-field
                            field-name="SummonsStatus_c__c"
                          ></lightning-output-field>
                        </lightning-layout-item>
                        <lightning-layout-item size="1"></lightning-layout-item>
                      </template>
                    </lightning-layout>
                    <!-- 目的   二级经销商 -->
                    <lightning-layout multiple-rows="true">
                      <lightning-layout-item size="1"></lightning-layout-item>
                      <lightning-layout-item class="hehe-layoutItem" size="5">
                        <lightning-input-field
                          data-field="summonsForDirction"
                          value={summonsForDirction}
                          field-name="SummonsForDirction__c"
                          required="true"
                          onchange={ChangeDirction}
                          class="inputFont"
                        ></lightning-input-field>
                      </lightning-layout-item>
                      <lightning-layout-item
                        class="hehe-layoutItem"
                        size="5"
                        style="padding-left: 100px"
                      >
                        <lightning-combobox
                          data-field="secondaryDistributor"
                          name="secondaryDistributor"
                          label="二级经销商"
                          value={secondaryDistributor}
                          placeholder="请选择..."
                          options={secondaryDistributorOptions}
                          variant="label-inline"
                          onchange={dataChange}
                          disabled={isDisabledSecondaryDistributor}
                          class="inputFont"
                        ></lightning-combobox>
                      </lightning-layout-item>
                      <lightning-layout-item size="1"></lightning-layout-item>
                    </lightning-layout>
                    <!-- 客户名   经销商录入 -->
                    <lightning-layout multiple-rows="true">
                      <lightning-layout-item size="1"></lightning-layout-item>
                      <lightning-layout-item class="hehe-layoutItem" size="5">
                        <div
                          class="slds-form-element__control slds-input-has-icon slds-input-has-icon_right"
                        >
                          <lightning-icon
                            size="x-small"
                            class="iconMargin slds-icon slds-input__icon slds-input__icon_right slds-icon-text-default"
                            icon-name="utility:search"
                          ></lightning-icon>
                          <lightning-input
                            type="text"
                            name="HospitalName"
                            label="客户名"
                            value={HospitalName}
                            variant="label-inline"
                            onclick={searchHospitalNameModal}
                            data-field="HospitalName"
                            disabled={isDisabledHospitalName}
                            onchange={clearAgencyI}
                            class="inputFont"
                          ></lightning-input>
                        </div>
                        <div style="padding: 7px">
                            <div lwc:dom="manual" class="resultDiv"></div>
                            <div draggable="false">
                                <lightning-record-edit-form object-api-name="Consumable_order__c" record-id={cocId}
                                    onload={handleLoad2}>
                                    <!-- 出库单号 出库单状态 -->
                                    <lightning-layout multiple-rows="true">
                                        <template if:true={isSummonsFlag}>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                      </lightning-layout-item>
                                            <lightning-layout-item size="5">
                                                <lightning-output-field field-name="Name"
                                                    class="hehe-layoutItem"></lightning-output-field>
                                            </lightning-layout-item>
                      <lightning-layout-item
                        class="hehe-layoutItem"
                        size="5"
                        style="padding-left: 100px"
                      >
                        <template if:true={isMutualTransferGoods}>
                          <c-lex-lookup
                            onsearch={handleSearch}
                            onselectionchange={handleSelectionChange}
                            label="经销商(录入)"
                            variant="label-inline"
                            placeholder="搜索经销商"
                            onisdisabledfordealertext={isDisabledForDealerText}
                            account-value={accountValue}
                            onblur={vpClear2Delay}
                            disabled={isDisabledForDealerText}
                            class="inputFont"
                          >
                          </c-lex-lookup>
                        </template>
                        <template if:false={isMutualTransferGoods}>
                          <lightning-input
                            type="text"
                            name="Order_ForDealerText__c"
                            label="经销商(录入)"
                            value={ForDealerText}
                            onchange={dataChange}
                            data-field="Order_ForDealerText__c"
                            disabled={isDisabledForDealerText}
                            variant="label-inline"
                            class="inputFont"
                          >
                          </lightning-input>
                        </template>
                      </lightning-layout-item>
                      <lightning-layout-item size="1"></lightning-layout-item>
                    </lightning-layout>
                    <!-- 科室   总金额 -->
                    <lightning-layout multiple-rows="true">
                      <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item size="5" style="padding-left: 100px;">
                                                <lightning-output-field field-name="SummonsStatus_c__c"
                                                    class="hehe-layoutItem"></lightning-output-field>
                                            </lightning-layout-item>
                      <lightning-layout-item class="hehe-layoutItem" size="5">
                        <lightning-input-field
                          onchange={dataChange}
                          data-field="ForCustomerText"
                          value={ForCustomerText}
                          field-name="Order_ForCustomerText__c"
                          disabled={isDisabledForCustomerText}
                          class="inputFont"
                        ></lightning-input-field>
                      </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                        </template>
                                    </lightning-layout>
                      <lightning-layout-item
                        class="hehe-layoutItem"
                        size="5"
                        style="padding-left: 100px"
                      >
                        <lightning-input
                          type="text"
                          name="sumPrice"
                          label="总金额"
                          value={sumPrice}
                          variant="label-inline"
                          onchange={dataChange}
                          data-field="sumPrice"
                          readonly
                        ></lightning-input>
                      </lightning-layout-item>
                                    <!-- 目的   开票状态 -->
                                    <lightning-layout multiple-rows="true">
                                        <lightning-layout-item size="1"></lightning-layout-item>
                      <lightning-layout-item size="1"></lightning-layout-item>
                    </lightning-layout>
                                        <lightning-layout-item size="5">
                                            <lightning-output-field field-name="SummonsForDirction__c"
                                                class="hehe-layoutItem"></lightning-output-field>
                                        </lightning-layout-item>
                    <!-- 没有确定价格 -->
                    <lightning-layout multiple-rows="true">
                      <lightning-layout-item size="1"></lightning-layout-item>
                                        <lightning-layout-item size="5" style="padding-left: 100px;">
                                            <lightning-output-field field-name="Billed_Status__c"
                                                class="hehe-layoutItem"></lightning-output-field>
                                        </lightning-layout-item>
                                        <lightning-layout-item size="1"></lightning-layout-item>
                                    </lightning-layout>
                                    <!-- 二级经销商 -->
                                    <template if:true={isSummonsForDirctionTwoShow}>
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                            <lightning-layout-item size="5">
                                                <lightning-output-field field-name="Order_Dealer_Info__c"
                                                    class="hehe-layoutItem"></lightning-output-field>
                                            </lightning-layout-item>
                                        </lightning-layout>
                                    </template>
                                    <!-- 客户名 发票-->
                                    <lightning-layout multiple-rows="true">
                                        <lightning-layout-item size="1"></lightning-layout-item>
                                        <lightning-layout-item size="5" class="hehe-layoutItem">
                                            <lightning-output-field class="hideHelpText"
                                                field-name="ShipmentAccount__c"></lightning-output-field>
                                        </lightning-layout-item>
                                        <template if:true={isConInvoiceShow}>
                                            <lightning-layout-item size="5" style="padding-left: 100px;">
                                                <lightning-input-field data-field={ConInvoice_Code__c}
                                                    onchange={invoiceChange} field-name="ConInvoice_Code__c"
                                                    class="hehe-layoutItem inputFont"></lightning-input-field>
                                            </lightning-layout-item>
                                        </template>
                                        <lightning-layout-item size="1"></lightning-layout-item>
                                    </lightning-layout>
                                    <!-- 科室 出库金额 -->
                                    <lightning-layout multiple-rows="true">
                                        <lightning-layout-item size="1"></lightning-layout-item>
                                        <lightning-layout-item size="5">
                                            <lightning-output-field field-name="Order_ForCustomerText__c"
                                                class="hehe-layoutItem"></lightning-output-field>
                                        </lightning-layout-item>
                                        <lightning-layout-item size="5" style="padding-left: 100px;">
                                            <lightning-output-field field-name="Shipment_total_amount__c"
                                                class="hehe-layoutItem"></lightning-output-field>
                                        </lightning-layout-item>
                                        <lightning-layout-item size="1"></lightning-layout-item>
                                    </lightning-layout>
                                    <!-- 没有确定价格 -->
                                    <lightning-layout multiple-rows="true">
                                        <lightning-layout-item size="1"></lightning-layout-item>
                                        <lightning-layout-item size="5">
                                            <lightning-output-field field-name="NoConfirmedPrice__c"
                                                class="hehe-layoutItem"></lightning-output-field>
                                        </lightning-layout-item>
                                    </lightning-layout>
                                    <!-- 附件预览 -->
                                    <template if:false={EditAble}>
                                        <lightning-layout multiple-rows="true">
                                            <lightning-layout-item size="1">
                                            </lightning-layout-item>
                                            <lightning-layout-item size="10">
                                                <lightning-card class="attListTitle" variant="Narrow" title="附件列表"
                                                    icon-name="utility:attach">
                                                    <lightning-layout slot="footer" multiple-rows="true">
                                                        <template for:each={fileData} for:item="item" for:index="index">
                                                            <lightning-layout-item padding="around-none" size="2"
                                                                key={item.recordId}
                                                                style="text-align: left;padding:5px;word-wrap:break-word; word-break:break-all;">
                                                                <lightning-icon title={item.Title}
                                                                    style="margin-left: 20px;" icon-name="doctype:gform"
                                                                    alternative-text={item.Title}
                                                                    size="large"></lightning-icon><br />
                                                                <div title={item.Title} style="width: 100px;text-overflow: ellipsis;overflow: hidden;white-space: nowrap;">
                                                                    {item.Title}
                                                                </div>
                                                                <p>
                                                                    <!-- <a data-fileid ={item.documentId} onclick={previweAtt}> -->
                                                                    <a href={item.attUrl} target="_blank">
                                                                        预览
                                                                    </a>&nbsp;·&nbsp;
                                                                    <a href={item.downloadUrl}>
                                                                        下载
                                                                    </a>&nbsp;·&nbsp;
                                                                    <a data-fileid={item.Id} onclick={deleteAtt}>
                                                                        删除
                                                                    </a>
                                                                </p>
                                                                <!-- <p>{item.updateDate} · {item.ownerName}</p> -->
                                                            </lightning-layout-item>
                                                        </template>
                                                    </lightning-layout>
                                                </lightning-card>
                                            </lightning-layout-item>
                                        </lightning-layout>
                                    </template>
                                </lightning-record-edit-form>
                            </div>
                        </div>
                    </div>
                      <lightning-layout-item class="hehe-layoutItem" size="5">
                        <lightning-input-field
                          value={NoConfirmedPrice}
                          field-name="NoConfirmedPrice__c"
                          data-field="NoConfirmedPrice"
                          onchange={dataChange}
                        ></lightning-input-field>
                      </lightning-layout-item>
                    </lightning-layout>
                  </lightning-record-edit-form>
                </template>
              </div>
            </div>
          </div>
        </template>
                <!-- 检索 -->
                <template if:true={isSearchShow}>
                    <div class="borderCss">
                        <div style="padding: 3px;">
                            <div lwc:dom="manual" class="resultDiv"></div>
                            <div draggable="false">
                                <lightning-layout multiple-rows style="margin-top: 10px;">
                                    <lightning-layout-item style="padding-left: 10px;" flexibility="auto">
                                        <div class="slds-grid slds-grid_vertical-align-center">
                                            <div class="slds-form-element__label">消耗品名称</div>
                                            <lightning-input type="text" name="consumableName" label="消耗品名称"
                                                value={consumableName} variant="label-hidden" onchange={dataChange}
                                                data-field="consumableName" class="inputFont"
                                                style="width:150px"></lightning-input>
                                        </div>
                                    </lightning-layout-item>
                                    <lightning-layout-item flexibility="auto">
                                        <div class="slds-grid slds-grid_vertical-align-center">
                                            <div class="slds-form-element__label" style="width:80px">第3分类</div>
                                            <lightning-combobox name="progress" label="第3分类" value={Category3}
                                                variant="label-hidden" options={category3Options} onchange={dataChange}
                                                data-field="Category3" style="min-width: 120px;"
                                                class="inputFont"></lightning-combobox>
                                        </div>
                                    </lightning-layout-item>
                                    <lightning-layout-item flexibility="auto">
                                        <div class="slds-grid slds-grid_vertical-align-center">
                                            <div class="slds-form-element__label" style="width:80px">第4分类</div>
                                            <lightning-combobox name="progress" label="第4分类" value={Category4}
                                                variant="label-hidden" options={category4Options} onchange={dataChange}
                                                data-field="Category4" style="min-width: 120px;"
                                                class="inputFont"></lightning-combobox>
                                        </div>
        <!-- 出库单信息 EditAble = false -->
        <template if:false={EditAble}>
          <div class="borderCss">
            <div class="headerDorderCss">
              <lightning-layout>
                <lightning-layout-item padding="around-small">
                  <p style="font-size: 18px">
                    <strong>出库单信息</strong>
                  </p>
                </lightning-layout-item>
              </lightning-layout>
            </div>
            <div style="padding: 7px">
              <div lwc:dom="manual" class="resultDiv"></div>
              <div draggable="false">
                <lightning-record-edit-form
                  object-api-name="Consumable_order__c"
                  record-id={cocId}
                  onload={handleLoad2}
                >
                  <!-- 出库单号 出库单状态 -->
                  <lightning-layout multiple-rows="true">
                    <template if:true={isSummonsFlag}>
                      <lightning-layout-item size="1"></lightning-layout-item>
                                    </lightning-layout-item>
                                    <lightning-layout-item flexibility="auto">
                                        <div class="slds-grid slds-grid_vertical-align-center">
                                            <div class="slds-form-element__label" style="width:80px">第5分类</div>
                                            <lightning-combobox name="progress" label="第5分类" value={Category5}
                                                variant="label-hidden" onchange={dataChange} data-field="Category5"
                                                options={category5Options} style="min-width: 120px;"
                                                class="inputFont"></lightning-combobox>
                                        </div>
                      <lightning-layout-item size="5">
                        <lightning-output-field
                          field-name="Name"
                          class="hehe-layoutItem"
                        ></lightning-output-field>
                      </lightning-layout-item>
                                    </lightning-layout-item>
                                    <template if:true={hasHosPro}>
                                        <lightning-layout-item flexibility="auto">
                                            <div class="slds-grid slds-grid_vertical-align-center">
                                                <div class="slds-form-element__label">医院特价</div>
                                                <lightning-combobox name="progress" label="医院特价" value={outOutPattern}
                                                    variant="label-hidden" options={outOutPatternOptionList}
                                                    onchange={dataChange} data-field="outOutPattern"
                                                    style="min-width: 120px;" class="inputFont"></lightning-combobox>
                                            </div>
                                        </lightning-layout-item>
                                    </template>
                                </lightning-layout>
                      <lightning-layout-item
                        size="5"
                        style="padding-left: 100px"
                      >
                        <lightning-output-field
                          field-name="SummonsStatus_c__c"
                          class="hehe-layoutItem"
                        ></lightning-output-field>
                      </lightning-layout-item>
                                <lightning-layout multiple-rows style="margin-top: 10px;">
                                    <lightning-layout-item style="padding-left: 10px;visibility:hidden;"
                                        flexibility="auto">
                                        <div class="slds-grid slds-grid_vertical-align-center">
                                            <div class="slds-form-element__label">消耗品名称</div>
                                            <lightning-input type="text" name="consumableName" label="消耗品名称"
                                                value={consumableName} variant="label-hidden" onchange={dataChange}
                                                data-field="consumableName" class="inputFont"
                                                style="width:150px"></lightning-input>
                                        </div>
                                    </lightning-layout-item>
                                    <lightning-layout-item flexibility="auto" style="visibility:hidden;">
                                        <div class="slds-grid slds-grid_vertical-align-center">
                                            <div class="slds-form-element__label" style="width:80px">第3分类</div>
                                            <lightning-combobox name="progress" label="第3分类" value={Category3}
                                                variant="label-hidden" options={category3Options} onchange={dataChange}
                                                data-field="Category3" style="min-width: 120px;"
                                                class="inputFont"></lightning-combobox>
                                        </div>
                                    </lightning-layout-item>
                                    <lightning-layout-item flexibility="auto" style="visibility:hidden;">
                                        <div class="slds-grid slds-grid_vertical-align-center">
                                            <div class="slds-form-element__label" style="width:80px">第4分类</div>
                                            <lightning-combobox name="progress" label="第4分类" value={Category4}
                                                variant="label-hidden" options={category4Options} onchange={dataChange}
                                                data-field="Category4" style="min-width: 120px;"
                                                class="inputFont"></lightning-combobox>
                                        </div>
                      <lightning-layout-item size="1"></lightning-layout-item>
                    </template>
                  </lightning-layout>
                                    </lightning-layout-item>
                                    <template if:false={hasHosPro}>
                                        <lightning-layout-item flexibility="auto">
                                            <div class="slds-grid slds-grid_vertical-align-center">
                                                <button
                                                    class="slds-button slds-button_neutral slds-button_stretch lexBorder lexsearchStyle"
                                                    onclick={searchProductJs}
                                                    style="min-width: 80px;max-width: 100px;">检索</button>
                                                <button style="margin-left:10px;min-width: 80px;max-width: 100px;"
                                                    class="slds-button slds-button_neutral slds-button_stretch lexBorder lexclearStyle"
                                                    onclick={ClearJs}>清空</button>
                                            </div>
                                        </lightning-layout-item>
                                    </template>
                                    <template if:true={hasHosPro}>
                                        <lightning-layout-item flexibility="auto" style="visibility:hidden;">
                                            <div class="slds-grid slds-grid_vertical-align-center">
                                                <div class="slds-form-element__label" style="width:80px">第5分类</div>
                                                <lightning-combobox name="progress" label="第5分类" value={Category5}
                                                    variant="label-hidden" onchange={dataChange} data-field="Category5"
                                                    options={category5Options} style="min-width: 120px;"
                                                    class="inputFont"></lightning-combobox>
                                            </div>
                                        </lightning-layout-item>
                                        <lightning-layout-item flexibility="auto">
                                            <div class="slds-grid slds-grid_vertical-align-center">
                                                <button
                                                    class="slds-button slds-button_neutral slds-button_stretch lexBorder lexsearchStyle"
                                                    onclick={searchProductJs}
                                                    style="min-width: 80px;max-width: 110px;">检索</button>
                                                <button style="margin-left:10px;min-width: 80px;max-width: 110px;"
                                                    class="slds-button slds-button_neutral slds-button_stretch lexBorder lexclearStyle"
                                                    onclick={ClearJs}>清空</button>
                                            </div>
                                        </lightning-layout-item>
                                    </template>
                                </lightning-layout>
                            </div>
                        </div>
                    </div>
                </template>
                  <!-- 目的   开票状态 -->
                  <lightning-layout multiple-rows="true">
                    <lightning-layout-item size="1"></lightning-layout-item>
                <!-- 出库单明细 -->
                <div class="borderCss">
                    <div class="headerDorderCss">
                        <lightning-layout>
                            <lightning-layout-item padding="around-small">
                                <p style="font-size: 18px">
                                    <strong>出库单明细</strong>
                    <lightning-layout-item size="5">
                      <lightning-output-field
                        field-name="SummonsForDirction__c"
                        class="hehe-layoutItem"
                      ></lightning-output-field>
                    </lightning-layout-item>
                    <lightning-layout-item size="5" style="padding-left: 100px">
                      <lightning-output-field
                        field-name="Billed_Status__c"
                        class="hehe-layoutItem"
                      ></lightning-output-field>
                    </lightning-layout-item>
                    <lightning-layout-item size="1"></lightning-layout-item>
                  </lightning-layout>
                  <!-- 二级经销商 -->
                  <template if:true={isSummonsForDirctionTwoShow}>
                    <lightning-layout multiple-rows="true">
                      <lightning-layout-item size="1"></lightning-layout-item>
                      <lightning-layout-item size="5">
                        <lightning-output-field
                          field-name="Order_Dealer_Info__c"
                          class="hehe-layoutItem"
                        ></lightning-output-field>
                      </lightning-layout-item>
                    </lightning-layout>
                  </template>
                  <!-- 客户名 发票-->
                  <lightning-layout multiple-rows="true">
                    <lightning-layout-item size="1"></lightning-layout-item>
                    <lightning-layout-item size="5" class="hehe-layoutItem">
                      <lightning-output-field
                        class="hideHelpText"
                        field-name="ShipmentAccount__c"
                      ></lightning-output-field>
                    </lightning-layout-item>
                    <template if:true={isConInvoiceShow}>
                      <lightning-layout-item
                        size="5"
                        style="padding-left: 100px"
                      >
                        <lightning-input-field
                          data-field={ConInvoice_Code__c}
                          onchange={invoiceChange}
                          field-name="ConInvoice_Code__c"
                          class="hehe-layoutItem inputFont"
                        ></lightning-input-field>
                      </lightning-layout-item>
                    </template>
                    <lightning-layout-item size="1"></lightning-layout-item>
                  </lightning-layout>
                  <!-- 科室 出库金额 -->
                  <lightning-layout multiple-rows="true">
                    <lightning-layout-item size="1"></lightning-layout-item>
                    <lightning-layout-item size="5">
                      <lightning-output-field
                        field-name="Order_ForCustomerText__c"
                        class="hehe-layoutItem"
                      ></lightning-output-field>
                    </lightning-layout-item>
                    <lightning-layout-item size="5" style="padding-left: 100px">
                      <lightning-output-field
                        field-name="Shipment_total_amount__c"
                        class="hehe-layoutItem"
                      ></lightning-output-field>
                    </lightning-layout-item>
                    <lightning-layout-item size="1"></lightning-layout-item>
                  </lightning-layout>
                  <!-- 没有确定价格 -->
                  <lightning-layout multiple-rows="true">
                    <lightning-layout-item size="1"></lightning-layout-item>
                    <lightning-layout-item size="5">
                      <lightning-output-field
                        field-name="NoConfirmedPrice__c"
                        class="hehe-layoutItem"
                      ></lightning-output-field>
                    </lightning-layout-item>
                  </lightning-layout>
                  <!-- 附件预览 -->
                  <template if:false={EditAble}>
                    <lightning-layout multiple-rows="true">
                      <lightning-layout-item size="1"> </lightning-layout-item>
                      <lightning-layout-item size="10">
                        <lightning-card
                          class="attListTitle"
                          variant="Narrow"
                          title="附件列表"
                          icon-name="utility:attach"
                        >
                          <lightning-layout slot="footer" multiple-rows="true">
                            <template
                              for:each={fileData}
                              for:item="item"
                              for:index="index"
                            >
                              <lightning-layout-item
                                padding="around-none"
                                size="2"
                                key={item.recordId}
                                style="
                                  text-align: left;
                                  padding: 5px;
                                  word-wrap: break-word;
                                  word-break: break-all;
                                "
                              >
                                <lightning-icon
                                  title={item.Title}
                                  style="margin-left: 20px"
                                  icon-name="doctype:gform"
                                  alternative-text={item.Title}
                                  size="large"
                                ></lightning-icon
                                ><br />
                                <div
                                  title={item.Title}
                                  style="
                                    width: 100px;
                                    text-overflow: ellipsis;
                                    overflow: hidden;
                                    white-space: nowrap;
                                  "
                                >
                                  {item.Title}
                                </div>
                                <p>
                                  <!-- <a data-fileid ={item.documentId} onclick={previweAtt}> -->
                                  <a href={item.attUrl} target="_blank">
                                    预览 </a
                                  >&nbsp;·&nbsp;
                                  <a href={item.downloadUrl}> 下载 </a
                                  >&nbsp;·&nbsp;
                                  <a data-fileid={item.Id} onclick={deleteAtt}>
                                    删除
                                  </a>
                                </p>
                            </lightning-layout-item>
                        </lightning-layout>
                    </div>
                    <div style="padding: 7px">
                        <template if:true={EditAble}>
                            <template if:true={showTable}>
                                <c-lex-custom-lightning-datatable key-field="Id" data={data} columns={columns}
                                    hide-checkbox-column={hideCheckboxColumn} onunitchange={handleUnitChange}
                                    onshipmentnumber={handleShipmentNumber}
                                    onshipmentunitprice={handleShipmentUnitPrice} onrowselection={getSelectedRows}
                                    selected-rows={selectedRows} default-sort-direction={defaultSortDirection}
                                    sorted-direction={sortDirection} sorted-by={sortedBy} onsort={onHandleSort}
                                    style="word-wrap:break-word; word-break:break-all; "
                                    class="wrapped-header-datatable" min-column-width="110">
                                </c-lex-custom-lightning-datatable>
                                <!-- <p>{item.updateDate} · {item.ownerName}</p> -->
                              </lightning-layout-item>
                            </template>
                            <c-paginator onprevious={handlePrevious} onnext={handleNext}
                                onpageschange={handlePageschange} onfirst={handleFirst} onlast={handleLast}
                                page-size-options={pageSizeOptions} previous-button-disabled={previousButtonDisabled}
                                next-button-disabled={nextButtonDisabled} record-start={recordStart}
                                record-end={recordEnd} total-records={totalRecords}></c-paginator>
                        </template>
                          </lightning-layout>
                        </lightning-card>
                      </lightning-layout-item>
                    </lightning-layout>
                  </template>
                </lightning-record-edit-form>
              </div>
            </div>
          </div>
        </template>
                        <template if:false={EditAble}>
                            <template if:true={showTable}>
                                <c-lex-custom-lightning-datatable hide-checkbox-column key-field="Id" data={editData}
                                    columns={editColumns} onunitchange={handleUnitChange}
                                    onshipmentnumber={handleShipmentNumber}
                                    onshipmentunitprice={handleShipmentUnitPrice} onrowselection={getSelectedRows}
                                    selected-rows={selectedRows} default-sort-direction={defaultSortDirection}
                                    sorted-direction={sortDirection} sorted-by={sortedBy} onsort={onHandleSort}
                                    style="word-wrap:break-word; word-break:break-all; "
                                    class="wrapped-header-datatable" min-column-width="110">
                                </c-lex-custom-lightning-datatable>
                                <c-paginator onprevious={editHandlePrevious} onnext={editHandleNext}
                                    onpageschange={editHandlePageschange} onfirst={editHandleFirst}
                                    onlast={editHandleLast} page-size-options={pageSizeOptions}
                                    previous-button-disabled={previousButtonDisabled}
                                    next-button-disabled={nextButtonDisabled} record-start={recordStart}
                                    record-end={recordEnd} total-records={totalRecords}></c-paginator>
                            </template>
                        </template>
                        <template if:true={isEditShowSpinner}>
                            <lightning-spinner alternative-text="Uploading now"></lightning-spinner>
                        </template>
        <!-- 检索 -->
        <template if:true={isSearchShow}>
          <div class="borderCss">
            <div style="padding: 3px">
              <div lwc:dom="manual" class="resultDiv"></div>
              <div draggable="false">
                <lightning-layout multiple-rows style="margin-top: 10px">
                  <lightning-layout-item
                    style="padding-left: 10px"
                    flexibility="auto"
                  >
                    <div class="slds-grid slds-grid_vertical-align-center">
                      <div class="slds-form-element__label">消耗品名称</div>
                      <lightning-input
                        type="text"
                        name="consumableName"
                        label="消耗品名称"
                        value={consumableName}
                        variant="label-hidden"
                        onchange={dataChange}
                        data-field="consumableName"
                        class="inputFont"
                        style="width: 150px"
                      ></lightning-input>
                    </div>
                </div>
                <!-- 出库产品明细 -->
                <template if:true={isShowOutboundProductDetails}>
                    <div class="borderCss">
                        <div class="headerDorderCss">
                            <lightning-layout>
                                <lightning-layout-item padding="around-small">
                                    <p style="font-size: 18px">
                                        <strong>出库产品明细</strong>
                                    </p>
                                </lightning-layout-item>
                            </lightning-layout>
                        </div>
                        <div style="padding: 7px">
                            <lightning-datatable key-field="id" data={consumableorderdetails2Records}
                                columns={consumableorderdetails2RecordsColumns} hide-checkbox-column
                                class="wrapped-header-datatable">
                            </lightning-datatable>
                        </div>
                  </lightning-layout-item>
                  <lightning-layout-item flexibility="auto">
                    <div class="slds-grid slds-grid_vertical-align-center">
                      <div class="slds-form-element__label" style="width: 80px">
                        第3分类
                      </div>
                      <lightning-combobox
                        name="progress"
                        label="第3分类"
                        value={Category3}
                        variant="label-hidden"
                        options={category3Options}
                        onchange={dataChange}
                        data-field="Category3"
                        style="min-width: 120px"
                        class="inputFont"
                      ></lightning-combobox>
                    </div>
                </template>
                  </lightning-layout-item>
                  <lightning-layout-item flexibility="auto">
                    <div class="slds-grid slds-grid_vertical-align-center">
                      <div class="slds-form-element__label" style="width: 80px">
                        第4分类
                      </div>
                      <lightning-combobox
                        name="progress"
                        label="第4分类"
                        value={Category4}
                        variant="label-hidden"
                        options={category4Options}
                        onchange={dataChange}
                        data-field="Category4"
                        style="min-width: 120px"
                        class="inputFont"
                      ></lightning-combobox>
                    </div>
                  </lightning-layout-item>
                  <lightning-layout-item flexibility="auto">
                    <div class="slds-grid slds-grid_vertical-align-center">
                      <div class="slds-form-element__label" style="width: 80px">
                        第5分类
                      </div>
                      <lightning-combobox
                        name="progress"
                        label="第5分类"
                        value={Category5}
                        variant="label-hidden"
                        onchange={dataChange}
                        data-field="Category5"
                        options={category5Options}
                        style="min-width: 120px"
                        class="inputFont"
                      ></lightning-combobox>
                    </div>
                  </lightning-layout-item>
                  <template if:true={hasHosPro}>
                    <lightning-layout-item flexibility="auto">
                      <div class="slds-grid slds-grid_vertical-align-center">
                        <div class="slds-form-element__label">医院特价</div>
                        <lightning-combobox
                          name="progress"
                          label="医院特价"
                          value={outOutPattern}
                          variant="label-hidden"
                          options={outOutPatternOptionList}
                          onchange={dataChange}
                          data-field="outOutPattern"
                          style="min-width: 120px"
                          class="inputFont"
                        ></lightning-combobox>
                      </div>
                    </lightning-layout-item>
                  </template>
                </lightning-layout>
                <!-- 上传附件 -->
                <!-- <template if:false={EditAble}>
                <lightning-layout multiple-rows style="margin-top: 10px">
                  <lightning-layout-item
                    style="padding-left: 10px; visibility: hidden"
                    flexibility="auto"
                  >
                    <div class="slds-grid slds-grid_vertical-align-center">
                      <div class="slds-form-element__label">消耗品名称</div>
                      <lightning-input
                        type="text"
                        name="consumableName"
                        label="消耗品名称"
                        value={consumableName}
                        variant="label-hidden"
                        onchange={dataChange}
                        data-field="consumableName"
                        class="inputFont"
                        style="width: 150px"
                      ></lightning-input>
                    </div>
                  </lightning-layout-item>
                  <lightning-layout-item
                    flexibility="auto"
                    style="visibility: hidden"
                  >
                    <div class="slds-grid slds-grid_vertical-align-center">
                      <div class="slds-form-element__label" style="width: 80px">
                        第3分类
                      </div>
                      <lightning-combobox
                        name="progress"
                        label="第3分类"
                        value={Category3}
                        variant="label-hidden"
                        options={category3Options}
                        onchange={dataChange}
                        data-field="Category3"
                        style="min-width: 120px"
                        class="inputFont"
                      ></lightning-combobox>
                    </div>
                  </lightning-layout-item>
                  <lightning-layout-item
                    flexibility="auto"
                    style="visibility: hidden"
                  >
                    <div class="slds-grid slds-grid_vertical-align-center">
                      <div class="slds-form-element__label" style="width: 80px">
                        第4分类
                      </div>
                      <lightning-combobox
                        name="progress"
                        label="第4分类"
                        value={Category4}
                        variant="label-hidden"
                        options={category4Options}
                        onchange={dataChange}
                        data-field="Category4"
                        style="min-width: 120px"
                        class="inputFont"
                      ></lightning-combobox>
                    </div>
                  </lightning-layout-item>
                  <template if:false={hasHosPro}>
                    <lightning-layout-item flexibility="auto">
                      <div class="slds-grid slds-grid_vertical-align-center">
                        <button
                          class="slds-button slds-button_neutral slds-button_stretch lexBorder lexsearchStyle"
                          onclick={searchProductJs}
                          style="min-width: 80px; max-width: 100px"
                        >
                          检索
                        </button>
                        <button
                          style="
                            margin-left: 10px;
                            min-width: 80px;
                            max-width: 100px;
                          "
                          class="slds-button slds-button_neutral slds-button_stretch lexBorder lexclearStyle"
                          onclick={ClearJs}
                        >
                          清空
                        </button>
                      </div>
                    </lightning-layout-item>
                  </template>
                  <template if:true={hasHosPro}>
                    <lightning-layout-item
                      flexibility="auto"
                      style="visibility: hidden"
                    >
                      <div class="slds-grid slds-grid_vertical-align-center">
                        <div
                          class="slds-form-element__label"
                          style="width: 80px"
                        >
                          第5分类
                        </div>
                        <lightning-combobox
                          name="progress"
                          label="第5分类"
                          value={Category5}
                          variant="label-hidden"
                          onchange={dataChange}
                          data-field="Category5"
                          options={category5Options}
                          style="min-width: 120px"
                          class="inputFont"
                        ></lightning-combobox>
                      </div>
                    </lightning-layout-item>
                    <lightning-layout-item flexibility="auto">
                      <div class="slds-grid slds-grid_vertical-align-center">
                        <button
                          class="slds-button slds-button_neutral slds-button_stretch lexBorder lexsearchStyle"
                          onclick={searchProductJs}
                          style="min-width: 80px; max-width: 110px"
                        >
                          检索
                        </button>
                        <button
                          style="
                            margin-left: 10px;
                            min-width: 80px;
                            max-width: 110px;
                          "
                          class="slds-button slds-button_neutral slds-button_stretch lexBorder lexclearStyle"
                          onclick={ClearJs}
                        >
                          清空
                        </button>
                      </div>
                    </lightning-layout-item>
                  </template>
                </lightning-layout>
              </div>
            </div>
          </div>
        </template>
        <!-- 出库单明细 -->
        <div class="borderCss">
          <div class="headerDorderCss">
            <lightning-layout>
              <lightning-layout-item padding="around-small">
                <p style="font-size: 18px">
                  <strong>出库单明细</strong>
                </p>
              </lightning-layout-item>
            </lightning-layout>
          </div>
          <div style="padding: 7px">
            <template if:true={EditAble}>
              <template if:true={showTable}>
                <c-lex-custom-lightning-datatable
                  key-field="Id"
                  data={data}
                  columns={columns}
                  hide-checkbox-column={hideCheckboxColumn}
                  onunitchange={handleUnitChange}
                  onshipmentnumber={handleShipmentNumber}
                  onshipmentunitprice={handleShipmentUnitPrice}
                  onrowselection={getSelectedRows}
                  selected-rows={selectedRows}
                  default-sort-direction={defaultSortDirection}
                  sorted-direction={sortDirection}
                  sorted-by={sortedBy}
                  onsort={onHandleSort}
                  style="word-wrap: break-word; word-break: break-all"
                  class="wrapped-header-datatable slds-is-selected"
                >
                </c-lex-custom-lightning-datatable>
              </template>
              <c-paginator
                onprevious={handlePrevious}
                onnext={handleNext}
                onpageschange={handlePageschange}
                onfirst={handleFirst}
                onlast={handleLast}
                page-size-options={pageSizeOptions}
                previous-button-disabled={previousButtonDisabled}
                next-button-disabled={nextButtonDisabled}
                record-start={recordStart}
                record-end={recordEnd}
                total-records={totalRecords}
              ></c-paginator>
            </template>
            <template if:false={EditAble}>
              <template if:true={showTable}>
                <c-lex-custom-lightning-datatable
                  hide-checkbox-column
                  key-field="Id"
                  data={editData}
                  columns={editColumns}
                  onunitchange={handleUnitChange}
                  onshipmentnumber={handleShipmentNumber}
                  onshipmentunitprice={handleShipmentUnitPrice}
                  onrowselection={getSelectedRows}
                  selected-rows={selectedRows}
                  default-sort-direction={defaultSortDirection}
                  sorted-direction={sortDirection}
                  sorted-by={sortedBy}
                  onsort={onHandleSort}
                  style="word-wrap: break-word; word-break: break-all"
                  class="wrapped-header-datatable slds-is-selected"
                >
                </c-lex-custom-lightning-datatable>
                <c-paginator
                  onprevious={editHandlePrevious}
                  onnext={editHandleNext}
                  onpageschange={editHandlePageschange}
                  onfirst={editHandleFirst}
                  onlast={editHandleLast}
                  page-size-options={pageSizeOptions}
                  previous-button-disabled={previousButtonDisabled}
                  next-button-disabled={nextButtonDisabled}
                  record-start={recordStart}
                  record-end={recordEnd}
                  total-records={totalRecords}
                ></c-paginator>
              </template>
            </template>
            <template if:true={isEditShowSpinner}>
              <lightning-spinner
                alternative-text="Uploading now"
              ></lightning-spinner>
            </template>
          </div>
        </div>
        <!-- 出库产品明细 -->
        <template if:true={isShowOutboundProductDetails}>
          <div class="borderCss">
            <div class="headerDorderCss">
              <lightning-layout>
                <lightning-layout-item padding="around-small">
                  <p style="font-size: 18px">
                    <strong>出库产品明细</strong>
                  </p>
                </lightning-layout-item>
              </lightning-layout>
            </div>
            <div style="padding: 7px">
              <lightning-datatable
                key-field="id"
                data={consumableorderdetails2Records}
                columns={consumableorderdetails2RecordsColumns}
                hide-checkbox-column
                class="wrapped-header-datatable"
              >
              </lightning-datatable>
            </div>
          </div>
        </template>
        <!-- 上传附件 -->
        <!-- <template if:false={EditAble}>
                    <div class="borderCss">
                        <div class="headerDorderCss">
                            <lightning-layout>
@@ -931,236 +1329,319 @@
                        </div>
                    </div>
                </template> -->
            </template>
      </template>
            <!-- 出货/销售 -->
            <template if:true={isShippingSales}>
                <div class="borderCss">
                    <div class="headerDorderCss">
                        <lightning-layout>
                            <lightning-layout-item padding="around-small">
                                <p style="font-size: 18px">
                                    <strong>出货管理</strong>
                                </p>
                            </lightning-layout-item>
                        </lightning-layout>
                    </div>
                    <div style="padding: 7px;">
                        <div lwc:dom="manual" class="resultDiv"></div>
                        <div draggable="false">
                            <lightning-layout multiple-rows="true" style="height:50px">
                                <lightning-layout-item class="hehe-layoutItem" size="4">
                                </lightning-layout-item>
                                <template if:true={isSales}>
                                    <lightning-layout-item class="hehe-layoutItem" size="4">
                                        <!-- <lightning-button label="销售" onclick={SaveP}
      <!-- 出货/销售 -->
      <template if:true={isShippingSales}>
        <div class="borderCss">
          <div class="headerDorderCss">
            <lightning-layout>
              <lightning-layout-item padding="around-small">
                <p style="font-size: 18px">
                  <strong>出货管理</strong>
                </p>
              </lightning-layout-item>
            </lightning-layout>
          </div>
          <div style="padding: 7px">
            <div lwc:dom="manual" class="resultDiv"></div>
            <div draggable="false">
              <lightning-layout multiple-rows="true" style="height: 50px">
                <lightning-layout-item class="hehe-layoutItem" size="4">
                </lightning-layout-item>
                <template if:true={isSales}>
                  <lightning-layout-item class="hehe-layoutItem" size="4">
                    <!-- <lightning-button label="销售" onclick={SaveP}
                                            style="margin-top:-10px"></lightning-button> -->
                                        <button class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                            onclick={SaveP}>销售</button>
                                    </lightning-layout-item>
                                </template>
                                <template if:false={isSales}>
                                    <lightning-layout-item class="hehe-layoutItem" size="4">
                                        <!-- <lightning-button label="出货" onclick={SaveE}></lightning-button> -->
                                        <button class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                            onclick={SaveE}>出货</button>
                                    </lightning-layout-item>
                                </template>
                                <lightning-layout-item class="hehe-layoutItem" size="4">
                                </lightning-layout-item>
                            </lightning-layout>
                    <button
                      class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                      onclick={SaveP}
                    >
                      销售
                    </button>
                  </lightning-layout-item>
                </template>
                <template if:false={isSales}>
                  <lightning-layout-item class="hehe-layoutItem" size="4">
                    <!-- <lightning-button label="出货" onclick={SaveE}></lightning-button> -->
                    <button
                      class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                      onclick={SaveE}
                    >
                      出货
                    </button>
                  </lightning-layout-item>
                </template>
                <lightning-layout-item class="hehe-layoutItem" size="4">
                </lightning-layout-item>
              </lightning-layout>
                            <template if:true={isShowInformation}>
                                <div class="borderCss" style="margin-top: 5px;">
                                    <div class="headerDorderCss">
                                        <lightning-layout>
                                            <lightning-layout-item padding="around-small">
                                                <p style="font-size: 18px">
                                                    <strong>出库单信息</strong>
                                                </p>
                                            </lightning-layout-item>
                                        </lightning-layout>
                                    </div>
                                    <div style="padding: 7px">
                                        <div lwc:dom="manual" class="resultDiv"></div>
                                        <div draggable="false">
                                            <lightning-record-edit-form object-api-name="Consumable_order__c"
                                                record-id={cocId} onload={handleLoad2}>
                                                <lightning-layout multiple-rows="true">
                                                    <lightning-layout-item size="3" padding="around-small">
                                                        <!-- <lightning-output-field field-name="Name"></lightning-output-field> -->
                                                        <div class="slds-grid slds-grid_vertical-align-center">
                                                            <div class="slds-form-element__label" style="padding: 0px;">
                                                                出库单号:</div>
                                                            <lightning-output-field field-name="Name"
                                                                variant="label-hidden"></lightning-output-field>
                                                        </div>
                                                    </lightning-layout-item>
                                                    <lightning-layout-item size="4" padding="around-small">
                                                        <!-- <lightning-output-field
              <template if:true={isShowInformation}>
                <div class="borderCss" style="margin-top: 5px">
                  <div class="headerDorderCss">
                    <lightning-layout>
                      <lightning-layout-item padding="around-small">
                        <p style="font-size: 18px">
                          <strong>出库单信息</strong>
                        </p>
                      </lightning-layout-item>
                    </lightning-layout>
                  </div>
                  <div style="padding: 7px">
                    <div lwc:dom="manual" class="resultDiv"></div>
                    <div draggable="false">
                      <lightning-record-edit-form
                        object-api-name="Consumable_order__c"
                        record-id={cocId}
                        onload={handleLoad2}
                      >
                        <lightning-layout multiple-rows="true">
                          <lightning-layout-item
                            size="3"
                            padding="around-small"
                          >
                            <!-- <lightning-output-field field-name="Name"></lightning-output-field> -->
                            <div
                              class="slds-grid slds-grid_vertical-align-center"
                            >
                              <div
                                class="slds-form-element__label"
                                style="padding: 0px"
                              >
                                出库单号:
                              </div>
                              <lightning-output-field
                                field-name="Name"
                                variant="label-hidden"
                              ></lightning-output-field>
                            </div>
                          </lightning-layout-item>
                          <lightning-layout-item
                            size="4"
                            padding="around-small"
                          >
                            <!-- <lightning-output-field
                                                            field-name="ShipmentAccount__c" class="hideHelpText"></lightning-output-field> -->
                                                        <div
                                                            class="slds-grid slds-grid_vertical-align-center hehe-layoutItem">
                                                            <div class="slds-form-element__label" style="padding: 0px;">
                                                                客户名:</div>
                                                            <lightning-output-field field-name="ShipmentAccount__c"
                                                                variant="label-hidden"></lightning-output-field>
                                                        </div>
                                                    </lightning-layout-item>
                                                    <lightning-layout-item size="2" padding="around-small">
                                                        <!-- <lightning-output-field
                            <div
                              class="slds-grid slds-grid_vertical-align-center hehe-layoutItem"
                            >
                              <div
                                class="slds-form-element__label"
                                style="padding: 0px"
                              >
                                客户名:
                              </div>
                              <lightning-output-field
                                field-name="ShipmentAccount__c"
                                variant="label-hidden"
                              ></lightning-output-field>
                            </div>
                          </lightning-layout-item>
                          <lightning-layout-item
                            size="2"
                            padding="around-small"
                          >
                            <!-- <lightning-output-field
                                                            field-name="Order_ForCustomerText__c"></lightning-output-field> -->
                                                        <div class="slds-grid slds-grid_vertical-align-center">
                                                            <div class="slds-form-element__label" style="padding: 0px;">
                                                                科室:</div>
                                                            <lightning-output-field
                                                                field-name="Order_ForCustomerText__c"
                                                                variant="label-hidden"></lightning-output-field>
                                                        </div>
                                                    </lightning-layout-item>
                                                    <lightning-layout-item size="2" padding="around-small">
                                                        <!-- <lightning-output-field
                            <div
                              class="slds-grid slds-grid_vertical-align-center"
                            >
                              <div
                                class="slds-form-element__label"
                                style="padding: 0px"
                              >
                                科室:
                              </div>
                              <lightning-output-field
                                field-name="Order_ForCustomerText__c"
                                variant="label-hidden"
                              ></lightning-output-field>
                            </div>
                          </lightning-layout-item>
                          <lightning-layout-item
                            size="2"
                            padding="around-small"
                          >
                            <!-- <lightning-output-field
                                                            field-name="SummonsForDirction__c"></lightning-output-field> -->
                                                        <div class="slds-grid slds-grid_vertical-align-center">
                                                            <div class="slds-form-element__label" style="padding: 0px;">
                                                                目的:</div>
                                                            <lightning-output-field field-name="SummonsForDirction__c"
                                                                variant="label-hidden"></lightning-output-field>
                                                        </div>
                                                    </lightning-layout-item>
                                                </lightning-layout>
                                            </lightning-record-edit-form>
                                        </div>
                                    </div>
                                </div>
                            <div
                              class="slds-grid slds-grid_vertical-align-center"
                            >
                              <div
                                class="slds-form-element__label"
                                style="padding: 0px"
                              >
                                目的:
                              </div>
                              <lightning-output-field
                                field-name="SummonsForDirction__c"
                                variant="label-hidden"
                              ></lightning-output-field>
                            </div>
                          </lightning-layout-item>
                        </lightning-layout>
                      </lightning-record-edit-form>
                    </div>
                  </div>
                </div>
                                <template if:true={isBarcode}>
                                    <div class="borderCss">
                                        <div class="headerDorderCss">
                                            <lightning-layout>
                                                <lightning-layout-item padding="around-small">
                                                    <p style="font-size: 18px">
                                                        <strong>BarCode录入</strong>
                                                    </p>
                                                </lightning-layout-item>
                                            </lightning-layout>
                                        </div>
                                        <div style="padding: 7px">
                                            <div lwc:dom="manual" class="resultDiv"></div>
                                            <div draggable="false">
                                                <lightning-record-edit-form object-api-name="Consumable_order__c"
                                                    record-id={cocId}>
                                                    <lightning-layout multiple-rows="true">
                                                        <lightning-layout-item size="1"></lightning-layout-item>
                                                        <lightning-layout-item padding="around-small">
                                                            <!-- <lightning-textarea name="Barcode" label="BarCode号"
                <template if:true={isBarcode}>
                  <div class="borderCss">
                    <div class="headerDorderCss">
                      <lightning-layout>
                        <lightning-layout-item padding="around-small">
                          <p style="font-size: 18px">
                            <strong>BarCode录入</strong>
                          </p>
                        </lightning-layout-item>
                      </lightning-layout>
                    </div>
                    <div style="padding: 7px">
                      <div lwc:dom="manual" class="resultDiv"></div>
                      <div draggable="false">
                        <lightning-record-edit-form
                          object-api-name="Consumable_order__c"
                          record-id={cocId}
                        >
                          <lightning-layout multiple-rows="true">
                            <lightning-layout-item
                              size="1"
                            ></lightning-layout-item>
                            <lightning-layout-item padding="around-small">
                              <!-- <lightning-textarea name="Barcode" label="BarCode号"
                                                                onchange={dataChange} variant="label-inline"
                                                                data-field="Barcode"
                                                                value={Barcode}></lightning-textarea> -->
                                                            <div class="slds-grid">
                                                                <div class="slds-form-element__label">BarCode号</div>
                                                                <lightning-textarea name="Barcode" label="BarCode号"
                                                                    onchange={dataChange} variant="label-hidden"
                                                                    data-field="Barcode" value={Barcode}
                                                                    style="min-width: 400px;"></lightning-textarea>
                                                            </div>
                                                        </lightning-layout-item>
                                                        <lightning-layout-item padding="around-small">
                                                            <div class="slds-grid slds-grid_vertical-align-center">
                                                                <div class="slds-form-element__label">
                                                                    <!-- <lightning-button label="确认"
                              <div class="slds-grid">
                                <div class="slds-form-element__label">
                                  BarCode号
                                </div>
                                <lightning-textarea
                                  name="Barcode"
                                  label="BarCode号"
                                  onchange={dataChange}
                                  variant="label-hidden"
                                  data-field="Barcode"
                                  value={Barcode}
                                  style="min-width: 400px"
                                ></lightning-textarea>
                              </div>
                            </lightning-layout-item>
                            <lightning-layout-item padding="around-small">
                              <div
                                class="slds-grid slds-grid_vertical-align-center"
                              >
                                <div class="slds-form-element__label">
                                  <!-- <lightning-button label="确认"
                                                                        onclick={SalesearchProductJs}></lightning-button> -->
                                                                    <button
                                                                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                                                        onclick={SalesearchProductJs}>获取明细</button>
                                                                </div>
                                                            </div>
                                                        </lightning-layout-item>
                                                    </lightning-layout>
                                                </lightning-record-edit-form>
                                            </div>
                                        </div>
                                    </div>
                                </template>
                                  <button
                                    class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                    onclick={SalesearchProductJs}
                                  >
                                    获取明细
                                  </button>
                                </div>
                              </div>
                            </lightning-layout-item>
                          </lightning-layout>
                        </lightning-record-edit-form>
                      </div>
                    </div>
                  </div>
                </template>
                                <div class="borderCss">
                                    <div class="headerDorderCss">
                                        <lightning-layout>
                                            <lightning-layout-item padding="around-small">
                                                <p style="font-size: 18px">
                                                    <strong>出货明细</strong>
                                                </p>
                                            </lightning-layout-item>
                                        </lightning-layout>
                                    </div>
                                    <div style="padding: 7px">
                                        <div lwc:dom="manual" class="resultDiv"></div>
                                        <div draggable="false">
                                            <!-- <lightning-datatable key-field="id" data={salesData} columns={salesColumns}
                <div class="borderCss">
                  <div class="headerDorderCss">
                    <lightning-layout>
                      <lightning-layout-item padding="around-small">
                        <p style="font-size: 18px">
                          <strong>出货明细</strong>
                        </p>
                      </lightning-layout-item>
                    </lightning-layout>
                  </div>
                  <div style="padding: 7px">
                    <div lwc:dom="manual" class="resultDiv"></div>
                    <div draggable="false">
                      <!-- <lightning-datatable key-field="id" data={salesData} columns={salesColumns}
                                                hide-checkbox-column
                                                style="word-wrap:break-word; word-break:break-all; "
                                                class="wrapped-header-datatable">
                                            </lightning-datatable> -->
                                            <c-lex-custom-lightning-datatable key-field="Id" data={salesData}
                                                columns={salesColumns} onoutboundcount={handleOutboundCount}
                                                hide-checkbox-column
                                                style="word-wrap:break-word; word-break:break-all; "
                                                class="wrapped-header-datatable" min-column-width="120">
                                            </c-lex-custom-lightning-datatable>
                                        </div>
                                    </div>
                                </div>
                                <div class="borderCss">
                                    <div class="headerDorderCss">
                                        <lightning-layout>
                                            <lightning-layout-item padding="around-small">
                                                <p style="font-size: 18px">
                                                    <strong>出货错误明细</strong>
                                                </p>
                                            </lightning-layout-item>
                                        </lightning-layout>
                                    </div>
                                    <div style="padding: 7px">
                                        <div lwc:dom="manual" class="resultDiv"></div>
                                        <div draggable="false">
                                            <lightning-datatable key-field="id" data={salesErrorData}
                                                columns={salesErrorColumns} hide-checkbox-column min-column-width="120"
                                                style="word-wrap:break-word; word-break:break-all; "
                                                class="wrapped-header-datatable">
                                            </lightning-datatable>
                                        </div>
                                    </div>
                                </div>
                                <lightning-layout multiple-rows="true">
                                    <lightning-layout-item class="hehe-layoutItem" size="4">
                                    </lightning-layout-item>
                                    <template if:true={isSales}>
                                        <lightning-layout-item class="hehe-layoutItem" size="4">
                                            <!-- <lightning-button label="销售" onclick={SaveP}></lightning-button> -->
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                                onclick={SaveP}>销售</button>
                                        </lightning-layout-item>
                                    </template>
                                    <template if:false={isSales}>
                                        <lightning-layout-item class="hehe-layoutItem" size="4">
                                            <!-- <lightning-button label="出货" onclick={SaveE}></lightning-button> -->
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                                onclick={SaveE}>出货</button>
                                        </lightning-layout-item>
                                    </template>
                                    <lightning-layout-item class="hehe-layoutItem" size="4">
                                    </lightning-layout-item>
                                </lightning-layout>
                            </template>
                        </div>
                      <c-lex-custom-lightning-datatable
                        key-field="Id"
                        data={salesData}
                        columns={salesColumns}
                        onoutboundcount={handleOutboundCount}
                        hide-checkbox-column
                        style="word-wrap: break-word; word-break: break-all"
                        class="wrapped-header-datatable"
                      >
                      </c-lex-custom-lightning-datatable>
                    </div>
                  </div>
                </div>
            </template>
                <div class="borderCss">
                  <div class="headerDorderCss">
                    <lightning-layout>
                      <lightning-layout-item padding="around-small">
                        <p style="font-size: 18px">
                          <strong>出货错误明细</strong>
                        </p>
                      </lightning-layout-item>
                    </lightning-layout>
                  </div>
                  <div style="padding: 7px">
                    <div lwc:dom="manual" class="resultDiv"></div>
                    <div draggable="false">
                      <lightning-datatable
                        key-field="id"
                        data={salesErrorData}
                        columns={salesErrorColumns}
                        hide-checkbox-column
                        style="word-wrap: break-word; word-break: break-all"
                        class="wrapped-header-datatable"
                      >
                      </lightning-datatable>
                    </div>
                  </div>
                </div>
                <lightning-layout multiple-rows="true">
                  <lightning-layout-item class="hehe-layoutItem" size="4">
                  </lightning-layout-item>
                  <template if:true={isSales}>
                    <lightning-layout-item class="hehe-layoutItem" size="4">
                      <!-- <lightning-button label="销售" onclick={SaveP}></lightning-button> -->
                      <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        onclick={SaveP}
                      >
                        销售
                      </button>
                    </lightning-layout-item>
                  </template>
                  <template if:false={isSales}>
                    <lightning-layout-item class="hehe-layoutItem" size="4">
                      <!-- <lightning-button label="出货" onclick={SaveE}></lightning-button> -->
                      <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        onclick={SaveE}
                      >
                        出货
                      </button>
                    </lightning-layout-item>
                  </template>
                  <lightning-layout-item class="hehe-layoutItem" size="4">
                  </lightning-layout-item>
                </lightning-layout>
              </template>
            </div>
          </div>
        </div>
      </template>
    </div>
</template>
  </div>
</template>
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js
Diff too large
force-app/main/default/lwc/lexTopPage/lexTopPage.html
@@ -1,17 +1,20 @@
<template>
    <template if:true={showSpinner}>
        <!-- <lightning-spinner size="medium" variant="brand"></lightning-spinner> -->
        <div class="slds-spinner_container">
            <div role="status" class="slds-spinner slds-spinner_medium slds-spinner_brand">
                <span class="slds-assistive-text">Loading</span>
                <div class="slds-spinner__dot-a"></div>
                <div class="slds-spinner__dot-b"></div>
            </div>
        </div>
    </template>
    <c-common-toast></c-common-toast>
    <template if:true={showPage}>
        <!-- <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;">
  <template if:true={showSpinner}>
    <!-- <lightning-spinner size="medium" variant="brand"></lightning-spinner> -->
    <div class="slds-spinner_container">
      <div
        role="status"
        class="slds-spinner slds-spinner_medium slds-spinner_brand"
      >
        <span class="slds-assistive-text">Loading</span>
        <div class="slds-spinner__dot-a"></div>
        <div class="slds-spinner__dot-b"></div>
      </div>
    </div>
  </template>
  <c-common-toast></c-common-toast>
  <template if:true={showPage}>
    <!-- <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;">
            <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
                <lightning-layout>
                    <lightning-layout-item padding="around-small">
@@ -26,43 +29,70 @@
                <p style="height: 10px;"></p>
            </div>
        </div> -->
        <!-- 未全部发货订单明细 -->
        <template if:true={over_view}>
            <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
                <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
                    <lightning-layout>
                        <lightning-layout-item padding="around-small">
                            <p style="font-size: 18px">
                                <strong>未全部发货订单明细</strong>
                            </p>
                        </lightning-layout-item>
                    </lightning-layout>
                    <!-- <p style="font-size: 16px;"><strong>未全部发货订单明细</strong></p> -->
                </div>
                <div style="padding:10px;">
                    <c-lex-custom-lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="Id" data={raesList} columns={colms} onclicklink={clickLick}></c-lex-custom-lightning-datatable>
                </div>
            </div>
        </template>
        <!-- 使用期限小于一年的产品 -->
        <template if:true={overlimit}>
            <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
                <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
                    <lightning-layout>
                        <lightning-layout-item padding="around-small">
                            <p style="font-size: 18px">
                                <strong>使用期限小于一年的产品</strong>
                            </p>
                        </lightning-layout-item>
                    </lightning-layout>
                    <!-- <p style="font-size: 16px;"><strong>使用期限小于一年的产品</strong></p> -->
                </div>
                <div style="padding:10px;">
                    <lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="prodName" data={overlimitdateorderdetails} columns={colm3}></lightning-datatable>
                </div>
            </div>
        </template>
        <!-- 经销商信息
    <!-- 未全部发货订单明细 -->
    <template if:true={over_view}>
      <div
        style="
          border: 1px solid #d4d4d4;
          border-top: 3px solid #51606e;
          border-radius: 5px;
          margin-bottom: 7px;
        "
      >
        <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
          <lightning-layout>
            <lightning-layout-item padding="around-small">
              <p style="font-size: 18px">
                <strong>未全部发货订单明细</strong>
              </p>
            </lightning-layout-item>
          </lightning-layout>
          <!-- <p style="font-size: 16px;"><strong>未全部发货订单明细</strong></p> -->
        </div>
        <div style="padding: 10px">
          <c-lex-custom-lightning-datatable
            class="wrapped-header-datatable"
            hide-checkbox-column
            key-field="Id"
            data={raesList}
            columns={colms}
            onclicklink={clickLick}
          ></c-lex-custom-lightning-datatable>
        </div>
      </div>
    </template>
    <!-- 使用期限小于一年的产品 -->
    <template if:true={overlimit}>
      <div
        style="
          border: 1px solid #d4d4d4;
          border-top: 3px solid #51606e;
          border-radius: 5px;
          margin-bottom: 7px;
        "
      >
        <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
          <lightning-layout>
            <lightning-layout-item padding="around-small">
              <p style="font-size: 18px">
                <strong>使用期限小于一年的产品</strong>
              </p>
            </lightning-layout-item>
          </lightning-layout>
          <!-- <p style="font-size: 16px;"><strong>使用期限小于一年的产品</strong></p> -->
        </div>
        <div style="padding: 10px">
          <lightning-datatable
            class="wrapped-header-datatable"
            hide-checkbox-column
            key-field="prodName"
            data={overlimitdateorderdetails}
            columns={colm3}
          ></lightning-datatable>
        </div>
      </div>
    </template>
    <!-- 经销商信息
        <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
            <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
                <lightning-layout>
@@ -146,29 +176,48 @@
                </lightning-accordion>
            </div>
        </div> -->
        <!--经销商库存上下限 -->
        <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
            <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
                <lightning-layout>
                    <lightning-layout-item padding="around-small">
                        <p style="font-size: 18px">
                            <strong>经销商库存上下限</strong>
                        </p>
                    </lightning-layout-item>
                </lightning-layout>
                <!-- <p style="font-size: 16px;"><strong>经销商库存上下限</strong></p> -->
            </div>
            <div style="padding:10px;">
                <div lwc:dom="manual" id="resultDiv" class="resultDiv"></div>
                <lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="prodName" data={productLimitRecords} columns={colm4}></lightning-datatable>
                <p style="height: 10px;"></p>
                <div draggable="false" >
                    <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width: 220px;" onclick={editProductLimit}>经销商产品上下限编辑</button>
                </div>
            </div>
    <!--经销商库存上下限 -->
    <div
      style="
        border: 1px solid #d4d4d4;
        border-top: 3px solid #51606e;
        border-radius: 5px;
        margin-bottom: 7px;
      "
    >
      <div style="border-bottom: 1px solid #d4d4d4; padding: 3px">
        <lightning-layout>
          <lightning-layout-item padding="around-small">
            <p style="font-size: 18px">
              <strong>经销商库存上下限</strong>
            </p>
          </lightning-layout-item>
        </lightning-layout>
        <!-- <p style="font-size: 16px;"><strong>经销商库存上下限</strong></p> -->
      </div>
      <div style="padding: 10px">
        <div lwc:dom="manual" id="resultDiv" class="resultDiv"></div>
        <lightning-datatable
          class="wrapped-header-datatable"
          hide-checkbox-column
          key-field="prodName"
          data={productLimitRecords}
          columns={colm4}
        ></lightning-datatable>
        <p style="height: 10px"></p>
        <div draggable="false">
          <button
            class="slds-button slds-button_neutral slds-button_stretch lexBorder"
            style="width: 220px"
            onclick={editProductLimit}
          >
            经销商产品上下限编辑
          </button>
        </div>
        <!-- 在库商品库存一览 -->
        <!-- <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
      </div>
    </div>
    <!-- 在库商品库存一览 -->
    <!-- <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-bottom:7px;">
            <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
                <lightning-layout>
                    <lightning-layout-item padding="around-small">
@@ -192,30 +241,68 @@
                record-start={recordStart} record-end={recordEnd} total-records={totalRecords}></c-paginator>
            </div>
        </div> -->
        <!-- 订单各种数量信息弹窗 -->
        <template if:true={showPop}>
            <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open slds-modal_small" style="border: 1px solid #D4D4D4;">
                <div class="slds-modal__container">
                    <header class="slds-modal__header" style="background-color: #F3F3F3;">
                        <button style="" class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close" onclick={closePop}>
                            <lightning-icon icon-name="utility:close"
                                alternative-text="close"
                                variant="inverse"
                                size="small" ></lightning-icon>
                            <span class="slds-assistive-text">Close</span>
                        </button>
                        <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">{popTitle}</h2>
                    </header>
                    <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1" style="border: 1px solid #F3F3F3;">
                        <lightning-datatable class="wrapped-header-datatable" hide-checkbox-column key-field="prodModel" columns={colms2}  data={recordList}></lightning-datatable>
                    </div>
                    <footer class="slds-modal__footer">
                        <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="关闭" onclick={closePop}></lightning-button> -->
                        <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" style="margin-left: 10px;" variant="neutral" label="关闭" onclick={closePop}>关闭</button>
                    </footer>
                </div>
            </section>
            <div class="slds-backdrop slds-backdrop_open"></div>
        </template>
    <!-- 订单各种数量信息弹窗 -->
    <template if:true={showPop}>
      <section
        role="dialog"
        tabindex="-1"
        aria-labelledby="modal-heading-01"
        aria-modal="true"
        aria-describedby="modal-content-id-1"
        class="slds-modal slds-fade-in-open slds-modal_small"
        style="border: 1px solid #d4d4d4"
      >
        <div class="slds-modal__container">
          <header class="slds-modal__header" style="background-color: #f3f3f3">
            <button
              style=""
              class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
              title="Close"
              onclick={closePop}
            >
              <lightning-icon
                icon-name="utility:close"
                alternative-text="close"
                variant="inverse"
                size="small"
              ></lightning-icon>
              <span class="slds-assistive-text">Close</span>
            </button>
            <h2
              id="modal-heading-01"
              class="slds-text-heading_medium slds-hyphenate"
            >
              {popTitle}
            </h2>
          </header>
          <div
            class="slds-modal__content slds-p-around_medium"
            id="modal-content-id-1"
            style="border: 1px solid #f3f3f3"
          >
            <lightning-datatable
              class="wrapped-header-datatable"
              hide-checkbox-column
              key-field="prodModel"
              columns={colms2}
              data={recordList}
            ></lightning-datatable>
          </div>
          <footer class="slds-modal__footer">
            <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="关闭" onclick={closePop}></lightning-button> -->
            <button
              class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
              style="margin-left: 10px"
              variant="neutral"
              label="关闭"
              onclick={closePop}
            >
              关闭
            </button>
          </footer>
        </div>
      </section>
      <div class="slds-backdrop slds-backdrop_open"></div>
    </template>
</template>
  </template>
</template>
force-app/main/default/lwc/lexTopPage/lexTopPage.js
@@ -1,667 +1,771 @@
import { LightningElement, wire, api, track } from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { NavigationMixin } from 'lightning/navigation';
import initPage from '@salesforce/apex/LexTopPageController.initPage';
import initTotalNum from '@salesforce/apex/LexConsumableGoodsInfo.initTotalNum';
import initArrDet from '@salesforce/apex/LexConsumableGoodsInfo.initArrDet';
import initArrDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initArrDetAll';
import initDeliveryDet from '@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDet';
import initDeliveryDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDetAll';
import initNotArrDet from '@salesforce/apex/LexConsumableGoodsInfo.initNotArrDet';
import initNotArrDetAll from '@salesforce/apex/LexConsumableGoodsInfo.initNotArrDetAll';
import initMoreThan7 from '@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7';
import initMoreThan7All from '@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7All';
//table css
import { LightningElement, wire, api, track } from "lwc";
import { ShowToastEvent } from "lightning/platformShowToastEvent";
import { NavigationMixin } from "lightning/navigation";
import initPage from "@salesforce/apex/LexTopPageController.initPage";
import initTotalNum from "@salesforce/apex/LexConsumableGoodsInfo.initTotalNum";
import initArrDet from "@salesforce/apex/LexConsumableGoodsInfo.initArrDet";
import initArrDetAll from "@salesforce/apex/LexConsumableGoodsInfo.initArrDetAll";
import initDeliveryDet from "@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDet";
import initDeliveryDetAll from "@salesforce/apex/LexConsumableGoodsInfo.initDeliveryDetAll";
import initNotArrDet from "@salesforce/apex/LexConsumableGoodsInfo.initNotArrDet";
import initNotArrDetAll from "@salesforce/apex/LexConsumableGoodsInfo.initNotArrDetAll";
import initMoreThan7 from "@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7";
import initMoreThan7All from "@salesforce/apex/LexConsumableGoodsInfo.initMoreThan7All";
//table css
import { loadStyle } from "lightning/platformResourceLoader";
import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
export default class LexTopPage extends NavigationMixin(LightningElement) {
    @track title = [];
    @track raesList = [];
    @track column = [];
    @track overlimitdateorderdetails = [];
    @track productLimitRecords = [];
    @track accountInfo;
    @track accountId;
    @track userPro_Type;
    @track pageRecords = [];
    @track csvData = [];
    @track product_Limit;
    @track over_view = false;
    @track overlimit = false;
    @track hasHos = false;
    @track activeSections = ['A', 'B', 'C'];
    @track isRender = false;
    @track consumableorderdetailsRecordsview;
    @track showSpinner = true;
    @track showPage = false;
    //
    @track showPop = false;
    @track popTitle;
    @track totalNum;
    @track orderNumberArrived;
    @track deliveryDetailCount;
    @track orderNumberNotarrive;
    @track moreThanSevenDays;
    stylesLoaded = false;
  @track title = [];
  @track raesList = [];
  @track column = [];
  @track overlimitdateorderdetails = [];
  @track productLimitRecords = [];
  @track accountInfo;
  @track accountId;
  @track userPro_Type;
  @track pageRecords = [];
  @track csvData = [];
  @track product_Limit;
  @track over_view = false;
  @track overlimit = false;
  @track hasHos = false;
  @track activeSections = ["A", "B", "C"];
  @track isRender = false;
  @track consumableorderdetailsRecordsview;
  @track showSpinner = true;
  @track showPage = false;
  //
  @track showPop = false;
  @track popTitle;
  @track totalNum;
  @track orderNumberArrived;
  @track deliveryDetailCount;
  @track orderNumberNotarrive;
  @track moreThanSevenDays;
  stylesLoaded = false;
    @track showTable = false;
    @track hidecheckboxcolumn = true;
    //排序
    defaultSortDirection = "asc";
    sortDirection = "asc";
    sortedBy;
  @track showTable = false;
  @track hidecheckboxcolumn = true;
  //排序
  defaultSortDirection = "asc";
  sortDirection = "asc";
  sortedBy;
    //分页start
    @track sortBy = "";
    @track pageSize = 10;
    error;
    records;
    currentPageToken = 0;
    nextPageToken = this.pageSize;
    @track totalRecords = 0;
    @track loader = false;
    @track pageNumber = 1;
    @track paginationVisibility = false;
    @track totalPages = 1;
    pageSizeOptions = [10, 25, 50, 100];
    @track recordStart = 0;
    @track recordEnd = 0;
    //end
  //分页start
  @track sortBy = "";
  @track pageSize = 10;
  error;
  records;
  currentPageToken = 0;
  nextPageToken = this.pageSize;
  @track totalRecords = 0;
  @track loader = false;
  @track pageNumber = 1;
  @track paginationVisibility = false;
  @track totalPages = 1;
  pageSizeOptions = [10, 25, 50, 100];
  @track recordStart = 0;
  @track recordEnd = 0;
  //end
    //是否一直显示提示
    @track isNoteStay = true;
  //是否一直显示提示
  @track isNoteStay = true;
    //未全部发货订单明细col
    @track colms = [
        {
            label: '消耗品订单名称',
            type: "customOutputGood",
            typeAttributes: {
                outputValue: { fieldName: "Name" },
                type: 'Title',
                recordId: { fieldName: "Id" }
            },
            hideDefaultActions: true,initialWidth: 200
        },
        { label: 'SAP合同号', fieldName: 'ContractNo__c', hideDefaultActions: true,initialWidth:180},
        {
            label: '订单总数',
            type: "customOutputGood",
            typeAttributes: {
                outputValue: { fieldName: "Total_num__c" },
                type: 'TotalNum',
                recordId: { fieldName: "Id" }
            },
            hideDefaultActions: true, initialWidth: 100
        },
        {
            label: '已到货数量',
            type: "customOutputGood",
            typeAttributes: {
                outputValue: { fieldName: "OrderNumber_arrived__c" },
                type: 'ArrDet',
                recordId: { fieldName: "Id" }
            },
            hideDefaultActions: true, initialWidth: 110
        },
        {
            label: '待系统操作入库数量',
            type: "customOutputGood",
            typeAttributes: {
                outputValue: { fieldName: "Delivery_detail_count__c" },
                type: 'DeliveryDet',
                recordId: { fieldName: "Id" }
            },
            hideDefaultActions: true, initialWidth: 180
        },
        {
            label: '还没发货数量',
            type: "customOutputGood",
            typeAttributes: {
                outputValue: { fieldName: "OrderNumber_notarrive__c" },
                type: 'NotArrDet',
                recordId: { fieldName: "Id" }
            },
            hideDefaultActions: true, initialWidth: 120
        },
        {
            label: '发货七天还未到货数',
            type: "customOutputGood",
            typeAttributes: {
                outputValue: { fieldName: "More_than_seven_days__c" },
                type: 'MoreThan7',
                recordId: { fieldName: "Id" }
            },
            hideDefaultActions: true, initialWidth: 180
        },
        { label: '最新发货日期', fieldName: 'Shipment_date__c', hideDefaultActions: true , initialWidth: 140},
        { label: '首次发货日期', fieldName: 'First_Delivery__c', hideDefaultActions: true , initialWidth: 140}
    ];
    @track colms2 = [
        { label: '产品型号', fieldName: 'prodModel', hideDefaultActions: true },
        { label: '数量', fieldName: 'recordCount', hideDefaultActions: true ,initialWidth: 60,cellAttributes: { alignment: "center" }}
    ];
    //使用期限小于一年的产品col
    @track colm3 = [
        { label: '产品型号', fieldName: 'prodName', hideDefaultActions: true },
        { label: '数量', fieldName: 'countid', hideDefaultActions: true ,cellAttributes: { alignment: "left" }},
        { label: '单位', fieldName: 'BoxPiece', hideDefaultActions: true ,cellAttributes: { alignment: "left" }}
    ];
    //经销商库存上下限col
    @track colm4 = [
        { label: '产品型号', fieldName: 'prodName', hideDefaultActions: true },
        { label: '库存下限', fieldName: 'limitLow', hideDefaultActions: true ,cellAttributes: { alignment: "left" }},
        { label: '库存上限', fieldName: 'limitUp', hideDefaultActions: true ,cellAttributes: { alignment: "left" }}
    ];
    @track columns = [
        {
            label: "消耗品名称",
            fieldName: "Name__c",
            type: "Name",
            sortable: true,
            hideDefaultActions: true,
            wrapText: true,
            cellAttributes: { alignment: "left" }
        },
        {
            label: "规格",
            fieldName: "packing_list",
            cellAttributes: { alignment: "right" },
            initialWidth: 50,
            wrapText: true,
            hideDefaultActions: true,
        },
        {
            label: "第三分类",
            fieldName: "Category3__c",
            initialWidth: 85,
            cellAttributes: { alignment: "left" },
            hideDefaultActions: true,
            wrapText: true,
        },
        {
            label: "第四分类",
            fieldName: "Category4__c",
            cellAttributes: { alignment: "left" },
            initialWidth: 85,
            hideDefaultActions: true,
            wrapText: true,
        },
        {
            label: "第五分类",
            fieldName: "Category5__c",
            cellAttributes: { alignment: "left" },
            initialWidth: 85,
            hideDefaultActions: true,
            wrapText: true,
            sortable: true,
        },
        {
            label: "CFDA状态",
            fieldName: "SFDA_Status__c",
            cellAttributes: { alignment: "left" },
            initialWidth: 80,
            hideDefaultActions: true,
        },
        {
            label: "注册证编码号",
            fieldName: "approbation_No",
            cellAttributes: { alignment: "left" },
            wrapText: true,
            initialWidth: 155,
            hideDefaultActions: true,
        },
        {
            label: "注册证效期",
            fieldName: "expiration_Date",
            cellAttributes: { alignment: "left" },
            wrapText: true,
            hideDefaultActions: true,
            initialWidth: 100
        },
        {
            label: "产品数量下限",
            fieldName: "lowerlimit",
            cellAttributes: { alignment: "right" },
            wrapText: true,
            hideDefaultActions: true,
            initialWidth: 100
        },
        {
            label: "使用期限",
            fieldName: "guaranteeperiod",
            cellAttributes: { alignment: "left" },
            hideDefaultActions: true,
            initialWidth: 95
        },
        {
            label: '有效期内库存',
            type: "customInventoryColor",
            cellAttributes: { alignment: "right" },
            typeAttributes: {
                value: { fieldName: "limitCount" },
                upperlimit: { fieldName: "upperlimit" },
                lowerlimit: { fieldName: "lowerlimit" },
                boxPrice: { fieldName: "BoxPiece" },
            },
            hideDefaultActions: true,
            initialWidth: 95
        },
        {
            label: "过期库存",
            fieldName: "overlimitCount",
            hideDefaultActions: true,
            cellAttributes: { alignment: "right" },
            initialWidth: 75
        },
        {
            label: "单位",
            fieldName: "BoxPiece",
            cellAttributes: { alignment: "left" },
            initialWidth: 50,
            wrapText: true,
            hideDefaultActions: true,
        },
    ];
    renderedCallback() {
        if (!this.stylesLoaded) {
            Promise.all([loadStyle(this, WrappedHeaderTable)])
                .then(() => {
                    console.log("Custom styles loaded");
                    this.stylesLoaded = true;
                })
                .catch((error) => {
                    console.error("Error loading custom styles");
                });
        }
  //未全部发货订单明细col
  @track colms = [
    {
      label: "消耗品订单名称",
      type: "customOutputGood",
      typeAttributes: {
        outputValue: { fieldName: "Name" },
        type: "Title",
        recordId: { fieldName: "Id" }
      },
      hideDefaultActions: true,
      // initialWidth: 200,
      wrapText: true
    },
    {
      label: "SAP合同号",
      fieldName: "ContractNo__c",
      hideDefaultActions: true,
      wrapText: true,
      initialWidth: 180
    },
    {
      label: "订单总数",
      type: "customOutputGood",
      typeAttributes: {
        outputValue: { fieldName: "Total_num__c" },
        type: "TotalNum",
        recordId: { fieldName: "Id" }
      },
      hideDefaultActions: true,
      initialWidth: 100
    },
    {
      label: "已到货数量",
      type: "customOutputGood",
      typeAttributes: {
        outputValue: { fieldName: "OrderNumber_arrived__c" },
        type: "ArrDet",
        recordId: { fieldName: "Id" }
      },
      hideDefaultActions: true,
      initialWidth: 100
    },
    {
      label: "待系统操作入库数量",
      type: "customOutputGood",
      typeAttributes: {
        outputValue: { fieldName: "Delivery_detail_count__c" },
        type: "DeliveryDet",
        recordId: { fieldName: "Id" }
      },
      hideDefaultActions: true,
      initialWidth: 150
    },
    {
      label: "还没发货数量",
      type: "customOutputGood",
      typeAttributes: {
        outputValue: { fieldName: "OrderNumber_notarrive__c" },
        type: "NotArrDet",
        recordId: { fieldName: "Id" }
      },
      hideDefaultActions: true,
      initialWidth: 120
    },
    {
      label: "发货七天还未到货数",
      type: "customOutputGood",
      typeAttributes: {
        outputValue: { fieldName: "More_than_seven_days__c" },
        type: "MoreThan7",
        recordId: { fieldName: "Id" }
      },
      hideDefaultActions: true,
      initialWidth: 150
    },
    {
      label: "最新发货日期",
      fieldName: "Shipment_date__c",
      hideDefaultActions: true,
      initialWidth: 105
    },
    {
      label: "首次发货日期",
      fieldName: "First_Delivery__c",
      hideDefaultActions: true,
      initialWidth: 105
    }
  ];
    connectedCallback() {
        this.loader = true;
        this.init();
  @track colms2 = [
    { label: "产品型号", fieldName: "prodModel", hideDefaultActions: true },
    {
      label: "数量",
      fieldName: "recordCount",
      hideDefaultActions: true,
      initialWidth: 60,
      cellAttributes: { alignment: "center" }
    }
    init() {
        this.showSpinner = true;
        initPage({
            pageSizeLWC: this.pageSize,
            pageTokenLWC: this.currentPageToken,
  ];
  //使用期限小于一年的产品col
  @track colm3 = [
    { label: "产品型号", fieldName: "prodName", hideDefaultActions: true },
    {
      label: "数量",
      fieldName: "countid",
      hideDefaultActions: true,
      cellAttributes: { alignment: "left" }
    },
    {
      label: "单位",
      fieldName: "BoxPiece",
      hideDefaultActions: true,
      cellAttributes: { alignment: "left" }
    }
  ];
  //经销商库存上下限col
  @track colm4 = [
    { label: "产品型号", fieldName: "prodName", hideDefaultActions: true },
    {
      label: "库存下限",
      fieldName: "limitLow",
      hideDefaultActions: true,
      cellAttributes: { alignment: "left" }
    },
    {
      label: "库存上限",
      fieldName: "limitUp",
      hideDefaultActions: true,
      cellAttributes: { alignment: "left" }
    }
  ];
  @track columns = [
    {
      label: "消耗品名称",
      fieldName: "Name__c",
      type: "Name",
      sortable: true,
      hideDefaultActions: true,
      wrapText: true,
      cellAttributes: { alignment: "left" }
    },
    {
      label: "规格",
      fieldName: "packing_list",
      cellAttributes: { alignment: "right" },
      initialWidth: 50,
      wrapText: true,
      hideDefaultActions: true
    },
    {
      label: "第三分类",
      fieldName: "Category3__c",
      initialWidth: 85,
      cellAttributes: { alignment: "left" },
      hideDefaultActions: true,
      wrapText: true
    },
    {
      label: "第四分类",
      fieldName: "Category4__c",
      cellAttributes: { alignment: "left" },
      initialWidth: 85,
      hideDefaultActions: true,
      wrapText: true
    },
    {
      label: "第五分类",
      fieldName: "Category5__c",
      cellAttributes: { alignment: "left" },
      initialWidth: 85,
      hideDefaultActions: true,
      wrapText: true,
      sortable: true
    },
    {
      label: "CFDA状态",
      fieldName: "SFDA_Status__c",
      cellAttributes: { alignment: "left" },
      initialWidth: 80,
      hideDefaultActions: true
    },
    {
      label: "注册证编码号",
      fieldName: "approbation_No",
      cellAttributes: { alignment: "left" },
      wrapText: true,
      initialWidth: 155,
      hideDefaultActions: true
    },
    {
      label: "注册证效期",
      fieldName: "expiration_Date",
      cellAttributes: { alignment: "left" },
      wrapText: true,
      hideDefaultActions: true,
      initialWidth: 100
    },
    {
      label: "产品数量下限",
      fieldName: "lowerlimit",
      cellAttributes: { alignment: "right" },
      wrapText: true,
      hideDefaultActions: true,
      initialWidth: 100
    },
    {
      label: "使用期限",
      fieldName: "guaranteeperiod",
      cellAttributes: { alignment: "left" },
      hideDefaultActions: true,
      initialWidth: 95
    },
    {
      label: "有效期内库存",
      type: "customInventoryColor",
      cellAttributes: { alignment: "right" },
      typeAttributes: {
        value: { fieldName: "limitCount" },
        upperlimit: { fieldName: "upperlimit" },
        lowerlimit: { fieldName: "lowerlimit" },
        boxPrice: { fieldName: "BoxPiece" }
      },
      hideDefaultActions: true,
      initialWidth: 95
    },
    {
      label: "过期库存",
      fieldName: "overlimitCount",
      hideDefaultActions: true,
      cellAttributes: { alignment: "right" },
      initialWidth: 75
    },
    {
      label: "单位",
      fieldName: "BoxPiece",
      cellAttributes: { alignment: "left" },
      initialWidth: 50,
      wrapText: true,
      hideDefaultActions: true
    }
  ];
  renderedCallback() {
    if (!this.stylesLoaded) {
      Promise.all([loadStyle(this, WrappedHeaderTable)])
        .then(() => {
          console.log("Custom styles loaded");
          this.stylesLoaded = true;
        })
            .then(result => {
                this.isNoteStay = result.isNoteStay;
                console.log('isNoteStay:'+result.isNoteStay);
                if (result.result == 'Success') {
                    //分页start
                    this.nextPageToken = result.paginatedAccounts.nextPageToken;
                    this.totalRecords = result.paginatedAccounts.totalRecords;
                    this.recordStart = result.paginatedAccounts.recordStart;
                    this.recordEnd = result.paginatedAccounts.recordEnd;
                    this.totalPages = Math.ceil(result.paginatedAccounts.totalRecords / this.pageSize);
                    console.log('this.totalPages = ' + this.totalPages);
                    this.paginationVisibility = this.totalPages > 1 ? true : false;
                    console.log('this.sortDirection = ' + this.sortDirection);
                    this.loader = false;
                    //分页end
                    this.title = result.title;
                    this.totalNum = result.totalNum;
                    this.orderNumberArrived = result.orderNumberArrived;
                    this.deliveryDetailCount = result.deliveryDetailCount;
                    this.orderNumberNotarrive = result.orderNumberNotarrive;
                    this.moreThanSevenDays = result.moreThanSevenDays;
                    this.raesList = result.raesList;
                    this.raesList.push({ Id: '1', Name: '待操作入库订单汇总', Total_num__c: this.totalNum, OrderNumber_arrived__c: this.orderNumberArrived, Delivery_detail_count__c: this.deliveryDetailCount, OrderNumber_notarrive__c: this.orderNumberNotarrive, More_than_seven_days__c: this.moreThanSevenDays });
                    this.column = result.column;
                    this.accountInfo = result.accountInfo;
                    this.accountId = result.accountInfo.Id;
                    this.pageRecords = result.pageRecords;
                    this.overlimitdateorderdetails = result.overlimitdateorderdetails;
                    this.over_view = result.over_view;
                    this.overlimit = result.overlimit;
                    this.hasHos = result.hasHos;
                    this.product_Limit = result.product_Limit;
                    console.log('result==>' + JSON.stringify(result));
                    for (var i in this.pageRecords) {
                        this.pageRecords[i]["Name__c"] = this.pageRecords[i].Prod.Name__c;
                        this.pageRecords[i]["Category3__c"] = this.pageRecords[i].Prod.Category3__c;
                        this.pageRecords[i]["Category4__c"] = this.pageRecords[i].Prod.Category3__c;
                        this.pageRecords[i]["Category5__c"] = this.pageRecords[i].Prod.Category3__c;
                        this.pageRecords[i]["SFDA_Status__c"] = this.pageRecords[i].Prod.SFDA_Status__c;
                    }
                    //hasHos = true 医院特价
                    if (this.hasHos) {
                        let object1 = {
                            label: "医院特价",
                            fieldName: "hospitalSpecialOffer",
                            hideDefaultActions: true,
                            type: 'boolean',
                            cellAttributes: { alignment: "left" },
                            initialWidth: 75
                        };
                        this.columns.push(object1);
                        console.log(' this.columns' + this.columns);
                        for (var j in this.pageRecords) {
                            this.pageRecords[j]["Name__c"] = this.pageRecords[j].Prod.Name__c;
                            this.pageRecords[j]["Category3__c"] = this.pageRecords[j].Prod.Category3__c;
                            this.pageRecords[j]["Category4__c"] = this.pageRecords[j].Prod.Category3__c;
                            this.pageRecords[j]["Category5__c"] = this.pageRecords[j].Prod.Category3__c;
                            this.pageRecords[j]["SFDA_Status__c"] = this.pageRecords[j].Prod.SFDA_Status__c;
                            this.pageRecords[j]["hospitalSpecialOffer__c"] = this.pageRecords[j].hospitalSpecialOffer;
                        }
                    }
                    this.showTable = true;
                    if (this.product_Limit != null && this.product_Limit != '') {
                        var records = this.product_Limit.split(",");
                        for (var i in records) {
                            var parms = records[i].split("|");
                            var record = new Object();
                            record["prodName"] = parms[0];
                            record["limitLow"] = parms[1];
                            record["limitUp"] = parms[2];
                            this.productLimitRecords.push(record);
                        }
                    }
                    // this.productLimitRecords = records;
                    console.log("productLimitRecords:" + JSON.stringify(this.productLimitRecords));
                    console.log("product_Limit:" + this.product_Limit);
                    this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview;
                    //add by WangXueqin 2023/05/05
                    this.userPro_Type = result.userPro_Type;
                    console.log('this.accountId:' + this.accountId);
                    console.log('this.accountInfo:' + JSON.stringify(this.accountInfo));
                    this.showSpinner = false;
                    this.showPage = true;
                    // this.showMyToast('初始化页面成功', '', 'success');
                } else {
                    this.showPage = true;
                    this.showSpinner = false;
                    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');
            })
    }
    //点击链接
    clickLick(event) {
        var outputValue = event.detail.data.value;
        var outputType = event.detail.data.type;
        var recordId = event.detail.data.recordId;
        console.log("click:" + outputValue + "---" + outputType + "---" + recordId);
        if (outputType == 'Title') {
            const config = {
                type: 'standard__webPage',
                attributes: {
                    url: '/lexarrivegoods?ESetId=' + recordId
                }
            };
            this[NavigationMixin.Navigate](config);
        } else if (outputType == 'TotalNum') {
            this.popTitle = '所有产品一览';
            initTotalNum({ ordId: recordId, type: '' })
                .then(result => {
                    if (result.result == 'Success') {
                        this.recordList = result.recordList;
                        console.log('data:' + JSON.stringify(this.recordList));
                        this.showPop = true;
                    } else {
                        this.showMyToast('加载所有产品一览页面失败', result.errorMsg, 'error');
                    }
                })
        } else if (outputType == 'ArrDet') {
            if (recordId == '1') {
                this.popTitle = '所有已到货产品一览';
                initArrDetAll({ type: '' })
                    .then(result => {
                        if (result.result == 'Success') {
                            this.recordList = result.recordList;
                            console.log('data:' + JSON.stringify(this.recordList));
                            this.showPop = true;
                        } else {
                            this.showMyToast('加载所有已到货产品一览页面失败', result.errorMsg, 'error');
                        }
                    })
            } else {
                this.popTitle = '已到货产品一览';
                initArrDet({ orderId: recordId })
                    .then(result => {
                        if (result.result == 'Success') {
                            this.recordList = result.recordList;
                            console.log('data:' + JSON.stringify(this.recordList));
                            this.showPop = true;
                        } else {
                            this.showMyToast('加载已到货产品一览页面失败', result.errorMsg, 'error');
                        }
                    })
            }
        } else if (outputType == 'DeliveryDet') {
            if (recordId == '1') {
                this.popTitle = '所有已发货还没到货产品一览';
                initDeliveryDetAll({ type: '' })
                    .then(result => {
                        if (result.result == 'Success') {
                            this.recordList = result.recordList;
                            console.log('data:' + JSON.stringify(this.recordList));
                            this.showPop = true;
                        } else {
                            this.showMyToast('加载所有已发货还没到货产品一览页面失败', result.errorMsg, 'error');
                        }
                    })
            } else {
                this.popTitle = '未到货产品一览';
                initDeliveryDet({ orderId: recordId })
                    .then(result => {
                        if (result.result == 'Success') {
                            this.recordList = result.recordList;
                            console.log('data:' + JSON.stringify(this.recordList));
                            this.showPop = true;
                        } else {
                            this.showMyToast('加载未到货产品一览页面失败', result.errorMsg, 'error');
                        }
                    })
            }
        } else if (outputType == 'NotArrDet') {
            if (recordId == '1') {
                this.popTitle = '所有还没发货产品一览';
                initNotArrDetAll({ type: '' })
                    .then(result => {
                        if (result.result == 'Success') {
                            this.recordList = result.recordList;
                            console.log('data:' + JSON.stringify(this.recordList));
                            this.showPop = true;
                        } else {
                            this.showMyToast('加载所有还没发货产品一览页面失败', result.errorMsg, 'error');
                        }
                    })
            } else {
                this.popTitle = '还没发货数量';
                initNotArrDet({ orderId: recordId })
                    .then(result => {
                        if (result.result == 'Success') {
                            this.recordList = result.recordList;
                            console.log('data:' + JSON.stringify(this.recordList));
                            this.showPop = true;
                        } else {
                            this.showMyToast('加载还没发货数量页面失败', result.errorMsg, 'error');
                        }
                    })
            }
        } else if (outputType == 'MoreThan7') {
            if (recordId == '1') {
                this.popTitle = '所有发货七天还未到货数';
                initMoreThan7All({ type: '' })
                    .then(result => {
                        if (result.result == 'Success') {
                            this.recordList = result.recordList;
                            console.log('data:' + JSON.stringify(this.recordList));
                            this.showPop = true;
                        } else {
                            this.showMyToast('加载所有发货七天还未到货数页面失败', result.errorMsg, 'error');
                        }
                    })
            } else {
                this.popTitle = '发货七天还未到货数';
                initMoreThan7({ orderId: recordId })
                    .then(result => {
                        if (result.result == 'Success') {
                            this.recordList = result.recordList;
                            console.log('data:' + JSON.stringify(this.recordList));
                            this.showPop = true;
                        } else {
                            this.showMyToast('加载发货七天还未到货数页面失败', result.errorMsg, 'error');
                        }
                    })
            }
        }
    }
    //关闭弹窗
    closePop() {
        this.showPop = false;
    }
    editProductLimit(event) {
        //add by Wang Xueqin 2023/05/05
        let url = "/lexproductlimitedit?accountid=" + this.accountId + "&userPro_Type=" + this.userPro_Type;
        const config = {
            type: 'standard__webPage',
            attributes: {
                url: url
            }
        };
        this[NavigationMixin.Navigate](config);
    }
    //新建消耗品订单
    newOrder() {
        this[NavigationMixin.Navigate]({
            type: 'standard__objectPage',
            attributes: {
                objectApiName: 'Consumable_order__c',
                actionName: 'new'
            },
            state: {
                useRecordTypeCheck: 1
            }
        .catch((error) => {
          console.error("Error loading custom styles");
        });
    }
  }
    showMyToast(title, message, variant) {
        console.log('show custom message');
        var iconName = '';
        var content = '';
        if(variant == 'success'){
           iconName = 'utility:check';
        }else{
           iconName = 'utility:error';
        }
        if(message != ''){
           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);
        // var mode;
        // if(this.isNoteStay){
        //     mode ='sticky';
        // }else{
        //     mode = 'dismissable';
        // }
        // const evt = new ShowToastEvent({
        //     title: title,
        //     message: message,
        //     variant: variant,
        //     mode: mode
        // });
        // this.dispatchEvent(evt);
     }
    //排序
    sortByMethod(field, reverse, primer) {
        const key = primer
            ? function (x) {
                return primer(x[field]);
            }
            : function (x) {
                return x[field];
  connectedCallback() {
    this.loader = true;
    this.init();
  }
  init() {
    this.showSpinner = true;
    initPage({
      pageSizeLWC: this.pageSize,
      pageTokenLWC: this.currentPageToken
    })
      .then((result) => {
        this.isNoteStay = result.isNoteStay;
        console.log("isNoteStay:" + result.isNoteStay);
        if (result.result == "Success") {
          //分页start
          this.nextPageToken = result.paginatedAccounts.nextPageToken;
          this.totalRecords = result.paginatedAccounts.totalRecords;
          this.recordStart = result.paginatedAccounts.recordStart;
          this.recordEnd = result.paginatedAccounts.recordEnd;
          this.totalPages = Math.ceil(
            result.paginatedAccounts.totalRecords / this.pageSize
          );
          console.log("this.totalPages = " + this.totalPages);
          this.paginationVisibility = this.totalPages > 1 ? true : false;
          console.log("this.sortDirection = " + this.sortDirection);
          this.loader = false;
          //分页end
          this.title = result.title;
          this.totalNum = result.totalNum;
          this.orderNumberArrived = result.orderNumberArrived;
          this.deliveryDetailCount = result.deliveryDetailCount;
          this.orderNumberNotarrive = result.orderNumberNotarrive;
          this.moreThanSevenDays = result.moreThanSevenDays;
          this.raesList = result.raesList;
          this.raesList.push({
            Id: "1",
            Name: "待操作入库订单汇总",
            Total_num__c: this.totalNum,
            OrderNumber_arrived__c: this.orderNumberArrived,
            Delivery_detail_count__c: this.deliveryDetailCount,
            OrderNumber_notarrive__c: this.orderNumberNotarrive,
            More_than_seven_days__c: this.moreThanSevenDays
          });
          this.column = result.column;
          this.accountInfo = result.accountInfo;
          this.accountId = result.accountInfo.Id;
          this.pageRecords = result.pageRecords;
          this.overlimitdateorderdetails = result.overlimitdateorderdetails;
          this.over_view = result.over_view;
          this.overlimit = result.overlimit;
          this.hasHos = result.hasHos;
          this.product_Limit = result.product_Limit;
          console.log("result==>" + JSON.stringify(result));
          for (var i in this.pageRecords) {
            this.pageRecords[i]["Name__c"] = this.pageRecords[i].Prod.Name__c;
            this.pageRecords[i]["Category3__c"] =
              this.pageRecords[i].Prod.Category3__c;
            this.pageRecords[i]["Category4__c"] =
              this.pageRecords[i].Prod.Category3__c;
            this.pageRecords[i]["Category5__c"] =
              this.pageRecords[i].Prod.Category3__c;
            this.pageRecords[i]["SFDA_Status__c"] =
              this.pageRecords[i].Prod.SFDA_Status__c;
          }
          //hasHos = true 医院特价
          if (this.hasHos) {
            let object1 = {
              label: "医院特价",
              fieldName: "hospitalSpecialOffer",
              hideDefaultActions: true,
              type: "boolean",
              cellAttributes: { alignment: "left" },
              initialWidth: 75
            };
        return function (a, b) {
            a = key(a);
            b = key(b);
            return reverse * ((a > b) - (b > a));
        };
    }
    onHandleSort(event) {
        console.log("Sort");
        this.sortBy = event.detail.fieldName;
        this.sortDirection = event.detail.sortDirection;
        this.currentPageToken = 0;
        console.log('this.sortBy = ' + this.sortBy)
        console.log('this.sortDirection = ' + this.sortDirection)
        const { fieldName: sortedBy, sortDirection } = event.detail;
        const cloneData = [...this.pageRecords];
        cloneData.sort(this.sortByMethod(sortedBy, sortDirection === 'asc' ? 1 : -1));
        this.pageRecords = cloneData;
        this.sortDirection = sortDirection;
        this.sortedBy = sortedBy;
    }
    //分页
    handlePaginatorChange(event) {
        this.recordsToDisplay = event.detail.recordsToDisplay;
        this.preSelected = event.detail.preSelected;
        if (this.recordsToDisplay && this.recordsToDisplay > 0) {
            this.rowNumberOffset = this.recordsToDisplay[0].rowNumber - 1;
            this.columns.push(object1);
            console.log(" this.columns" + this.columns);
            for (var j in this.pageRecords) {
              this.pageRecords[j]["Name__c"] = this.pageRecords[j].Prod.Name__c;
              this.pageRecords[j]["Category3__c"] =
                this.pageRecords[j].Prod.Category3__c;
              this.pageRecords[j]["Category4__c"] =
                this.pageRecords[j].Prod.Category3__c;
              this.pageRecords[j]["Category5__c"] =
                this.pageRecords[j].Prod.Category3__c;
              this.pageRecords[j]["SFDA_Status__c"] =
                this.pageRecords[j].Prod.SFDA_Status__c;
              this.pageRecords[j]["hospitalSpecialOffer__c"] =
                this.pageRecords[j].hospitalSpecialOffer;
            }
          }
          this.showTable = true;
          if (this.product_Limit != null && this.product_Limit != "") {
            var records = this.product_Limit.split(",");
            for (var i in records) {
              var parms = records[i].split("|");
              var record = new Object();
              record["prodName"] = parms[0];
              record["limitLow"] = parms[1];
              record["limitUp"] = parms[2];
              this.productLimitRecords.push(record);
            }
          }
          // this.productLimitRecords = records;
          console.log(
            "productLimitRecords:" + JSON.stringify(this.productLimitRecords)
          );
          console.log("product_Limit:" + this.product_Limit);
          this.consumableorderdetailsRecordsview =
            result.consumableorderdetailsRecordsview;
          //add by WangXueqin 2023/05/05
          this.userPro_Type = result.userPro_Type;
          console.log("this.accountId:" + this.accountId);
          console.log("this.accountInfo:" + JSON.stringify(this.accountInfo));
          this.showSpinner = false;
          this.showPage = true;
          // this.showMyToast('初始化页面成功', '', 'success');
        } else {
            this.rowNumberOffset = 0;
          this.showPage = true;
          this.showSpinner = false;
          console.log("Error:" + result.errorMsg);
          this.showMyToast("初始化页面失败", result.errorMsg, "error");
        }
    }
    handlePrevious() {
        this.currentPageToken = Number(this.currentPageToken) - Number(this.pageSize);
        this.init();
    }
      })
      .catch((error) => {
        this.showSpinner = false;
        console.log("Error:" + error);
        this.showMyToast("初始化页面失败", JSON.stringify(error), "error");
      });
  }
    handleNext() {
        this.currentPageToken = Number(this.currentPageToken) + Number(this.pageSize);
        this.init();
  //点击链接
  clickLick(event) {
    var outputValue = event.detail.data.value;
    var outputType = event.detail.data.type;
    var recordId = event.detail.data.recordId;
    console.log("click:" + outputValue + "---" + outputType + "---" + recordId);
    if (outputType == "Title") {
      const config = {
        type: "standard__webPage",
        attributes: {
          url: "/lexarrivegoods?ESetId=" + recordId
        }
      };
      this[NavigationMixin.Navigate](config);
    } else if (outputType == "TotalNum") {
      this.popTitle = "所有产品一览";
      initTotalNum({ ordId: recordId, type: "" }).then((result) => {
        if (result.result == "Success") {
          this.recordList = result.recordList;
          console.log("data:" + JSON.stringify(this.recordList));
          this.showPop = true;
        } else {
          this.showMyToast(
            "加载所有产品一览页面失败",
            result.errorMsg,
            "error"
          );
        }
      });
    } else if (outputType == "ArrDet") {
      if (recordId == "1") {
        this.popTitle = "所有已到货产品一览";
        initArrDetAll({ type: "" }).then((result) => {
          if (result.result == "Success") {
            this.recordList = result.recordList;
            console.log("data:" + JSON.stringify(this.recordList));
            this.showPop = true;
          } else {
            this.showMyToast(
              "加载所有已到货产品一览页面失败",
              result.errorMsg,
              "error"
            );
          }
        });
      } else {
        this.popTitle = "已到货产品一览";
        initArrDet({ orderId: recordId }).then((result) => {
          if (result.result == "Success") {
            this.recordList = result.recordList;
            console.log("data:" + JSON.stringify(this.recordList));
            this.showPop = true;
          } else {
            this.showMyToast(
              "加载已到货产品一览页面失败",
              result.errorMsg,
              "error"
            );
          }
        });
      }
    } else if (outputType == "DeliveryDet") {
      if (recordId == "1") {
        this.popTitle = "所有已发货还没到货产品一览";
        initDeliveryDetAll({ type: "" }).then((result) => {
          if (result.result == "Success") {
            this.recordList = result.recordList;
            console.log("data:" + JSON.stringify(this.recordList));
            this.showPop = true;
          } else {
            this.showMyToast(
              "加载所有已发货还没到货产品一览页面失败",
              result.errorMsg,
              "error"
            );
          }
        });
      } else {
        this.popTitle = "未到货产品一览";
        initDeliveryDet({ orderId: recordId }).then((result) => {
          if (result.result == "Success") {
            this.recordList = result.recordList;
            console.log("data:" + JSON.stringify(this.recordList));
            this.showPop = true;
          } else {
            this.showMyToast(
              "加载未到货产品一览页面失败",
              result.errorMsg,
              "error"
            );
          }
        });
      }
    } else if (outputType == "NotArrDet") {
      if (recordId == "1") {
        this.popTitle = "所有还没发货产品一览";
        initNotArrDetAll({ type: "" }).then((result) => {
          if (result.result == "Success") {
            this.recordList = result.recordList;
            console.log("data:" + JSON.stringify(this.recordList));
            this.showPop = true;
          } else {
            this.showMyToast(
              "加载所有还没发货产品一览页面失败",
              result.errorMsg,
              "error"
            );
          }
        });
      } else {
        this.popTitle = "还没发货数量";
        initNotArrDet({ orderId: recordId }).then((result) => {
          if (result.result == "Success") {
            this.recordList = result.recordList;
            console.log("data:" + JSON.stringify(this.recordList));
            this.showPop = true;
          } else {
            this.showMyToast(
              "加载还没发货数量页面失败",
              result.errorMsg,
              "error"
            );
          }
        });
      }
    } else if (outputType == "MoreThan7") {
      if (recordId == "1") {
        this.popTitle = "所有发货七天还未到货数";
        initMoreThan7All({ type: "" }).then((result) => {
          if (result.result == "Success") {
            this.recordList = result.recordList;
            console.log("data:" + JSON.stringify(this.recordList));
            this.showPop = true;
          } else {
            this.showMyToast(
              "加载所有发货七天还未到货数页面失败",
              result.errorMsg,
              "error"
            );
          }
        });
      } else {
        this.popTitle = "发货七天还未到货数";
        initMoreThan7({ orderId: recordId }).then((result) => {
          if (result.result == "Success") {
            this.recordList = result.recordList;
            console.log("data:" + JSON.stringify(this.recordList));
            this.showPop = true;
          } else {
            this.showMyToast(
              "加载发货七天还未到货数页面失败",
              result.errorMsg,
              "error"
            );
          }
        });
      }
    }
    handleFirst() {
        this.currentPageToken = 0;
        this.init();
    }
  }
    handleLast() {
        this.currentPageToken = this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
        this.init();
    }
  //关闭弹窗
  closePop() {
    this.showPop = false;
  }
    handlePageschange(event) {
        console.log(event.detail);
        this.pageSize = event.detail;
        this.currentPageToken = 0;
        this.init();
    }
    get previousButtonDisabled() {
        return this.currentPageToken === 0;
    }
  editProductLimit(event) {
    //add by Wang Xueqin 2023/05/05
    let url =
      "/LexProductLimitEdit?accountid=" +
      this.accountId +
      "&userPro_Type=" +
      this.userPro_Type;
    const config = {
      type: "standard__webPage",
      attributes: {
        url: url
      }
    };
    this[NavigationMixin.Navigate](config);
  }
    get nextButtonDisabled() {
        return this.nextPageToken === undefined;
  //新建消耗品订单
  newOrder() {
    this[NavigationMixin.Navigate]({
      type: "standard__objectPage",
      attributes: {
        objectApiName: "Consumable_order__c",
        actionName: "new"
      },
      state: {
        useRecordTypeCheck: 1
      }
    });
  }
  showMyToast(title, message, variant) {
    console.log("show custom message");
    var iconName = "";
    var content = "";
    if (variant == "success") {
      iconName = "utility:check";
    } else {
      iconName = "utility:error";
    }
}
    if (message != "") {
      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);
    // var mode;
    // if(this.isNoteStay){
    //     mode ='sticky';
    // }else{
    //     mode = 'dismissable';
    // }
    // const evt = new ShowToastEvent({
    //     title: title,
    //     message: message,
    //     variant: variant,
    //     mode: mode
    // });
    // this.dispatchEvent(evt);
  }
  //排序
  sortByMethod(field, reverse, primer) {
    const key = primer
      ? function (x) {
          return primer(x[field]);
        }
      : function (x) {
          return x[field];
        };
    return function (a, b) {
      a = key(a);
      b = key(b);
      return reverse * ((a > b) - (b > a));
    };
  }
  onHandleSort(event) {
    console.log("Sort");
    this.sortBy = event.detail.fieldName;
    this.sortDirection = event.detail.sortDirection;
    this.currentPageToken = 0;
    console.log("this.sortBy = " + this.sortBy);
    console.log("this.sortDirection = " + this.sortDirection);
    const { fieldName: sortedBy, sortDirection } = event.detail;
    const cloneData = [...this.pageRecords];
    cloneData.sort(
      this.sortByMethod(sortedBy, sortDirection === "asc" ? 1 : -1)
    );
    this.pageRecords = cloneData;
    this.sortDirection = sortDirection;
    this.sortedBy = sortedBy;
  }
  //分页
  handlePaginatorChange(event) {
    this.recordsToDisplay = event.detail.recordsToDisplay;
    this.preSelected = event.detail.preSelected;
    if (this.recordsToDisplay && this.recordsToDisplay > 0) {
      this.rowNumberOffset = this.recordsToDisplay[0].rowNumber - 1;
    } else {
      this.rowNumberOffset = 0;
    }
  }
  handlePrevious() {
    this.currentPageToken =
      Number(this.currentPageToken) - Number(this.pageSize);
    this.init();
  }
  handleNext() {
    this.currentPageToken =
      Number(this.currentPageToken) + Number(this.pageSize);
    this.init();
  }
  handleFirst() {
    this.currentPageToken = 0;
    this.init();
  }
  handleLast() {
    this.currentPageToken =
      this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
    this.init();
  }
  handlePageschange(event) {
    console.log(event.detail);
    this.pageSize = event.detail;
    this.currentPageToken = 0;
    this.init();
  }
  get previousButtonDisabled() {
    return this.currentPageToken === 0;
  }
  get nextButtonDisabled() {
    return this.nextPageToken === undefined;
  }
}
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js
@@ -64,14 +64,14 @@
      type: "Name",
      sortable: true,
      hideDefaultActions: true,
      initialWidth: 300,
      // initialWidth: 200,
      wrapText: true,
      cellAttributes: { alignment: "left" }
    },
    {
      label: "第三分类",
      fieldName: "Category3__c",
      initialWidth: 120,
      initialWidth: 84,
      cellAttributes: { alignment: "left" },
      hideDefaultActions: true,
      sortable: true,
@@ -81,7 +81,7 @@
      label: "第四分类",
      fieldName: "Category4__c",
      cellAttributes: { alignment: "left" },
      initialWidth: 120,
      initialWidth: 84,
      hideDefaultActions: true,
      wrapText: true,
      sortable: true
@@ -90,7 +90,7 @@
      label: "第五分类",
      fieldName: "Category5__c",
      cellAttributes: { alignment: "left" },
      initialWidth: 120,
      initialWidth: 84,
      hideDefaultActions: true,
      wrapText: true,
      sortable: true
@@ -100,7 +100,7 @@
      label: "规格",
      fieldName: "packing_list",
      cellAttributes: { alignment: "right" },
      initialWidth: 55,
      initialWidth: 50,
      wrapText: true,
      hideDefaultActions: true
    },
@@ -108,7 +108,7 @@
      label: "单位",
      fieldName: "BoxPiece",
      cellAttributes: { alignment: "left" },
      initialWidth: 55,
      initialWidth: 50,
      wrapText: true,
      hideDefaultActions: true
    },
@@ -117,7 +117,7 @@
      fieldName: "approbation_No",
      cellAttributes: { alignment: "left" },
      wrapText: true,
      initialWidth: 200,
      initialWidth: 104,
      hideDefaultActions: true
    },
    {
@@ -126,13 +126,13 @@
      cellAttributes: { alignment: "left" },
      wrapText: true,
      hideDefaultActions: true,
      initialWidth: 110
      initialWidth: 95
    },
    {
      label: "CFDA状态",
      fieldName: "SFDA_Status__c",
      cellAttributes: { alignment: "left" },
      initialWidth: 95,
      initialWidth: 84,
      wrapText: true,
      hideDefaultActions: true
    },
@@ -156,7 +156,7 @@
        boxPrice: { fieldName: "BoxPiece" }
      },
      hideDefaultActions: true,
      initialWidth: 150
      initialWidth: 120
    },
    {
manifest/package.xml
@@ -1,12 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>lexConsumable</members>
        <members>lexSaleAndDelivery</members>
        <name>LightningComponentBundle</name>
    </types>
    <types>
        <members>lexdatatable</members>
        <name>StaticResource</name>
    </types>
    <version>52.0</version>
</Package>