buli
2023-07-13 a046b3fe914e46147334d33bbdcb21e2759a3c43
backup0712
9个文件已修改
16744 ■■■■ 已修改文件
.sf/config.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumable/lexConsumable.html 1911 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumable/lexConsumable.js 3381 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js 1643 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.css 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.html 2583 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js 5262 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html 556 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js 1352 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.sf/config.json
@@ -1,3 +1,3 @@
{
  "target-org": "OlympusProd"
}
}
force-app/main/default/lwc/lexConsumable/lexConsumable.html
@@ -1,191 +1,196 @@
<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">
        <!-- 按钮 -->
        <template if:true={showEditBtn}>
          <!-- <lightning-button style="margin: 5px;" label="编辑" disabled={disabledEditBtn} onclick={editOrder}></lightning-button> -->
          <button
            class="slds-button slds-button_neutral slds-button_stretch lexBorder"
            disabled={disabledEditBtn}
            onclick={editOrder}
          >
            编辑
          </button>
        </template>
        <template if:true={showPrintSheetBtn}>
          <!-- <lightning-button style="margin: 5px;" label="打印配置单" onclick={printOrder}></lightning-button> -->
          <button
            class="slds-button slds-button_neutral slds-button_stretch lexBorder"
            style="margin: 5px"
            label="打印配置单"
            onclick={printOrder}
          >
            打印配置单
          </button>
        </template>
        <template if:true={showUploadSheetBtn}>
          <!-- <lightning-button style="margin: 5px;" label="上传配置单" disabled={disabledUploadSheetBtn} onclick={uploadOrder}></lightning-button> -->
          <button
            class="slds-button slds-button_neutral slds-button_stretch lexBorder"
            style="margin: 5px"
            label="上传配置单"
            disabled={disabledUploadSheetBtn}
            onclick={uploadOrder}
          >
            上传配置单
          </button>
        </template>
        <template if:true={showSubOrderbtn}>
          <!-- <lightning-button style="margin: 5px;" label="提交订单" disabled={disabledSubOrderbtn} onclick={submitOrder}></lightning-button> -->
          <button
            class="slds-button slds-button_neutral slds-button_stretch lexBorder"
            style="margin: 5px"
            label="提交订单"
            disabled={disabledSubOrderbtn}
            onclick={submitOrder}
          >
            提交订单
          </button>
        </template>
        <template if:true={showSaveOrderbtn1}>
          <!-- <lightning-button style="margin: 5px;" label="保存订单" onclick={saveOrder}></lightning-button> -->
          <button
            class="slds-button slds-button_neutral slds-button_stretch lexBorder"
            style="margin: 5px"
            label="保存订单"
            onclick={saveOrder}
          >
            保存订单
          </button>
        </template>
        <template if:true={showSaveOrderbtn2}>
          <!-- <lightning-button style="margin: 5px;" label="保存订单" onclick={orderCopy}></lightning-button> -->
          <button
            class="slds-button slds-button_neutral slds-button_stretch lexBorder"
            style="margin: 5px"
            label="保存订单"
            onclick={orderCopy}
          >
            保存订单
          </button>
        </template>
        <template if:true={showDeleteBtn}>
          <!-- <lightning-button style="margin: 5px;" label="删除" disabled={disabledDeleteBtn} onclick={deleteOrder}></lightning-button> -->
          <button
            class="slds-button slds-button_neutral slds-button_stretch lexBorder"
            style="margin: 5px"
            label="删除"
            disabled={disabledDeleteBtn}
            onclick={deleteOrder}
          >
            删除
          </button>
        </template>
        <!-- <template if:true={showOfferPriceInputBtn}>
    <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">
                <!-- 按钮 -->
                <template if:true={showEditBtn}>
                    <!-- <lightning-button style="margin: 5px;" label="编辑" disabled={disabledEditBtn} onclick={editOrder}></lightning-button> -->
                    <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        disabled={disabledEditBtn}
                        onclick={editOrder}
                    >
                        编辑
                    </button>
                </template>
                <template if:true={showPrintSheetBtn}>
                    <!-- <lightning-button style="margin: 5px;" label="打印配置单" onclick={printOrder}></lightning-button> -->
                    <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        style="margin: 5px"
                        label="打印配置单"
                        onclick={printOrder}
                    >
                        打印配置单
                    </button>
                </template>
                <template if:true={showUploadSheetBtn}>
                    <!-- <lightning-button style="margin: 5px;" label="上传配置单" disabled={disabledUploadSheetBtn} onclick={uploadOrder}></lightning-button> -->
                    <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        style="margin: 5px"
                        label="上传配置单"
                        disabled={disabledUploadSheetBtn}
                        onclick={uploadOrder}
                    >
                        上传配置单
                    </button>
                </template>
                <template if:true={showSubOrderbtn}>
                    <!-- <lightning-button style="margin: 5px;" label="提交订单" disabled={disabledSubOrderbtn} onclick={submitOrder}></lightning-button> -->
                    <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        style="margin: 5px"
                        label="提交订单"
                        disabled={disabledSubOrderbtn}
                        onclick={submitOrder}
                    >
                        提交订单
                    </button>
                </template>
                <template if:true={showSaveOrderbtn1}>
                    <!-- <lightning-button style="margin: 5px;" label="保存订单" onclick={saveOrder}></lightning-button> -->
                    <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        style="margin: 5px"
                        label="保存订单"
                        onclick={saveOrder}
                    >
                        保存订单
                    </button>
                </template>
                <template if:true={showSaveOrderbtn2}>
                    <!-- <lightning-button style="margin: 5px;" label="保存订单" onclick={orderCopy}></lightning-button> -->
                    <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        style="margin: 5px"
                        label="保存订单"
                        onclick={orderCopy}
                    >
                        保存订单
                    </button>
                </template>
                <template if:true={showDeleteBtn}>
                    <!-- <lightning-button style="margin: 5px;" label="删除" disabled={disabledDeleteBtn} onclick={deleteOrder}></lightning-button> -->
                    <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        style="margin: 5px"
                        label="删除"
                        disabled={disabledDeleteBtn}
                        onclick={deleteOrder}
                    >
                        删除
                    </button>
                </template>
                <!-- <template if:true={showOfferPriceInputBtn}>
                    <lightning-button style="margin: 5px;" label="特价金额录入" disabled={disabledOfferPriceInputBtn} onclick={inputOfferPrice}></lightning-button>
                    <lightning-button style="margin: 5px;" label="特价金额录入" disabled={disabledOfferPriceInputBtn} onclick={inputOfferPrice}></lightning-button>
                </template> -->
        <template if:true={showReapplyBtn}>
          <!-- <lightning-button style="margin: 5px;" label="再申请" onclick={reapplyOrder}></lightning-button> -->
          <button
            class="slds-button slds-button_neutral slds-button_stretch lexBorder"
            style="margin: 5px"
            label="再申请"
            onclick={reapplyOrder}
          >
            再申请
          </button>
        </template>
        <p style="height: 10px"></p>
        <!-- 订单信息 -->
        <template if:false={editAble}>
          <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-record-view-form
                record-id={cocId}
                object-api-name="Consumable_order__c"
              >
                <table style="width: 100%">
                  <tbody>
                    <tr>
                      <td style="width: 10%"></td>
                      <td style="width: 40%">
                        <lightning-output-field
                          class="outputfont"
                          field-name="Name"
                        ></lightning-output-field>
                      </td>
                      <td style="width: 40%">
                        <lightning-output-field
                          field-name="Order_status__c"
                        ></lightning-output-field>
                      </td>
                      <td style="width: 10%"></td>
                    </tr>
                    <tr>
                      <td></td>
                      <td>
                        <template if:false={editAble}>
                          <lightning-output-field
                            field-name="Total_amount__c"
                          ></lightning-output-field>
                        </template>
                      </td>
                      <td>
                        <!-- <div class="slds-grid slds-grid_vertical-align-center">
                <template if:true={showReapplyBtn}>
                    <!-- <lightning-button style="margin: 5px;" label="再申请" onclick={reapplyOrder}></lightning-button> -->
                    <button
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        style="margin: 5px"
                        label="再申请"
                        onclick={reapplyOrder}
                    >
                        再申请
                    </button>
                </template>
                <p style="height: 10px"></p>
                <!-- 订单信息 -->
                <template if:false={editAble}>
                    <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-record-view-form
                                record-id={cocId}
                                object-api-name="Consumable_order__c"
                            >
                                <table style="width: 100%">
                                    <tbody>
                                        <tr>
                                            <td style="width: 10%"></td>
                                            <td style="width: 40%">
                                                <lightning-output-field
                                                    class="outputfont"
                                                    field-name="Name"
                                                ></lightning-output-field>
                                            </td>
                                            <td style="width: 40%">
                                                <lightning-output-field
                                                    field-name="Order_status__c"
                                                ></lightning-output-field>
                                            </td>
                                            <td style="width: 10%"></td>
                                        </tr>
                                        <tr>
                                            <td></td>
                                            <td>
                                                <template if:false={editAble}>
                                                    <lightning-output-field
                                                        field-name="Total_amount__c"
                                                    ></lightning-output-field>
                                                </template>
                                            </td>
                                            <td>
                                                <!-- <div class="slds-grid slds-grid_vertical-align-center">
                                                    <div class="slds-form-element__label"><lightning-formatted-text value={contractLabel}></lightning-formatted-text>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
                                                    <lightning-formatted-text value={contractName}></lightning-formatted-text>
                                                </div> -->
                        <!-- style="pointer-events: none;" -->
                        <lightning-output-field
                          class="showContract"
                          field-name="Order_effective_contact__c"
                        ></lightning-output-field>
                      </td>
                      <!-- <td>合同:<lightning-formatted-text value={coc.Order_effective_contact__r.Name}></lightning-formatted-text></td> -->
                      <td></td>
                    </tr>
                    <tr>
                      <td></td>
                      <!-- <td>
                                                <!-- style="pointer-events: none;" -->
                                                <lightning-output-field
                                                    class="showContract"
                                                    field-name="Order_effective_contact__c"
                                                ></lightning-output-field>
                                            </td>
                                            <!-- <td>合同:<lightning-formatted-text value={coc.Order_effective_contact__r.Name}></lightning-formatted-text></td> -->
                                            <td></td>
                                        </tr>
                                        <tr>
                                            <td></td>
                                            <!-- <td>
                                                <template if:false={edoffersPrice}>
                                                    <lightning-output-field id="sumPrice_buttom1" field-name="Offers_Price__c"></lightning-output-field>
                                                </template>
@@ -193,16 +198,18 @@
                                                    <lightning-input label="特价总金额" variant="label-inline" id="sumPrice_buttom2" value={coc.Offers_Price__c} onchange={offerPriceChange}></lightning-input>
                                                </template>
                                            </td> -->
                      <td>
                        <template if:true={showAttUploadDate}>
                          <lightning-output-field
                            field-name="Consumable_pdf_insert_day__c"
                          ></lightning-output-field>
                        </template>
                      </td>
                      <td></td>
                    </tr>
                    <!-- <tr>
                                            <td>
                                                <template
                                                    if:true={showAttUploadDate}
                                                >
                                                    <lightning-output-field
                                                        field-name="Consumable_pdf_insert_day__c"
                                                    ></lightning-output-field>
                                                </template>
                                            </td>
                                            <td></td>
                                        </tr>
                                        <!-- <tr>
                                            <td></td>
                                            <td>
                                                <template if:true={showAttUploadDate}>
@@ -212,103 +219,119 @@
                                            <td></td>
                                            <td></td>
                                        </tr> -->
                    <tr>
                      <td></td>
                      <td>
                        <template if:true={showOrderDate}>
                          <lightning-output-field
                            field-name="Order_date__c"
                          ></lightning-output-field>
                        </template>
                      </td>
                      <td></td>
                      <td></td>
                    </tr>
                    <tr>
                      <td></td>
                      <td colspan="2">
                        <lightning-card
                          class="attListTitle"
                          variant="Narrow"
                          title="附件列表"
                          icon-name="utility:attach"
                        >
                          <lightning-layout slot="footer" multiple-rows="true">
                            <template
                              for:each={attachmentRecoeds}
                              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.fileFullName}
                                  style="margin-left: 20px"
                                  icon-name="doctype:gform"
                                  alternative-text={item.fileFullName}
                                  size="large"
                                ></lightning-icon
                                ><br />
                                <!-- <span style="word-wrap:break-word; word-break:break-all;width:80px;display:flex;" title={item.fileFullName}>
                                        <tr>
                                            <td></td>
                                            <td>
                                                <template
                                                    if:true={showOrderDate}
                                                >
                                                    <lightning-output-field
                                                        field-name="Order_date__c"
                                                    ></lightning-output-field>
                                                </template>
                                            </td>
                                            <td></td>
                                            <td></td>
                                        </tr>
                                        <tr>
                                            <td></td>
                                            <td colspan="2">
                                                <lightning-card
                                                    class="attListTitle"
                                                    variant="Narrow"
                                                    title="附件列表"
                                                    icon-name="utility:attach"
                                                >
                                                    <lightning-layout
                                                        slot="footer"
                                                        multiple-rows="true"
                                                    >
                                                        <template
                                                            for:each={attachmentRecoeds}
                                                            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.fileFullName}
                                                                    style="
                                                                        margin-left: 20px;
                                                                    "
                                                                    icon-name="doctype:gform"
                                                                    alternative-text={item.fileFullName}
                                                                    size="large"
                                                                ></lightning-icon
                                                                ><br />
                                                                <!-- <span style="word-wrap:break-word; word-break:break-all;width:80px;display:flex;" title={item.fileFullName}>
                                                                    {item.fileName}
                                                                </span> -->
                                <div
                                  title={item.fileFullName}
                                  style="
                                    width: 100px;
                                    text-overflow: ellipsis;
                                    overflow: hidden;
                                    white-space: nowrap;
                                  "
                                >
                                  {item.fileName}
                                </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.recordId}
                                    onclick={deleteAtt}
                                  >
                                    删除
                                  </a>
                                </p>
                                <!-- <p>{item.updateDate} · {item.ownerName}</p> -->
                              </lightning-layout-item>
                            </template>
                          </lightning-layout>
                        </lightning-card>
                      </td>
                      <td></td>
                    </tr>
                  </tbody>
                </table>
              </lightning-record-view-form>
            </div>
          </div>
        </template>
        <!-- searchBlock -->
        <template if:true={editAble}>
          <div
            style="
              border: 1px solid #d4d4d4;
              border-top: 3px solid #51606e;
              border-radius: 5px;
              margin-bottom: 7px;
            "
          >
            <div style="padding: 10px">
              <table>
                <tbody>
                  <!-- <tr>
                                                                <div
                                                                    title={item.fileFullName}
                                                                    style="
                                                                        width: 100px;
                                                                        text-overflow: ellipsis;
                                                                        overflow: hidden;
                                                                        white-space: nowrap;
                                                                    "
                                                                >
                                                                    {item.fileName}
                                                                </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.recordId}
                                                                        onclick={deleteAtt}
                                                                    >
                                                                        删除
                                                                    </a>
                                                                </p>
                                                                <!-- <p>{item.updateDate} · {item.ownerName}</p> -->
                                                            </lightning-layout-item>
                                                        </template>
                                                    </lightning-layout>
                                                </lightning-card>
                                            </td>
                                            <td></td>
                                        </tr>
                                    </tbody>
                                </table>
                            </lightning-record-view-form>
                        </div>
                    </div>
                </template>
                <!-- searchBlock -->
                <template if:true={editAble}>
                    <div
                        style="
                            border: 1px solid #d4d4d4;
                            border-top: 3px solid #51606e;
                            border-radius: 5px;
                            margin-bottom: 7px;
                        "
                    >
                        <div style="padding: 10px">
                            <table>
                                <tbody>
                                    <!-- <tr>
                                        <td style="width: 100px;">
                                            <div style="color:#696969;font-size:16px;"><span style="color: red;">*&nbsp;</span>合同</div>
                                        </td>
@@ -338,309 +361,365 @@
                                            <button class="slds-button slds-button_neutral slds-button_stretch lexclearStyle" style="width:80px;height:32px;" label="清空" onclick={clear}>清空</button>
                                        </td>
                                    </tr> -->
                  <!-- <tr style="height: 10px;"></tr> -->
                  <tr>
                    <td>
                      <div style="color: #696969; font-size: 16px">
                        消耗品名称
                      </div>
                    </td>
                    <td>
                      <lightning-input
                        class="inputFont"
                        variant="label-hidden"
                        label="消耗品名称"
                        value={category1}
                        onchange={category1Change}
                      ></lightning-input>
                    </td>
                    <td></td>
                    <td>
                      <div style="color: #696969; font-size: 16px">第3分类</div>
                    </td>
                    <td>
                      <lightning-combobox
                        class="inputFont"
                        variant="label-hidden"
                        label="第3分类"
                        value={category3}
                        options={category3Option}
                        onchange={category3Change}
                      ></lightning-combobox>
                    </td>
                    <td style="width: 30px"></td>
                    <td style="width: 66px">
                      <div style="color: #696969; font-size: 16px">第4分类</div>
                    </td>
                    <td>
                      <lightning-combobox
                        class="inputFont"
                        variant="label-hidden"
                        label="第4分类"
                        value={category4}
                        options={category4Option}
                        onchange={category4Change}
                      ></lightning-combobox>
                    </td>
                    <td></td>
                    <td style="width: 66px">
                      <div style="color: #696969; font-size: 16px">第5分类</div>
                    </td>
                    <td style="width: 160px">
                      <lightning-combobox
                        class="inputFont"
                        variant="label-hidden"
                        label="第5分类"
                        value={category5}
                        options={category5Option}
                        onchange={category5Change}
                      ></lightning-combobox>
                    </td>
                  </tr>
                  <tr style="height: 10px"></tr>
                  <tr>
                    <td style="width: 100px">
                      <div style="color: #696969; font-size: 16px">
                        <span style="color: red">*&nbsp;</span>合同
                      </div>
                    </td>
                    <td style="width: 320px">
                      <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
                          class="inputFont"
                          variant="label-hidden"
                          label="合同"
                          placeholder="请选择合同"
                          value={contractName}
                          onchange={changeCon}
                          onclick={showSearchCon}
                        ></lightning-input>
                      </div>
                    </td>
                    <td style="width: 30px"></td>
                    <td style="width: 66px">
                      <template if:true={showHospital}>
                        <div style="color: #696969; font-size: 16px">
                          <span style="color: red">*&nbsp;</span>医院
                                    <!-- <tr style="height: 10px;"></tr> -->
                                    <tr>
                                        <td>
                                            <div
                                                style="
                                                    color: #696969;
                                                    font-size: 16px;
                                                "
                                            >
                                                消耗品名称
                                            </div>
                                        </td>
                                        <td>
                                            <lightning-input
                                                class="inputFont"
                                                variant="label-hidden"
                                                label="消耗品名称"
                                                value={category1}
                                                onchange={category1Change}
                                            ></lightning-input>
                                        </td>
                                        <td></td>
                                        <td>
                                            <div
                                                style="
                                                    color: #696969;
                                                    font-size: 16px;
                                                "
                                            >
                                                第3分类
                                            </div>
                                        </td>
                                        <td>
                                            <lightning-combobox
                                                class="inputFont"
                                                variant="label-hidden"
                                                label="第3分类"
                                                value={category3}
                                                options={category3Option}
                                                onchange={category3Change}
                                            ></lightning-combobox>
                                        </td>
                                        <td style="width: 30px"></td>
                                        <td style="width: 66px">
                                            <div
                                                style="
                                                    color: #696969;
                                                    font-size: 16px;
                                                "
                                            >
                                                第4分类
                                            </div>
                                        </td>
                                        <td>
                                            <lightning-combobox
                                                class="inputFont"
                                                variant="label-hidden"
                                                label="第4分类"
                                                value={category4}
                                                options={category4Option}
                                                onchange={category4Change}
                                            ></lightning-combobox>
                                        </td>
                                        <td></td>
                                        <td style="width: 66px">
                                            <div
                                                style="
                                                    color: #696969;
                                                    font-size: 16px;
                                                "
                                            >
                                                第5分类
                                            </div>
                                        </td>
                                        <td style="width: 160px">
                                            <lightning-combobox
                                                class="inputFont"
                                                variant="label-hidden"
                                                label="第5分类"
                                                value={category5}
                                                options={category5Option}
                                                onchange={category5Change}
                                            ></lightning-combobox>
                                        </td>
                                    </tr>
                                    <tr style="height: 10px"></tr>
                                    <tr>
                                        <td style="width: 100px">
                                            <div
                                                style="
                                                    color: #696969;
                                                    font-size: 16px;
                                                "
                                            >
                                                <span style="color: red"
                                                    >*&nbsp;</span
                                                >合同
                                            </div>
                                        </td>
                                        <td style="width: 320px">
                                            <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
                                                    class="inputFont"
                                                    variant="label-hidden"
                                                    label="合同"
                                                    placeholder="请选择合同"
                                                    value={contractName}
                                                    onchange={changeCon}
                                                    onclick={showSearchCon}
                                                ></lightning-input>
                                            </div>
                                        </td>
                                        <td style="width: 30px"></td>
                                        <td style="width: 66px">
                                            <template if:true={showHospital}>
                                                <div
                                                    style="
                                                        color: #696969;
                                                        font-size: 16px;
                                                    "
                                                >
                                                    <span style="color: red"
                                                        >*&nbsp;</span
                                                    >医院
                                                </div>
                                            </template>
                                        </td>
                                        <td
                                            colspan="4"
                                            style="
                                                padding-bottom: 5px;
                                                padding-top: 5px;
                                            "
                                        >
                                            <template if:true={showHospital}>
                                                <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
                                                        class="inputFont"
                                                        variant="label-hidden"
                                                        label="医院"
                                                        placeholder="请选择医院"
                                                        value={hospitalName}
                                                        onclick={showSearchHos}
                                                        onchange={changeHos}
                                                    ></lightning-input>
                                                </div>
                                            </template>
                                        </td>
                                        <td style="width: 30px"></td>
                                        <td colspan="2">
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                                                style="
                                                    width: 130px;
                                                    height: 32px;
                                                    margin-right: 10px;
                                                "
                                                label="消耗品搜索"
                                                onclick={searchProduct}
                                            >
                                                消耗品搜索
                                            </button>
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
                                                style="
                                                    width: 80px;
                                                    height: 32px;
                                                "
                                                label="清空"
                                                onclick={clear}
                                            >
                                                清空
                                            </button>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                      </template>
                    </td>
                    <td
                      colspan="4"
                      style="padding-bottom: 5px; padding-top: 5px"
                    </div>
                </template>
                <!-- 警告提醒 -->
                <template if:true={hasWarning}>
                    <div
                        style="
                            border: 1px solid #d4d4d4;
                            border-radius: 5px;
                            margin-bottom: 7px;
                        "
                    >
                      <template if:true={showHospital}>
                        <div
                          class="slds-form-element__control slds-input-has-icon slds-input-has-icon_right"
                            style="
                                border-bottom: 1px solid #d4d4d4;
                                border-radius: 5px;
                                margin-bottom: 7px;
                                color: #ff6a00;
                                font-size: 17px;
                            "
                        >
                          <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
                            class="inputFont"
                            variant="label-hidden"
                            label="医院"
                            placeholder="请选择医院"
                            value={hospitalName}
                            onclick={showSearchHos}
                            onchange={changeHos}
                          ></lightning-input>
                            <lightning-icon
                                style="margin: 3px"
                                icon-name="utility:warning"
                                size="small"
                            ></lightning-icon>
                            <strong>&nbsp;&nbsp;&nbsp;警告</strong>
                        </div>
                      </template>
                    </td>
                    <td style="width: 30px"></td>
                    <td colspan="2">
                      <button
                        class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                        style="width: 130px; height: 32px; margin-right: 10px"
                        label="消耗品搜索"
                        onclick={searchProduct}
                      >
                        消耗品搜索
                      </button>
                      <button
                        class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
                        style="width: 80px; height: 32px"
                        label="清空"
                        onclick={clear}
                      >
                        清空
                      </button>
                    </td>
                  </tr>
                </tbody>
              </table>
                        <template for:each={warningMsgs} for:item="msg">
                            <p
                                key={msg}
                                style="
                                    color: #ff6a00;
                                    padding-left: 7px;
                                    font-size: 16px;
                                    margin-bottom: 7px;
                                "
                            >
                                &nbsp;&nbsp;&nbsp;・&nbsp;{msg}
                            </p>
                        </template>
                    </div>
                </template>
                <!-- 报错提醒 -->
                <template if:true={hasError}>
                    <div
                        style="
                            border: 1px solid #d4d4d4;
                            border-radius: 5px;
                            margin-bottom: 7px;
                        "
                    >
                        <div
                            style="
                                border-bottom: 1px solid #d4d4d4;
                                border-radius: 5px;
                                margin-bottom: 7px;
                                color: red;
                                font-size: 17px;
                            "
                        >
                            <lightning-icon
                                style="margin: 3px"
                                icon-name="utility:error"
                                size="small"
                            ></lightning-icon>
                            <strong>&nbsp;&nbsp;&nbsp;错误</strong>
                        </div>
                        <template for:each={errorMsgs} for:item="msg">
                            <p
                                key={msg}
                                style="
                                    color: red;
                                    padding-left: 7px;
                                    font-size: 16px;
                                    margin-bottom: 7px;
                                "
                            >
                                &nbsp;&nbsp;&nbsp;・&nbsp;{msg}
                            </p>
                        </template>
                    </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>
                            <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">
                        <template if:true={editAble}>
                            <c-lex-custom-lightning-datatable
                                class="wrapped-header-datatable"
                                style="
                                    word-wrap: break-word;
                                    word-break: break-all;
                                "
                                key-field="recordId"
                                data={currentRecord}
                                columns={cols}
                                selected-rows={selectRows}
                                onrowselection={checkRows}
                                onchangevalue={conCountChange}
                                onvalueblur={conCountBlur}
                                default-sort-direction="asc"
                                sorted-direction={sortDirection}
                                sorted-by={sortedBy}
                                onsort={onHandleSort}
                            ></c-lex-custom-lightning-datatable>
                            <c-paginator
                                onprevious={prePageClick}
                                onnext={nextPageClick}
                                onpageschange={pageSizeChange}
                                onfirst={goFirstPage}
                                onlast={goLastPage}
                                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}>
                            <c-lex-custom-lightning-datatable
                                class="wrapped-header-datatable"
                                style="
                                    word-wrap: break-word;
                                    word-break: break-all;
                                "
                                hide-checkbox-column
                                key-field="recordId"
                                data={consumableorderdetailsRecordsview}
                                columns={cols}
                            ></c-lex-custom-lightning-datatable>
                            <c-paginator
                                onprevious={prePageClick}
                                onnext={nextPageClick}
                                onpageschange={pageSizeChange}
                                onfirst={goFirstPage}
                                onlast={goLastPage}
                                page-size-options={pageSizeOptions}
                                previous-button-disabled={previousButtonDisabled}
                                next-button-disabled={nextButtonDisabled}
                                record-start={recordStart}
                                record-end={recordEnd}
                                total-records={totalRecords}
                            ></c-paginator>
                        </template>
                    </div>
                </div>
            </div>
          </div>
        </template>
        <!-- 警告提醒 -->
        <template if:true={hasWarning}>
          <div
            style="
              border: 1px solid #d4d4d4;
              border-radius: 5px;
              margin-bottom: 7px;
            "
          >
            <div
              style="
                border-bottom: 1px solid #d4d4d4;
                border-radius: 5px;
                margin-bottom: 7px;
                color: #ff6a00;
                font-size: 17px;
              "
            >
              <lightning-icon
                style="margin: 3px"
                icon-name="utility:warning"
                size="small"
              ></lightning-icon>
              <strong>&nbsp;&nbsp;&nbsp;警告</strong>
            </div>
            <template for:each={warningMsgs} for:item="msg">
              <p
                key={msg}
                style="
                  color: #ff6a00;
                  padding-left: 7px;
                  font-size: 16px;
                  margin-bottom: 7px;
                "
              >
                &nbsp;&nbsp;&nbsp;・&nbsp;{msg}
              </p>
            </template>
          </div>
        </template>
        <!-- 报错提醒 -->
        <template if:true={hasError}>
          <div
            style="
              border: 1px solid #d4d4d4;
              border-radius: 5px;
              margin-bottom: 7px;
            "
          >
            <div
              style="
                border-bottom: 1px solid #d4d4d4;
                border-radius: 5px;
                margin-bottom: 7px;
                color: red;
                font-size: 17px;
              "
            >
              <lightning-icon
                style="margin: 3px"
                icon-name="utility:error"
                size="small"
              ></lightning-icon>
              <strong>&nbsp;&nbsp;&nbsp;错误</strong>
            </div>
            <template for:each={errorMsgs} for:item="msg">
              <p
                key={msg}
                style="
                  color: red;
                  padding-left: 7px;
                  font-size: 16px;
                  margin-bottom: 7px;
                "
              >
                &nbsp;&nbsp;&nbsp;・&nbsp;{msg}
              </p>
            </template>
          </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>
              <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">
            <template if:true={editAble}>
              <c-lex-custom-lightning-datatable
                class="wrapped-header-datatable"
                style="word-wrap: break-word; word-break: break-all"
                key-field="recordId"
                data={currentRecord}
                columns={cols}
                selected-rows={selectRows}
                onrowselection={checkRows}
                onchangevalue={conCountChange}
                onvalueblur={conCountBlur}
                default-sort-direction="asc"
                sorted-direction={sortDirection}
                sorted-by={sortedBy}
                onsort={onHandleSort}
              ></c-lex-custom-lightning-datatable>
              <c-paginator
                onprevious={prePageClick}
                onnext={nextPageClick}
                onpageschange={pageSizeChange}
                onfirst={goFirstPage}
                onlast={goLastPage}
                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}>
              <c-lex-custom-lightning-datatable
                class="wrapped-header-datatable"
                style="word-wrap: break-word; word-break: break-all"
                hide-checkbox-column
                key-field="recordId"
                data={consumableorderdetailsRecordsview}
                columns={cols}
              ></c-lex-custom-lightning-datatable>
              <c-paginator
                onprevious={prePageClick}
                onnext={nextPageClick}
                onpageschange={pageSizeChange}
                onfirst={goFirstPage}
                onlast={goLastPage}
                page-size-options={pageSizeOptions}
                previous-button-disabled={previousButtonDisabled}
                next-button-disabled={nextButtonDisabled}
                record-start={recordStart}
                record-end={recordEnd}
                total-records={totalRecords}
              ></c-paginator>
            </template>
          </div>
        </div>
      </div>
    </div>
    <!-- 附件 -->
    <!-- <template if:false={editAble}>
        <!-- 附件 -->
        <!-- <template if:false={editAble}>
            <div style="border: 1px solid #D4D4D4;border-top: 3px solid #51606E;border-radius:5px;margin-top:10px;">
                <div style="border-bottom: 1px solid #D4D4D4;padding:3px;">
                    <lightning-layout>
@@ -656,332 +735,366 @@
                </div>
            </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}
        <!-- 上传附件弹窗 -->
        <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"
            >
              <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"
          >
            <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 if:true={showPopSpinner}>
                    <lightning-spinner
                        size="medium"
                        variant="brand"
                    ></lightning-spinner>
                </template>
              </p>
            </div>
          </div>
          <footer class="slds-modal__footer">
            <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="取消" onclick={closePop}></lightning-button>
                <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"
                        >
                            上传配置单
                        </h2>
                    </header>
                    <div
                        class="slds-modal__content slds-p-around_medium"
                        id="modal-content-id-1"
                        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={uploadAtt}></lightning-button> -->
            <button
              class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
              style="margin-left: 10px"
              variant="neutral"
              label="取消"
              onclick={closePop}
                        <button
                            class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
                            style="margin-left: 10px"
                            variant="neutral"
                            label="取消"
                            onclick={closePop}
                        >
                            取消
                        </button>
                        <button
                            class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                            style="margin-left: 10px"
                            variant="neutral"
                            label="上传"
                            onclick={uploadAtt}
                        >
                            上传
                        </button>
                    </footer>
                </div>
            </section>
            <div class="slds-backdrop slds-backdrop_open"></div>
        </template>
        <!-- 搜索医院 -->
        <template if:true={showAttHosPop}>
            <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"
            >
              取消
            </button>
            <button
              class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
              style="margin-left: 10px"
              variant="neutral"
              label="上传"
              onclick={uploadAtt}
            >
              上传
            </button>
          </footer>
        </div>
      </section>
      <div class="slds-backdrop slds-backdrop_open"></div>
    </template>
    <!-- 搜索医院 -->
    <template if:true={showAttHosPop}>
      <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={closeHospitalPop}
            >
              <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"
          >
            <table style="width: 100%">
              <tbody>
                <tr>
                  <td style="width: 74px">
                <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={closeHospitalPop}
                        >
                            <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
                      style="color: #696969; font-size: 16px; text-align: left"
                        class="slds-modal__content slds-p-around_medium"
                        id="modal-content-id-2"
                        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={searchNameHos}
                                            onchange={searchNameHosChange}
                                        ></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={searchHos}
                                        >
                                            搜索
                                        </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>
                            </div>
                        </div>
                    </div>
                  </td>
                  <td style="width: 60%">
                    <lightning-input
                      class="inputFont"
                      label="医院名称"
                      variant="label-hidden"
                      placeholder="请输入医院名称"
                      value={searchNameHos}
                      onchange={searchNameHosChange}
                    ></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={searchHos}
                    <footer class="slds-modal__footer">
                        <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="取消" onclick={closeHospitalPop}></lightning-button> -->
                        <button
                            class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
                            label="取消"
                            onclick={closeHospitalPop}
                        >
                            取消
                        </button>
                        <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="确认" onclick={confirmHospital}></lightning-button> -->
                    </footer>
                </div>
            </section>
            <div class="slds-backdrop slds-backdrop_open"></div>
        </template>
        <!-- 搜索合同 -->
        <template if:true={showConPop}>
            <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>
                  </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>
              </div>
            </div>
          </div>
          <footer class="slds-modal__footer">
            <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="取消" onclick={closeHospitalPop}></lightning-button> -->
            <button
              class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
              label="取消"
              onclick={closeHospitalPop}
            >
              取消
            </button>
            <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="确认" onclick={confirmHospital}></lightning-button> -->
          </footer>
        </div>
      </section>
      <div class="slds-backdrop slds-backdrop_open"></div>
    </template>
    <!-- 搜索合同 -->
    <template if:true={showConPop}>
      <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={closeContractPop}
            >
              <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-03"
              class="slds-text-heading_medium slds-hyphenate"
            >
              合同检索
            </h2>
          </header>
          <div
            class="slds-modal__content slds-p-around_medium"
            id="modal-content-id-3"
            style="border: 1px solid #f3f3f3"
          >
            <table style="width: 100%">
              <tbody>
                <tr>
                  <td style="width: 74px">
                        <button
                            style=""
                            class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
                            title="Close"
                            onclick={closeContractPop}
                        >
                            <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-03"
                            class="slds-text-heading_medium slds-hyphenate"
                        >
                            合同检索
                        </h2>
                    </header>
                    <div
                      style="color: #696969; font-size: 16px; text-align: left"
                        class="slds-modal__content slds-p-around_medium"
                        id="modal-content-id-3"
                        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={searchNameCon}
                                            onchange={searchNameConChange}
                                        ></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={searchCon}
                                        >
                                            搜索
                                        </button>
                                    </td>
                                    <!-- <td><lightning-button label="搜索" onclick={searchCon}></lightning-button></td> -->
                                </tr>
                            </tbody>
                        </table>
                        <p style="height: 10px"></p>
                        <!-- <p>已选择合同:{chooseContract}</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>
                            </div>
                            <div style="padding: 20px">
                                <lightning-datatable
                                    class="wrapped-header-datatable"
                                    key-field="id"
                                    hide-checkbox-column="true"
                                    data={contractList}
                                    columns={conCols}
                                    onrowaction={chooseCon}
                                ></lightning-datatable>
                            </div>
                        </div>
                    </div>
                  </td>
                  <td style="width: 60%">
                    <lightning-input
                      class="inputFont"
                      label="合同名称"
                      variant="label-hidden"
                      placeholder="请输入合同名称"
                      value={searchNameCon}
                      onchange={searchNameConChange}
                    ></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={searchCon}
                    >
                      搜索
                    </button>
                  </td>
                  <!-- <td><lightning-button label="搜索" onclick={searchCon}></lightning-button></td> -->
                </tr>
              </tbody>
            </table>
            <p style="height: 10px"></p>
            <!-- <p>已选择合同:{chooseContract}</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>
              </div>
              <div style="padding: 20px">
                <lightning-datatable
                  class="wrapped-header-datatable"
                  key-field="id"
                  hide-checkbox-column="true"
                  data={contractList}
                  columns={conCols}
                  onrowaction={chooseCon}
                ></lightning-datatable>
              </div>
            </div>
          </div>
          <footer class="slds-modal__footer">
            <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="取消" onclick={closeContractPop}></lightning-button> -->
            <button
              class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
              label="取消"
              onclick={closeContractPop}
            >
              取消
            </button>
            <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="确认" onclick={confirmContract}></lightning-button> -->
          </footer>
        </div>
      </section>
      <div class="slds-backdrop slds-backdrop_open"></div>
                    <footer class="slds-modal__footer">
                        <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="取消" onclick={closeContractPop}></lightning-button> -->
                        <button
                            class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
                            label="取消"
                            onclick={closeContractPop}
                        >
                            取消
                        </button>
                        <!-- <lightning-button style="margin-left: 10px;" variant="neutral" label="确认" onclick={confirmContract}></lightning-button> -->
                    </footer>
                </div>
            </section>
            <div class="slds-backdrop slds-backdrop_open"></div>
        </template>
    </template>
  </template>
</template>
</template>
force-app/main/default/lwc/lexConsumable/lexConsumable.js
@@ -1,1703 +1,1778 @@
import { LightningElement, wire, api, track } from "lwc";
import { CurrentPageReference } from "lightning/navigation";
import { ShowToastEvent } from "lightning/platformShowToastEvent";
import { NavigationMixin } from "lightning/navigation";
import initPage from "@salesforce/apex/LexConsumableController.init";
import categoryAllload from "@salesforce/apex/LexConsumableController.categoryAllload";
import categoryload from "@salesforce/apex/LexConsumableController.categoryload";
import searchConsumableorderdetails from "@salesforce/apex/LexConsumableController.searchConsumableorderdetails";
import searchorderdetails from "@salesforce/apex/LexConsumableController.searchorderdetails";
import save from "@salesforce/apex/LexConsumableController.save";
import ordrCopy from "@salesforce/apex/LexConsumableController.ordrCopy";
import setEditAble from "@salesforce/apex/LexConsumableController.setEditAble";
import backOrder from "@salesforce/apex/LexConsumableController.backOrder";
import delConsumable from "@salesforce/apex/LexConsumableController.delConsumable";
import sorder from "@salesforce/apex/LexConsumableController.sorder";
import filesUpload from "@salesforce/apex/LexConsumableController.filesUpload";
import initHospital from "@salesforce/apex/LexSearchHospitalController.init";
import searchHospital from "@salesforce/apex/LexSearchHospitalController.searchHospital";
import initContract from "@salesforce/apex/LexSearchContractController.init";
import searchContract from "@salesforce/apex/LexSearchContractController.searchContract";
import deleteAtt from "@salesforce/apex/LexConsumableController.deleteAtt";
import { LightningElement, wire, api, track } from 'lwc';
import { CurrentPageReference } from 'lightning/navigation';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { NavigationMixin } from 'lightning/navigation';
import initPage from '@salesforce/apex/LexConsumableController.init';
import categoryAllload from '@salesforce/apex/LexConsumableController.categoryAllload';
import categoryload from '@salesforce/apex/LexConsumableController.categoryload';
import searchConsumableorderdetails from '@salesforce/apex/LexConsumableController.searchConsumableorderdetails';
import searchorderdetails from '@salesforce/apex/LexConsumableController.searchorderdetails';
import save from '@salesforce/apex/LexConsumableController.save';
import ordrCopy from '@salesforce/apex/LexConsumableController.ordrCopy';
import setEditAble from '@salesforce/apex/LexConsumableController.setEditAble';
import backOrder from '@salesforce/apex/LexConsumableController.backOrder';
import delConsumable from '@salesforce/apex/LexConsumableController.delConsumable';
import sorder from '@salesforce/apex/LexConsumableController.sorder';
import filesUpload from '@salesforce/apex/LexConsumableController.filesUpload';
import initHospital from '@salesforce/apex/LexSearchHospitalController.init';
import searchHospital from '@salesforce/apex/LexSearchHospitalController.searchHospital';
import initContract from '@salesforce/apex/LexSearchContractController.init';
import searchContract from '@salesforce/apex/LexSearchContractController.searchContract';
import deleteAtt from '@salesforce/apex/LexConsumableController.deleteAtt';
//table css
import { loadStyle } from "lightning/platformResourceLoader";
import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
import { loadStyle } from 'lightning/platformResourceLoader';
import WrappedHeaderTable from '@salesforce/resourceUrl/lexdatatable';
export default class LexConsumable extends NavigationMixin(LightningElement) {
  //页面基础数据
  @track editAble;
  @track pageType;
  @track esetId;
  @track keyWords;
  @track coc;
  @track cocId;
  @track userWorkLocation;
  @track accountName;
  @track accountid;
  @track specialCampaign = false;
  @track dealerProductId = [];
  @track category1;
  @track category3 = "";
  @track category4 = "";
  @track category5 = "";
  @track category_Goods;
  @track category3Option = [];
  @track category4Option = [];
  @track category5Option = [];
  @track consumableorderdetailsRecordsview = [];
  @track currentRecord = []; //分页
  @track selectRows = [];
  @track attachmentRecoeds = [];
  @track contactDealer = [];
  @track proLimitAndDate = [];
  @track agencyProType;
  @track agencyProType1;
  @track OSHFLG = false;
  @track bargainPrice;
  @track showOrderDate = false;
  @track showAttUploadDate = false;
  @track edoffersPrice = false;
  @track editDelCommitBtnDisabled = false;
  @track showEditBtn = false;
  @track disabledEditBtn = false;
  @track showPrintSheetBtn = false;
  @track showUploadSheetBtn = false;
  @track disabledUploadSheetBtn = false;
  @track showSubOrderbtn = false;
  @track disabledSubOrderbtn = false;
  @track showSaveOrderbtn1 = false;
  @track showSaveOrderbtn2 = false;
  @track showDeleteBtn = false;
  @track disabledDeleteBtn = false;
  @track showOfferPriceInputBtn = false;
  @track disabledOfferPriceInputBtn = false;
  @track showReapplyBtn = false;
  @track showHospital = false;
  @track showPage = false;
  @track cansee = false;
  @track showSpinner = true;
  @track showPopSpinner = false;
  stylesLoaded = false;
  //是否一直显示提示
  @track isNoteStay = true;
  //排序相关
  @track sortDirection = "asc";
  @track sortedBy;
  //分页
  @track currentPage = 1;
  @track pageSize = 10;
  // @track totalPage = 0;
  @track pageSizeOptions = [10, 25, 50, 100];
  @track recordStart = 0;
  @track recordEnd = 0;
  //报错提醒
  // @track hasError = false;
  @track errorMsgs = [];
  // @track hasWarning = false;
  @track warningMsgs = [];
  //附件上传
  @track showAttPop = false;
  @track filesUploaded = [];
  @track fileName;
  file;
  fileContents;
  fileReader;
  content;
  //医院搜索
  @track showAttHosPop = false;
  @track hospitalList = [];
  @track searchNameHos;
  @track chooseHospital;
  @track chooseHospitalId;
  @track hospitalId;
  @track hospitalName;
  @track tempidHp;
  @track hosCols = [
    // {label:'医院名称',fieldName:'Name',type:'button',typeAttributes:{label:{fieldName:'Name'},variant:'base'}},
    {
      label: "",
      type: "button",
      typeAttributes: { label: "选择" },
      initialWidth: 90,
      hideDefaultActions: true,
      wrapText: true
    },
    {
      label: "医院名称",
      fieldName: "Name",
      initialWidth: 380,
      wrapText: true,
      hideDefaultActions: true
    },
    {
      label: "省份",
      fieldName: "StateMaster",
      initialWidth: 80,
      hideDefaultActions: true,
      wrapText: true
    },
    {
      label: "地址",
      fieldName: "Address__c",
      hideDefaultActions: true,
      wrapText: true
    }
  ];
  //合同搜索
  @track contractLabel;
  @track showConPop = false;
  @track contractList = [];
  @track searchNameCon;
  @track chooseContract;
  @track chooseContractId;
  @track contractId;
  @track contractName;
  @track tempidPp;
  @track conCols = [
    {
      label: "",
      type: "button",
      typeAttributes: { label: "选择" },
      initialWidth: 90,
      hideDefaultActions: true,
      wrapText: true
    },
    {
      label: "合同名称",
      fieldName: "Name",
      wrapText: true,
      hideDefaultActions: true
    },
    {
      label: "省份",
      fieldName: "StateMaster",
      initialWidth: 80,
      hideDefaultActions: true,
      wrapText: true
    },
    {
      label: "申请销售课",
      fieldName: "Sales_Section__c",
      initialWidth: 160,
      hideDefaultActions: true,
      wrapText: true
    },
    {
      label: "允许报价期间(开始日)",
      fieldName: "Contract_Decide_Start_Date__c",
      initialWidth: 175,
      hideDefaultActions: true,
      wrapText: true
    },
    {
      label: "允许报价期间(结束日)",
      fieldName: "Contract_Decide_End_Date__c",
      initialWidth: 175,
      hideDefaultActions: true,
      wrapText: true
    }
  ];
  //消耗品数据col
  get cols() {
    var cols = [];
    cols.push({
      label: "消耗品名称",
      fieldName: "prodName",
      wrapText: true,
      hideDefaultActions: true,
      sortable: true
      // initialWidth: 136
    });
    cols.push({
      label: "规格",
      fieldName: "packing_list",
      wrapText: true,
      hideDefaultActions: true,
      initialWidth: 50,
      cellAttributes: { alignment: "right" }
    });
    cols.push({
      label: "CFDA状态",
      fieldName: "prodSFDAStatus",
      wrapText: true,
      hideDefaultActions: true,
      initialWidth: 84
    });
    cols.push({
      label: "注册证编码号",
      fieldName: "approbation_No",
      wrapText: true,
      hideDefaultActions: true,
      initialWidth: 104
    });
    cols.push({
      label: "注册证效期",
      fieldName: "expiration_Date",
      wrapText: true,
      hideDefaultActions: true,
      initialWidth: 95
    });
    cols.push({
      label: "第3分类",
      fieldName: "prodCategory3",
      wrapText: true,
      hideDefaultActions: true,
      initialWidth: 84,
      sortable: true
    });
    cols.push({
      label: "第4分类",
      fieldName: "prodCategory4",
      wrapText: true,
      hideDefaultActions: true,
      initialWidth: 84,
      sortable: true
    });
    cols.push({
      label: "第5分类",
      fieldName: "prodCategory5",
      wrapText: true,
      hideDefaultActions: true,
      initialWidth: 84,
      sortable: true
    });
    if (this.cansee) {
      cols.push({
        label: "标准单价",
        type: "number",
        typeAttributes: { minimumFractionDigits: 2 },
        fieldName: "prodIntraTradeList",
        hideDefaultActions: true,
        initialWidth: 78
      });
    }
    if (this.editAble) {
      cols.push({
        label: "采购数量",
        type: "customTableInput",
        typeAttributes: {
          recordId: { fieldName: "recordId" },
          inputValue: { fieldName: "consumableCount" },
          upperLimit: { fieldName: "upperlimit" },
          lowerLimit: { fieldName: "lowerlimit" },
          allnumber: { fieldName: "allnumber" },
          valueType: "Number"
    //页面基础数据
    @track editAble;
    @track pageType;
    @track esetId;
    @track keyWords;
    @track coc;
    @track cocId;
    @track userWorkLocation;
    @track accountName;
    @track accountid;
    @track specialCampaign = false;
    @track dealerProductId = [];
    @track category1;
    @track category3 = '';
    @track category4 = '';
    @track category5 = '';
    @track category_Goods;
    @track category3Option = [];
    @track category4Option = [];
    @track category5Option = [];
    @track consumableorderdetailsRecordsview = [];
    @track currentRecord = []; //分页
    @track selectRows = [];
    @track attachmentRecoeds = [];
    @track contactDealer = [];
    @track proLimitAndDate = [];
    @track agencyProType;
    @track agencyProType1;
    @track OSHFLG = false;
    @track bargainPrice;
    @track showOrderDate = false;
    @track showAttUploadDate = false;
    @track edoffersPrice = false;
    @track editDelCommitBtnDisabled = false;
    @track showEditBtn = false;
    @track disabledEditBtn = false;
    @track showPrintSheetBtn = false;
    @track showUploadSheetBtn = false;
    @track disabledUploadSheetBtn = false;
    @track showSubOrderbtn = false;
    @track disabledSubOrderbtn = false;
    @track showSaveOrderbtn1 = false;
    @track showSaveOrderbtn2 = false;
    @track showDeleteBtn = false;
    @track disabledDeleteBtn = false;
    @track showOfferPriceInputBtn = false;
    @track disabledOfferPriceInputBtn = false;
    @track showReapplyBtn = false;
    @track showHospital = false;
    @track showPage = false;
    @track cansee = false;
    @track showSpinner = true;
    @track showPopSpinner = false;
    stylesLoaded = false;
    //是否一直显示提示
    @track isNoteStay = true;
    //排序相关
    @track sortDirection = 'asc';
    @track sortedBy;
    //分页
    @track currentPage = 1;
    @track pageSize = 10;
    // @track totalPage = 0;
    @track pageSizeOptions = [10, 25, 50, 100];
    @track recordStart = 0;
    @track recordEnd = 0;
    //报错提醒
    // @track hasError = false;
    @track errorMsgs = [];
    // @track hasWarning = false;
    @track warningMsgs = [];
    //附件上传
    @track showAttPop = false;
    @track filesUploaded = [];
    @track fileName;
    file;
    fileContents;
    fileReader;
    content;
    //医院搜索
    @track showAttHosPop = false;
    @track hospitalList = [];
    @track searchNameHos;
    @track chooseHospital;
    @track chooseHospitalId;
    @track hospitalId;
    @track hospitalName;
    @track tempidHp;
    @track hosCols = [
        // {label:'医院名称',fieldName:'Name',type:'button',typeAttributes:{label:{fieldName:'Name'},variant:'base'}},
        {
            label: '',
            type: 'button',
            typeAttributes: { label: '选择' },
            initialWidth: 90,
            hideDefaultActions: true,
            wrapText: true
        },
        hideDefaultActions: true,
        initialWidth: 78
      });
    } else {
      cols.push({
        label: "采购数量",
        fieldName: "consumableCount",
        hideDefaultActions: true,
        initialWidth: 78,
        cellAttributes: { alignment: "right" }
      });
    }
    cols.push({
      label: "在库数下限",
      fieldName: "lowerlimit",
      hideDefaultActions: true,
      initialWidth: 86,
      cellAttributes: { alignment: "right" }
    });
    cols.push({
      label: "在库数上限",
      fieldName: "upperlimit",
      hideDefaultActions: true,
      initialWidth: 86,
      cellAttributes: { alignment: "right" }
    });
    // cols.push({label:'有效期库存(盒)',fieldName:'allnumber',hideDefaultActions: true,initialWidth:105,sortable: true});
    cols.push({
      label: "有效期库存(盒)",
      type: "customInventoryColor",
      fieldName: "allnumber",
      typeAttributes: {
        value: { fieldName: "allnumber" },
        upperlimit: { fieldName: "upperlimit" },
        lowerlimit: { fieldName: "lowerlimit" },
        boxPrice: "盒"
      },
      hideDefaultActions: true,
      initialWidth: 122,
      sortable: true
    });
    cols.push({
      label: "有效期库存(个)",
      fieldName: "allnumber_piece",
      hideDefaultActions: true,
      initialWidth: 112,
      cellAttributes: { alignment: "right" }
    });
    return cols;
  }
  //附件cols
  @track attCols = [
    {
      label: "标题",
      fieldName: "attUrl",
      type: "url",
      typeAttributes: {
        label: { fieldName: "fileName" },
        target: "_blank"
      },
      hideDefaultActions: true
    },
    {
      label: "创建人",
      fieldName: "ownerUrl",
      type: "url",
      typeAttributes: {
        label: { fieldName: "ownerName" },
        target: "_blank"
      },
      hideDefaultActions: true
    },
    {
      label: "上传日期",
      fieldName: "updateDate",
      hideDefaultActions: true
    },
    {
      label: "",
      type: "tableCellIcon",
      typeAttributes: {
        iconName: "utility:delete",
        recordId: { fieldName: "recordId" }
      },
      initialWidth: 50,
      hideDefaultActions: true
    }
  ];
  //取得所有被勾选的产品id
  getAllChecked() {
    this.selectRows = [];
    for (var i in this.currentRecord) {
      if (this.currentRecord[i].check) {
        this.selectRows.push(this.currentRecord[i].recordId);
      }
    }
  }
  //勾选操作
  checkRows(event) {
    this.selectRows = [];
    const selectedRows = event.detail.selectedRows;
    for (var i in this.consumableorderdetailsRecordsview) {
      var count = 0;
      for (var j in selectedRows) {
        if (
          this.consumableorderdetailsRecordsview[i].recordId ==
          selectedRows[j].recordId
        ) {
          count++;
          console.log(
            "checkId:" +
              selectedRows[j].recordId +
              "---" +
              this.consumableorderdetailsRecordsview[i].prodName
          );
        {
            label: '医院名称',
            fieldName: 'Name',
            initialWidth: 380,
            wrapText: true,
            hideDefaultActions: true
        },
        {
            label: '省份',
            fieldName: 'StateMaster',
            initialWidth: 80,
            hideDefaultActions: true,
            wrapText: true
        },
        {
            label: '地址',
            fieldName: 'Address__c',
            hideDefaultActions: true,
            wrapText: true
        }
      }
      if (count == 0) {
        this.consumableorderdetailsRecordsview[i].check = false;
      } else {
        this.consumableorderdetailsRecordsview[i].check = true;
        this.selectRows.push(
          this.consumableorderdetailsRecordsview[i].recordId
        );
      }
    }
    for (var i in this.selectRows) {
      console.log("checkId1:" + this.selectRows[i]);
      for (var i in this.currentRecord) {
        if (this.currentRecord[i].recordId == this.selectRows[i]) {
          console.log("currentRecord:" + this.selectRows[i]);
    ];
    //合同搜索
    @track contractLabel;
    @track showConPop = false;
    @track contractList = [];
    @track searchNameCon;
    @track chooseContract;
    @track chooseContractId;
    @track contractId;
    @track contractName;
    @track tempidPp;
    @track conCols = [
        {
            label: '',
            type: 'button',
            typeAttributes: { label: '选择' },
            initialWidth: 90,
            hideDefaultActions: true,
            wrapText: true
        },
        {
            label: '合同名称',
            fieldName: 'Name',
            wrapText: true,
            hideDefaultActions: true
        },
        {
            label: '省份',
            fieldName: 'StateMaster',
            initialWidth: 80,
            hideDefaultActions: true,
            wrapText: true
        },
        {
            label: '申请销售课',
            fieldName: 'Sales_Section__c',
            initialWidth: 160,
            hideDefaultActions: true,
            wrapText: true
        },
        {
            label: '允许报价期间(开始日)',
            fieldName: 'Contract_Decide_Start_Date__c',
            initialWidth: 175,
            hideDefaultActions: true,
            wrapText: true
        },
        {
            label: '允许报价期间(结束日)',
            fieldName: 'Contract_Decide_End_Date__c',
            initialWidth: 175,
            hideDefaultActions: true,
            wrapText: true
        }
      }
    }
  }
    ];
  //采购数量获取
  conCountChange(event) {
    var recordId = event.detail.data.recordId;
    var conCount = event.detail.data.value;
    console.log("countChange:" + recordId + "---" + conCount);
    for (var i in this.consumableorderdetailsRecordsview) {
      if (this.consumableorderdetailsRecordsview[i].recordId == recordId) {
        this.consumableorderdetailsRecordsview[i].esd.Consumable_count__c =
          conCount;
        this.consumableorderdetailsRecordsview[i].consumableCount = conCount;
        if (conCount != null && conCount != 0 && conCount != "") {
          this.consumableorderdetailsRecordsview[i].check = true;
    //消耗品数据col
    get cols() {
        var cols = [];
        cols.push({
            label: '消耗品名称',
            fieldName: 'prodName',
            wrapText: true,
            hideDefaultActions: true,
            sortable: true
            // initialWidth: 136
        });
        cols.push({
            label: '规格',
            fieldName: 'packing_list',
            wrapText: true,
            hideDefaultActions: true,
            initialWidth: 50,
            cellAttributes: { alignment: 'right' }
        });
        cols.push({
            label: 'CFDA状态',
            fieldName: 'prodSFDAStatus',
            wrapText: true,
            hideDefaultActions: true,
            initialWidth: 84
        });
        cols.push({
            label: '注册证编码号',
            fieldName: 'approbation_No',
            wrapText: true,
            hideDefaultActions: true,
            initialWidth: 104
        });
        cols.push({
            label: '注册证效期',
            fieldName: 'expiration_Date',
            wrapText: true,
            hideDefaultActions: true,
            initialWidth: 95
        });
        cols.push({
            label: '第3分类',
            fieldName: 'prodCategory3',
            wrapText: true,
            hideDefaultActions: true,
            initialWidth: 84,
            sortable: true
        });
        cols.push({
            label: '第4分类',
            fieldName: 'prodCategory4',
            wrapText: true,
            hideDefaultActions: true,
            initialWidth: 84,
            sortable: true
        });
        cols.push({
            label: '第5分类',
            fieldName: 'prodCategory5',
            wrapText: true,
            hideDefaultActions: true,
            initialWidth: 84,
            sortable: true
        });
        if (this.cansee) {
            cols.push({
                label: '标准单价',
                type: 'number',
                typeAttributes: { minimumFractionDigits: 2 },
                fieldName: 'prodIntraTradeList',
                hideDefaultActions: true,
                initialWidth: 78
            });
        }
        if (this.editAble) {
            cols.push({
                label: '采购数量',
                type: 'customTableInput',
                typeAttributes: {
                    recordId: { fieldName: 'recordId' },
                    inputValue: { fieldName: 'consumableCount' },
                    upperLimit: { fieldName: 'upperlimit' },
                    lowerLimit: { fieldName: 'lowerlimit' },
                    allnumber: { fieldName: 'allnumber' },
                    valueType: 'Number'
                },
                hideDefaultActions: true,
                initialWidth: 78
            });
        } else {
          this.consumableorderdetailsRecordsview[i].check = false;
          this.consumableorderdetailsRecordsview[i].esd.Consumable_count__c =
            null;
          this.consumableorderdetailsRecordsview[i].consumableCount = null;
            cols.push({
                label: '采购数量',
                fieldName: 'consumableCount',
                hideDefaultActions: true,
                initialWidth: 78,
                cellAttributes: { alignment: 'right' }
            });
        }
      }
        cols.push({
            label: '在库数下限',
            fieldName: 'lowerlimit',
            hideDefaultActions: true,
            initialWidth: 86,
            cellAttributes: { alignment: 'right' }
        });
        cols.push({
            label: '在库数上限',
            fieldName: 'upperlimit',
            hideDefaultActions: true,
            initialWidth: 86,
            cellAttributes: { alignment: 'right' }
        });
        // cols.push({label:'有效期库存(盒)',fieldName:'allnumber',hideDefaultActions: true,initialWidth:105,sortable: true});
        cols.push({
            label: '有效期库存(盒)',
            type: 'customInventoryColor',
            fieldName: 'allnumber',
            typeAttributes: {
                value: { fieldName: 'allnumber' },
                upperlimit: { fieldName: 'upperlimit' },
                lowerlimit: { fieldName: 'lowerlimit' },
                boxPrice: '盒'
            },
            hideDefaultActions: true,
            initialWidth: 122,
            sortable: true
        });
        cols.push({
            label: '有效期库存(个)',
            fieldName: 'allnumber_piece',
            hideDefaultActions: true,
            initialWidth: 112,
            cellAttributes: { alignment: 'right' }
        });
        return cols;
    }
    this.getAllChecked();
    for (var i in this.currentRecord) {
      if (this.currentRecord[i].recordId == recordId) {
    //附件cols
    @track attCols = [
        {
            label: '标题',
            fieldName: 'attUrl',
            type: 'url',
            typeAttributes: {
                label: { fieldName: 'fileName' },
                target: '_blank'
            },
            hideDefaultActions: true
        },
        {
            label: '创建人',
            fieldName: 'ownerUrl',
            type: 'url',
            typeAttributes: {
                label: { fieldName: 'ownerName' },
                target: '_blank'
            },
            hideDefaultActions: true
        },
        {
            label: '上传日期',
            fieldName: 'updateDate',
            hideDefaultActions: true
        },
        {
            label: '',
            type: 'tableCellIcon',
            typeAttributes: {
                iconName: 'utility:delete',
                recordId: { fieldName: 'recordId' }
            },
            initialWidth: 50,
            hideDefaultActions: true
        }
    ];
    //取得所有被勾选的产品id
    getAllChecked() {
        this.selectRows = [];
        for (var i in this.currentRecord) {
            if (this.currentRecord[i].check) {
                this.selectRows.push(this.currentRecord[i].recordId);
            }
        }
    }
    //勾选操作
    checkRows(event) {
        this.selectRows = [];
        const selectedRows = event.detail.selectedRows;
        for (var i in this.consumableorderdetailsRecordsview) {
            var count = 0;
            for (var j in selectedRows) {
                if (
                    this.consumableorderdetailsRecordsview[i].recordId ==
                    selectedRows[j].recordId
                ) {
                    count++;
                    console.log(
                        'checkId:' +
                            selectedRows[j].recordId +
                            '---' +
                            this.consumableorderdetailsRecordsview[i].prodName
                    );
                }
            }
            if (count == 0) {
                this.consumableorderdetailsRecordsview[i].check = false;
            } else {
                this.consumableorderdetailsRecordsview[i].check = true;
                this.selectRows.push(
                    this.consumableorderdetailsRecordsview[i].recordId
                );
            }
        }
        for (var i in this.selectRows) {
            console.log('checkId1:' + this.selectRows[i]);
            for (var i in this.currentRecord) {
                if (this.currentRecord[i].recordId == this.selectRows[i]) {
                    console.log('currentRecord:' + this.selectRows[i]);
                }
            }
        }
    }
    //采购数量获取
    conCountChange(event) {
        var recordId = event.detail.data.recordId;
        var conCount = event.detail.data.value;
        console.log('countChange:' + recordId + '---' + conCount);
        for (var i in this.consumableorderdetailsRecordsview) {
            if (
                this.consumableorderdetailsRecordsview[i].recordId == recordId
            ) {
                this.consumableorderdetailsRecordsview[
                    i
                ].esd.Consumable_count__c = conCount;
                this.consumableorderdetailsRecordsview[i].consumableCount =
                    conCount;
                if (conCount != null && conCount != 0 && conCount != '') {
                    this.consumableorderdetailsRecordsview[i].check = true;
                } else {
                    this.consumableorderdetailsRecordsview[i].check = false;
                    this.consumableorderdetailsRecordsview[
                        i
                    ].esd.Consumable_count__c = null;
                    this.consumableorderdetailsRecordsview[i].consumableCount =
                        null;
                }
            }
        }
        this.getAllChecked();
        for (var i in this.currentRecord) {
            if (this.currentRecord[i].recordId == recordId) {
                console.log(
                    'currentRecord1:' +
                        this.currentRecord[i].esd.Consumable_count__c
                );
            }
        }
    }
    //采购数量失焦
    conCountBlur(event) {
        var conCount = event.detail.data.value;
        var allnumber = event.detail.data.allnumber;
        var upperLimit = event.detail.data.upperLimit;
        var lowerLimit = event.detail.data.lowerLimit;
        console.log(
          "currentRecord1:" + this.currentRecord[i].esd.Consumable_count__c
            'limit:' +
                conCount +
                '---' +
                allnumber +
                '---' +
                lowerLimit +
                '---' +
                allnumber
        );
      }
        if (
            upperLimit != null &&
            lowerLimit != null &&
            conCount != null &&
            allnumber != null
        ) {
            if (parseInt(allnumber) + parseInt(conCount) > upperLimit) {
                // window.alert("该产品订购数量超出库存上限!");
                this.showMyToast('该产品订购数量超出库存上限!', '', 'error');
            }
            if (parseInt(allnumber) + parseInt(conCount) < lowerLimit) {
                // window.alert("该产品订购数量低于库存下限!");
                this.showMyToast('该产品订购数量低于库存下限!', '', 'error');
            }
        }
    }
  }
  //采购数量失焦
  conCountBlur(event) {
    var conCount = event.detail.data.value;
    var allnumber = event.detail.data.allnumber;
    var upperLimit = event.detail.data.upperLimit;
    var lowerLimit = event.detail.data.lowerLimit;
    console.log(
      "limit:" +
        conCount +
        "---" +
        allnumber +
        "---" +
        lowerLimit +
        "---" +
        allnumber
    );
    if (
      upperLimit != null &&
      lowerLimit != null &&
      conCount != null &&
      allnumber != null
    ) {
      if (parseInt(allnumber) + parseInt(conCount) > upperLimit) {
        // window.alert("该产品订购数量超出库存上限!");
        this.showMyToast("该产品订购数量超出库存上限!", "", "error");
      }
      if (parseInt(allnumber) + parseInt(conCount) < lowerLimit) {
        // window.alert("该产品订购数量低于库存下限!");
        this.showMyToast("该产品订购数量低于库存下限!", "", "error");
      }
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference) {
        console.log('CurrentPageReference');
        if (currentPageReference) {
            this.pageType = currentPageReference.state?.type;
            this.esetId = currentPageReference.state?.ESetid;
            this.keyWords = currentPageReference.state?.KeyWords;
            console.log('type:' + this.pageType);
            console.log('esetId:' + this.esetId);
            console.log('keyWords:' + this.keyWords);
        }
    }
  }
  @wire(CurrentPageReference)
  getStateParameters(currentPageReference) {
    console.log("CurrentPageReference");
    if (currentPageReference) {
      this.pageType = currentPageReference.state?.type;
      this.esetId = currentPageReference.state?.ESetid;
      this.keyWords = currentPageReference.state?.KeyWords;
      console.log("type:" + this.pageType);
      console.log("esetId:" + this.esetId);
      console.log("keyWords:" + this.keyWords);
    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');
                });
        }
    }
  }
  renderedCallback() {
    if (!this.stylesLoaded) {
      Promise.all([loadStyle(this, WrappedHeaderTable)])
        .then(() => {
          console.log("Custom styles loaded");
          this.stylesLoaded = true;
    //页面初始化
    connectedCallback() {
        this.showSpinner = true;
        initPage({
            type: this.pageType,
            esetId: this.esetId,
            keywordStr: this.keyWords
        })
        .catch((error) => {
          console.error("Error loading custom styles");
            .then((result) => {
                this.isNoteStay = result.isNoteStay;
                if (result.result == 'Success') {
                    this.editAble = result.editAble;
                    this.edoffersPrice = result.edoffersPrice;
                    this.cansee = result.cansee;
                    this.editDelCommitBtnDisabled =
                        result.editDelCommitBtnDisabled;
                    this.category3Option = result.category3Option;
                    this.category4Option = result.category4Option;
                    this.category5Option = result.category5Option;
                    this.agencyProType = result.agencyProType;
                    this.agencyProType1 = result.agencyProType1;
                    this.OSHFLG = result.OSHFLG;
                    this.hospitalName = result.hospitalName;
                    this.contractName = result.contractName;
                    this.contractLabel = '经销商有效合同';
                    this.consumableorderdetailsRecordsview =
                        result.consumableorderdetailsRecordsview;
                    this.currentPage = 1;
                    this.showCurrentReocrd();
                    this.getAllChecked();
                    this.attachmentRecoeds = result.attachmentRecoeds;
                    console.log('attSize:' + this.attachmentRecoeds.length);
                    for (var i in this.attachmentRecoeds) {
                        this.attachmentRecoeds[i]['recordId'] =
                            this.attachmentRecoeds[i].Concc.Id;
                        this.attachmentRecoeds[i]['documentId'] =
                            this.attachmentRecoeds[i].Concc.ContentDocumentId;
                        this.attachmentRecoeds[i]['fileFullName'] =
                            this.attachmentRecoeds[i].Concc.Title;
                        var contractionName =
                            this.attachmentRecoeds[i].Concc.Title;
                        // var contractionName = '长文件长文件长文件长文件';
                        if (contractionName.length > 25) {
                            contractionName =
                                contractionName.substr(0, 21) + '...';
                        }
                        this.attachmentRecoeds[i]['fileName'] = contractionName;
                        this.attachmentRecoeds[i]['ownerName'] =
                            this.attachmentRecoeds[i].Concc.Owner.Name;
                        this.attachmentRecoeds[i]['downloadUrl'] =
                            '/sfc/servlet.shepherd/document/download/' +
                            this.attachmentRecoeds[i].Concc.ContentDocumentId +
                            '?operationContext=S1';
                        // var date = this.attachmentRecoeds[i].Concc.CreatedDate;
                        // var year = date.getFullYear();
                        // var month = date.getMonth();
                        // var day = date.getDay();
                        // console.log(year+'-'+month+'-'+day);
                        this.attachmentRecoeds[i]['updateDate'] = new Date(
                            Date.parse(
                                this.attachmentRecoeds[i].Concc.CreatedDate
                            )
                        ).toLocaleString();
                        this.attachmentRecoeds[i]['attUrl'] =
                            '/' + this.attachmentRecoeds[i].Concc.Id;
                        this.attachmentRecoeds[i]['ownerUrl'] =
                            '/' + this.attachmentRecoeds[i].Concc.OwnerId;
                    }
                    this.errorMsgs = result.errorMsgList;
                    this.warningMsgs = result.warningMsgList;
                    this.userWorkLocation = result.userWorkLocation;
                    this.accountName = result.accountName;
                    this.accountid = result.accountid;
                    this.hospitalId = result.hospitalId;
                    this.contractId = result.contractId;
                    this.category_Goods = result.category_Goods;
                    this.specialCampaign = result.specialCampaign;
                    this.dealerProductId = result.dealerProductId;
                    this.contactDealer = result.contactDealer;
                    this.pageType = result.methodType;
                    this.proLimitAndDate = result.proLimitAndDate;
                    console.log(
                        'proLimitAndDate:' +
                            JSON.stringify(this.proLimitAndDate)
                    );
                    this.coc = result.coc;
                    this.cocId = this.coc.Id;
                    if (
                        this.pageType == 'hospitalorder' &&
                        this.agencyProType != 'ET'
                    ) {
                        this.showHospital = true;
                    }
                    if (
                        this.coc.Order_status__c == '已提交' ||
                        this.coc.Order_status__c == '批准'
                    ) {
                        this.showOrderDate = true;
                    }
                    if (this.coc.Consumable_pdf_insert_day__c != null) {
                        this.showAttUploadDate = true;
                    }
                    if (!(this.editAble || this.edoffersPrice)) {
                        this.showEditBtn = true;
                        this.showOfferPriceInputBtn = true;
                    }
                    if (
                        this.coc.Order_status__c == '已提交' ||
                        this.coc.Order_status__c == '批准' ||
                        this.coc.Order_status__c == '驳回'
                    ) {
                        this.disabledEditBtn = true;
                        this.disabledUploadSheetBtn = true;
                        this.disabledSubOrderbtn = true;
                        this.disabledDeleteBtn = true;
                        this.disabledOfferPriceInputBtn = true;
                    }
                    if (
                        !(
                            this.editDelCommitBtnDisabled ||
                            this.editAble ||
                            this.edoffersPrice
                        )
                    ) {
                        this.showPrintSheetBtn = true;
                        this.showUploadSheetBtn = true;
                        this.showSubOrderbtn = true;
                        this.showDeleteBtn = true;
                    }
                    if (
                        (this.editDelCommitBtnDisabled ||
                            this.editAble ||
                            this.edoffersPrice) &&
                        this.coc.Order_status__c != '驳回'
                    ) {
                        this.showSaveOrderbtn1 = true;
                    }
                    if (this.coc.Order_status__c == '驳回' && this.editAble) {
                        this.showSaveOrderbtn2 = true;
                    }
                    if (this.coc.Order_status__c == '驳回' && !this.editAble) {
                        this.showReapplyBtn = true;
                    }
                    this.showSpinner = false;
                    this.showPage = true;
                } else {
                    this.showSpinner = false;
                    console.log('Error:' + result.errorMsg);
                    this.showMyToast(
                        '初始化页面失败',
                        result.errorMsg,
                        'error'
                    );
                }
            })
            .catch((error) => {
                this.showSpinner = false;
                console.log('error:' + error);
                this.showMyToast('初始化页面失败', error, 'error');
            });
    }
    //排序
    onHandleSort(event) {
        //将已经选好了的放到前面,不进行排序
        console.log('sort');
        if (this.editAble) {
            const { fieldName: sortedBy, sortDirection } = event.detail;
            const cloneData = [...this.currentRecord];
            cloneData.sort(
                this.sortBy(sortedBy, sortDirection === 'asc' ? 1 : -1)
            );
            let index = 0;
            let selectedRows = this.template
                .querySelector('c-lex-custom-lightning-datatable')
                .getSelectedRows();
            let selectedRowsIds = [];
            for (var i in selectedRows) {
                selectedRowsIds.push(selectedRows[i].recordId);
            }
            console.log('selectedRowsIds = ' + JSON.stringify(selectedRowsIds));
            for (var i = 0; i < cloneData.length; i++) {
                if (selectedRowsIds.indexOf(cloneData[i].recordId) != -1) {
                    if (i != 0) {
                        let temp = cloneData[index];
                        cloneData[index] = cloneData[i];
                        cloneData[i] = temp;
                    }
                    index++;
                }
            }
            this.currentRecord = cloneData;
            this.sortDirection = sortDirection;
            this.sortedBy = sortedBy;
        } else {
            const { fieldName: sortedBy, sortDirection } = event.detail;
            const cloneData = [...this.currentRecord];
            cloneData.sort(
                this.sortBy(sortedBy, sortDirection === 'asc' ? 1 : -1)
            );
            this.currentRecord = 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));
        };
    }
    //是否有警告
    get hasWarning() {
        if (this.warningMsgs == null || this.warningMsgs.length == 0) {
            return false;
        }
        if (this.warningMsgs.length > 0) {
            return true;
        }
    }
    //是否有错误
    get hasError() {
        if (this.errorMsgs == null || this.errorMsgs.length == 0) {
            return false;
        }
        if (this.errorMsgs.length > 0) {
            return true;
        }
    }
    //特价change事件
    offerPriceChange(event) {
        this.coc.Offers_Price__c = event.detail.value;
    }
    //消耗品名称change事件
    category1Change(event) {
        this.category1 = event.detail.value;
    }
    //第三分类change事件
    category3Change(event) {
        this.showSpinner = true;
        this.category3 = event.detail.value;
        this.category4 = '';
        this.category5 = '';
        categoryAllload({
            agencyProTypeStr: this.agencyProType,
            category3Str: this.category3
        }).then((result) => {
            if (result.result == 'Success') {
                this.category4Option = result.category4Option;
                this.category5Option = result.category5Option;
                this.showSpinner = false;
            } else {
                this.showSpinner = false;
                console.log('Error:' + result.errorMsg);
                this.showMyToast('加载分类失败', result.errorMsg, 'error');
            }
        });
    }
  }
  //页面初始化
  connectedCallback() {
    this.showSpinner = true;
    initPage({
      type: this.pageType,
      esetId: this.esetId,
      keywordStr: this.keyWords
    })
      .then((result) => {
        this.isNoteStay = result.isNoteStay;
        if (result.result == "Success") {
          this.editAble = result.editAble;
          this.edoffersPrice = result.edoffersPrice;
          this.cansee = result.cansee;
          this.editDelCommitBtnDisabled = result.editDelCommitBtnDisabled;
          this.category3Option = result.category3Option;
          this.category4Option = result.category4Option;
          this.category5Option = result.category5Option;
          this.agencyProType = result.agencyProType;
          this.agencyProType1 = result.agencyProType1;
          this.OSHFLG = result.OSHFLG;
          this.hospitalName = result.hospitalName;
          this.contractName = result.contractName;
          this.contractLabel = "经销商有效合同";
          this.consumableorderdetailsRecordsview =
            result.consumableorderdetailsRecordsview;
          this.currentPage = 1;
          this.showCurrentReocrd();
          this.getAllChecked();
          this.attachmentRecoeds = result.attachmentRecoeds;
          console.log("attSize:" + this.attachmentRecoeds.length);
          for (var i in this.attachmentRecoeds) {
            this.attachmentRecoeds[i]["recordId"] =
              this.attachmentRecoeds[i].Concc.Id;
            this.attachmentRecoeds[i]["documentId"] =
              this.attachmentRecoeds[i].Concc.ContentDocumentId;
            this.attachmentRecoeds[i]["fileFullName"] =
              this.attachmentRecoeds[i].Concc.Title;
            var contractionName = this.attachmentRecoeds[i].Concc.Title;
            // var contractionName = '长文件长文件长文件长文件';
            if (contractionName.length > 25) {
              contractionName = contractionName.substr(0, 21) + "...";
    //第四分类change事件
    category4Change(event) {
        this.showSpinner = true;
        this.category4 = event.detail.value;
        this.category5 = '';
        categoryload({
            agencyProTypeStr: this.agencyProType,
            category3Str: this.category3,
            category4Str: this.category4
        }).then((result) => {
            if (result.result == 'Success') {
                this.category4Option = result.category4Option;
                this.category5Option = result.category5Option;
                this.showSpinner = false;
            } else {
                this.showSpinner = false;
                console.log('Error:' + result.errorMsg);
                this.showMyToast('加载分类失败', result.errorMsg, 'error');
            }
            this.attachmentRecoeds[i]["fileName"] = contractionName;
            this.attachmentRecoeds[i]["ownerName"] =
              this.attachmentRecoeds[i].Concc.Owner.Name;
            this.attachmentRecoeds[i]["downloadUrl"] =
              "/sfc/servlet.shepherd/document/download/" +
              this.attachmentRecoeds[i].Concc.ContentDocumentId +
              "?operationContext=S1";
            // var date = this.attachmentRecoeds[i].Concc.CreatedDate;
            // var year = date.getFullYear();
            // var month = date.getMonth();
            // var day = date.getDay();
            // console.log(year+'-'+month+'-'+day);
            this.attachmentRecoeds[i]["updateDate"] = new Date(
              Date.parse(this.attachmentRecoeds[i].Concc.CreatedDate)
            ).toLocaleString();
            this.attachmentRecoeds[i]["attUrl"] =
              "/" + this.attachmentRecoeds[i].Concc.Id;
            this.attachmentRecoeds[i]["ownerUrl"] =
              "/" + this.attachmentRecoeds[i].Concc.OwnerId;
          }
          this.errorMsgs = result.errorMsgList;
          this.warningMsgs = result.warningMsgList;
          this.userWorkLocation = result.userWorkLocation;
          this.accountName = result.accountName;
          this.accountid = result.accountid;
          this.hospitalId = result.hospitalId;
          this.contractId = result.contractId;
          this.category_Goods = result.category_Goods;
          this.specialCampaign = result.specialCampaign;
          this.dealerProductId = result.dealerProductId;
          this.contactDealer = result.contactDealer;
          this.pageType = result.methodType;
          this.proLimitAndDate = result.proLimitAndDate;
          console.log(
            "proLimitAndDate:" + JSON.stringify(this.proLimitAndDate)
          );
          this.coc = result.coc;
          this.cocId = this.coc.Id;
          if (this.pageType == "hospitalorder" && this.agencyProType != "ET") {
            this.showHospital = true;
          }
          if (
            this.coc.Order_status__c == "已提交" ||
            this.coc.Order_status__c == "批准"
          ) {
            this.showOrderDate = true;
          }
          if (this.coc.Consumable_pdf_insert_day__c != null) {
            this.showAttUploadDate = true;
          }
          if (!(this.editAble || this.edoffersPrice)) {
        });
    }
    //第五分类change事件
    category5Change(event) {
        this.category5 = event.detail.value;
    }
    //搜索产品
    searchProduct(event) {
        this.showSpinner = true;
        searchConsumableorderdetails({
            userWorkLocationStr: this.userWorkLocation,
            agencyProTypeStr: this.agencyProType,
            accountNameStr: this.accountName,
            accountIdStr: this.accountid,
            contractIdStr: this.contractId,
            hospitalIdStr: this.hospitalId,
            category1Str: this.category1,
            category3Str: this.category3,
            category4Str: this.category4,
            category5Str: this.category5,
            category_GoodStr: this.category_Goods,
            specialCampaignStr: this.specialCampaign,
            dealerProductIdStr: JSON.stringify(this.dealerProductId),
            methodTypeStr: this.pageType,
            editAbleStr: this.editAble,
            consumableorderdetailsRecordsviewStr: JSON.stringify(
                this.consumableorderdetailsRecordsview
            ),
            proLimitAndDateList: this.proLimitAndDate
        })
            .then((result) => {
                if (result.result == 'Success') {
                    this.consumableorderdetailsRecordsview =
                        result.consumableorderdetailsRecordsview;
                    this.currentPage = 1;
                    this.currentRecord = [];
                    this.showCurrentReocrd();
                    this.getAllChecked();
                    this.showSpinner = false;
                    this.errorMsgs = result.errorMsgList;
                    this.warningMsgs = result.warningMsgList;
                    // this.hasError = result.hasError;
                    // this.hasWarning = result.hasWarning;
                    this.showMyToast('搜索成功', result.errorMsg, 'success');
                } else {
                    this.showSpinner = false;
                    console.log('Error:' + result.errorMsg);
                    if (result.errorMsg == '没有搜索到相关数据') {
                        this.showMyToast(result.errorMsg, '', 'error');
                    } else {
                        this.showMyToast('搜索失败', result.errorMsg, 'error');
                    }
                }
            })
            .catch((error) => {
                console.log('Error:' + error);
            });
    }
    //清除搜索栏
    clear(event) {
        this.category1 = '';
        this.category3 = '';
        this.category4 = '';
        this.category5 = '';
        this.showSpinner = true;
        searchConsumableorderdetails({
            userWorkLocationStr: this.userWorkLocation,
            agencyProTypeStr: this.agencyProType,
            accountNameStr: this.accountName,
            accountIdStr: this.accountid,
            contractIdStr: this.contractId,
            hospitalIdStr: this.hospitalId,
            category1Str: this.category1,
            category3Str: this.category3,
            category4Str: this.category4,
            category5Str: this.category5,
            category_GoodStr: this.category_Goods,
            specialCampaignStr: this.specialCampaign,
            dealerProductIdStr: JSON.stringify(this.dealerProductId),
            methodTypeStr: this.pageType,
            editAbleStr: this.editAble,
            consumableorderdetailsRecordsviewStr: JSON.stringify(
                this.consumableorderdetailsRecordsview
            ),
            proLimitAndDateList: this.proLimitAndDate
        }).then((result) => {
            if (result.result == 'Success') {
                this.consumableorderdetailsRecordsview =
                    result.consumableorderdetailsRecordsview;
                this.currentPage = 1;
                this.currentRecord = [];
                this.showCurrentReocrd();
                this.getAllChecked();
                this.showSpinner = false;
                this.showMyToast('搜索成功', result.errorMsg, 'success');
            } else {
                this.showSpinner = false;
                console.log('Error:' + result.errorMsg);
                if (result.errorMsg == '没有搜索到相关数据') {
                    this.showMyToast(result.errorMsg, '', 'error');
                } else {
                    this.showMyToast('搜索失败', result.errorMsg, 'error');
                }
            }
        });
    }
    //选择所有
    checkAll(event) {
        for (
            let i = 0, len = this.consumableorderdetailsRecordsview.length;
            i < len;
            i++
        ) {
            this.consumableorderdetailsRecordsview[i].check =
                event.target.checked;
        }
    }
    //选择
    check(event) {
        let index = event.target.getAttribute('data-index');
        this.consumableorderdetailsRecordsview[index].check =
            event.target.checked;
    }
    //采购数量change事件
    // consumableCountChange(event){
    //    let index = event.target.getAttribute("data-index");
    //    var value = event.target.value;
    //    this.consumableorderdetailsRecordsview[index].esd.Consumable_count__c = value;
    //    if(isNaN(value)){
    //       value=0.00;
    //    }
    //    if(value != null && value !=0 && value!=''){
    //       this.consumableorderdetailsRecordsview[index].check = true;
    //    }else{
    //       this.consumableorderdetailsRecordsview[index].check = false;
    //    }
    // }
    //保存订单
    saveOrder(event) {
        this.showSpinner = true;
        console.log('start save');
        save({
            contractNameStr: this.contractName,
            cocStr: JSON.stringify(this.coc),
            agencyProTypeStr: this.agencyProType,
            accountidStr: this.accountid,
            consumableorderdetailsRecordsviewStr: JSON.stringify(
                this.consumableorderdetailsRecordsview
            ),
            contactDealerStr: JSON.stringify(this.contactDealer),
            methodTypeStr: this.pageType,
            eSetIdStr: this.esetId,
            hospitalIdStr: this.hospitalId,
            contractIdStr: this.contractId,
            agencyProType1Str: this.agencyProType1,
            OSHFLGStr: this.OSHFLG
        }).then((result) => {
            this.showSpinner = false;
            if (result.result == 'Success') {
                this.esetId = result.eSetId;
                const config = {
                    type: 'standard__webPage',
                    attributes: {
                        url:
                            '/lexconsumable?ESetid=' +
                            this.esetId +
                            '&type=' +
                            this.pageType
                    }
                };
                this[NavigationMixin.Navigate](config);
            } else {
                this.showSpinner = false;
                console.log('Error:' + result.errorMsg);
                this.showMyToast('保存失败', result.errorMsg, 'error');
            }
        });
    }
    //保存订单(驳回)
    orderCopy(event) {
        this.showSpinner = true;
        ordrCopy({
            contractNameStr: this.contractName,
            cocStr: JSON.stringify(this.coc),
            agencyProTypeStr: this.agencyProType,
            accountidStr: this.accountid,
            consumableorderdetailsRecordsviewStr: JSON.stringify(
                this.consumableorderdetailsRecordsview
            ),
            contactDealerStr: JSON.stringify(this.contactDealer),
            methodTypeStr: this.pageType,
            hospitalIdStr: this.hospitalId,
            contractIdStr: this.contractId,
            agencyProType1Str: this.agencyProType1,
            OSHFLGStr: this.OSHFLG
        }).then((result) => {
            this.showSpinner = false;
            if (result.result == 'Success') {
                this.esetId = result.eSetId;
                const config = {
                    type: 'standard__webPage',
                    attributes: {
                        url:
                            '/lexconsumable?ESetid=' +
                            this.esetId +
                            '&type=' +
                            this.pageType
                    }
                };
                this[NavigationMixin.Navigate](config);
            } else {
                this.showSpinner = false;
                console.log('Error:' + result.errorMsg);
                this.showMyToast('保存失败', result.errorMsg, 'error');
            }
        });
    }
    //编辑
    editOrder(event) {
        setEditAble({ eSetidStr: this.esetId }).then((result) => {
            if (result.result == 'Success') {
                const config = {
                    type: 'standard__webPage',
                    attributes: {
                        url: result.url
                    }
                };
                this[NavigationMixin.Navigate](config);
            } else {
                this.showSpinner = false;
                console.log('Error:' + result.errorMsg);
                this.showMyToast('编辑失败', result.errorMsg, 'error');
            }
        });
    }
    //打印配置单
    printOrder(event) {
        var site = window.location.origin;
        const config = {
            type: 'standard__webPage',
            attributes: {
                url:
                    site + '/consumable/PrintConsumblePDF?ESetid=' + this.esetId
            }
        };
        this[NavigationMixin.Navigate](config);
    }
    //上传配置单
    uploadOrder(event) {
        this.showAttPop = true;
    }
    //提交订单
    submitOrder(event) {
        sorder({ eSetidStr: this.esetId, accountidStr: this.accountid })
            .then((result) => {
                if (result.result == 'Success') {
                    const config = {
                        type: 'standard__webPage',
                        attributes: {
                            url: result.url
                        }
                    };
                    this[NavigationMixin.Navigate](config);
                } else {
                    this.showSpinner = false;
                    this.errorMsgs = result.errorMsgList;
                    this.warningMsgs = result.warningMsgList;
                    console.log('Error:' + result.errorMsg);
                    if (result.errorMsg.indexOf('请上传订货配置单附件') != -1) {
                        result.errorMsg = '请上传订货配置单附件';
                    }
                    this.showMyToast('提交失败', result.errorMsg, 'error');
                }
            })
            .catch((error) => {
                console.log('Error:' + error);
            });
    }
    //删除订单
    deleteOrder(event) {
        if (!window.confirm('删除是不可恢复的,你确认要删除吗?')) {
            return;
        }
        delConsumable({ eSetidStr: this.esetId }).then((result) => {
            if (result.result == 'Success') {
                const config = {
                    type: 'standard__webPage',
                    attributes: {
                        url: result.url
                    }
                };
                this[NavigationMixin.Navigate](config);
            } else {
                this.showSpinner = false;
                console.log('Error:' + result.errorMsg);
                this.showMyToast('删除失败', result.errorMsg, 'error');
            }
        });
    }
    //特价金额录入
    inputOfferPrice(event) {
        this.edoffersPrice = true;
        if (!(this.editAble || this.edoffersPrice)) {
            this.showEditBtn = true;
            this.showOfferPriceInputBtn = true;
          }
          if (
            this.coc.Order_status__c == "已提交" ||
            this.coc.Order_status__c == "批准" ||
            this.coc.Order_status__c == "驳回"
          ) {
            this.disabledEditBtn = true;
            this.disabledUploadSheetBtn = true;
            this.disabledSubOrderbtn = true;
            this.disabledDeleteBtn = true;
            this.disabledOfferPriceInputBtn = true;
          }
          if (
        } else {
            this.showEditBtn = false;
            this.showOfferPriceInputBtn = false;
        }
        if (
            !(
              this.editDelCommitBtnDisabled ||
              this.editAble ||
              this.edoffersPrice
                this.editDelCommitBtnDisabled ||
                this.editAble ||
                this.edoffersPrice
            )
          ) {
        ) {
            this.showPrintSheetBtn = true;
            this.showUploadSheetBtn = true;
            this.showSubOrderbtn = true;
            this.showDeleteBtn = true;
          }
          if (
        } else {
            this.showPrintSheetBtn = false;
            this.showUploadSheetBtn = false;
            this.showSubOrderbtn = false;
            this.showDeleteBtn = false;
        }
        if (
            (this.editDelCommitBtnDisabled ||
              this.editAble ||
              this.edoffersPrice) &&
            this.coc.Order_status__c != "驳回"
          ) {
                this.editAble ||
                this.edoffersPrice) &&
            this.coc.Order_status__c != '驳回'
        ) {
            this.showSaveOrderbtn1 = true;
          }
          if (this.coc.Order_status__c == "驳回" && this.editAble) {
            this.showSaveOrderbtn2 = true;
          }
          if (this.coc.Order_status__c == "驳回" && !this.editAble) {
            this.showReapplyBtn = true;
          }
          this.showSpinner = false;
          this.showPage = true;
        } else {
          this.showSpinner = false;
          console.log("Error:" + result.errorMsg);
          this.showMyToast("初始化页面失败", result.errorMsg, "error");
            this.showSaveOrderbtn1 = false;
        }
      })
      .catch((error) => {
        this.showSpinner = false;
        console.log("error:" + error);
        this.showMyToast("初始化页面失败", error, "error");
      });
  }
    }
  //排序
  onHandleSort(event) {
    //将已经选好了的放到前面,不进行排序
    console.log("sort");
    if (this.editAble) {
      const { fieldName: sortedBy, sortDirection } = event.detail;
      const cloneData = [...this.currentRecord];
      cloneData.sort(this.sortBy(sortedBy, sortDirection === "asc" ? 1 : -1));
      let index = 0;
      let selectedRows = this.template
        .querySelector("c-lex-custom-lightning-datatable")
        .getSelectedRows();
      let selectedRowsIds = [];
      for (var i in selectedRows) {
        selectedRowsIds.push(selectedRows[i].recordId);
      }
      console.log("selectedRowsIds = " + JSON.stringify(selectedRowsIds));
      for (var i = 0; i < cloneData.length; i++) {
        if (selectedRowsIds.indexOf(cloneData[i].recordId) != -1) {
          if (i != 0) {
            let temp = cloneData[index];
            cloneData[index] = cloneData[i];
            cloneData[i] = temp;
          }
          index++;
    //再申请
    reapplyOrder(event) {
        backOrder({ eSetidStr: this.esetId }).then((result) => {
            if (result.result == 'Success') {
                const config = {
                    type: 'standard__webPage',
                    attributes: {
                        url: result.url
                    }
                };
                this[NavigationMixin.Navigate](config);
            } else {
                this.showSpinner = false;
                console.log('Error:' + result.errorMsg);
                this.showMyToast('再申请失败', result.errorMsg, 'error');
            }
        });
    }
    //附件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);
        }
      }
      this.currentRecord = cloneData;
      this.sortDirection = sortDirection;
      this.sortedBy = sortedBy;
    } else {
      const { fieldName: sortedBy, sortDirection } = event.detail;
      const cloneData = [...this.currentRecord];
      cloneData.sort(this.sortBy(sortedBy, sortDirection === "asc" ? 1 : -1));
      this.currentRecord = 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));
    };
  }
  //是否有警告
  get hasWarning() {
    if (this.warningMsgs == null || this.warningMsgs.length == 0) {
      return false;
    }
    if (this.warningMsgs.length > 0) {
      return true;
    }
  }
  //是否有错误
  get hasError() {
    if (this.errorMsgs == null || this.errorMsgs.length == 0) {
      return false;
    }
    if (this.errorMsgs.length > 0) {
      return true;
    }
  }
  //特价change事件
  offerPriceChange(event) {
    this.coc.Offers_Price__c = event.detail.value;
  }
  //消耗品名称change事件
  category1Change(event) {
    this.category1 = event.detail.value;
  }
  //第三分类change事件
  category3Change(event) {
    this.showSpinner = true;
    this.category3 = event.detail.value;
    this.category4 = "";
    this.category5 = "";
    categoryAllload({
      agencyProTypeStr: this.agencyProType,
      category3Str: this.category3
    }).then((result) => {
      if (result.result == "Success") {
        this.category4Option = result.category4Option;
        this.category5Option = result.category5Option;
        this.showSpinner = false;
      } else {
        this.showSpinner = false;
        console.log("Error:" + result.errorMsg);
        this.showMyToast("加载分类失败", result.errorMsg, "error");
      }
    });
  }
  //第四分类change事件
  category4Change(event) {
    this.showSpinner = true;
    this.category4 = event.detail.value;
    this.category5 = "";
    categoryload({
      agencyProTypeStr: this.agencyProType,
      category3Str: this.category3,
      category4Str: this.category4
    }).then((result) => {
      if (result.result == "Success") {
        this.category4Option = result.category4Option;
        this.category5Option = result.category5Option;
        this.showSpinner = false;
      } else {
        this.showSpinner = false;
        console.log("Error:" + result.errorMsg);
        this.showMyToast("加载分类失败", result.errorMsg, "error");
      }
    });
  }
  //第五分类change事件
  category5Change(event) {
    this.category5 = event.detail.value;
  }
  //搜索产品
  searchProduct(event) {
    this.showSpinner = true;
    searchConsumableorderdetails({
      userWorkLocationStr: this.userWorkLocation,
      agencyProTypeStr: this.agencyProType,
      accountNameStr: this.accountName,
      accountIdStr: this.accountid,
      contractIdStr: this.contractId,
      hospitalIdStr: this.hospitalId,
      category1Str: this.category1,
      category3Str: this.category3,
      category4Str: this.category4,
      category5Str: this.category5,
      category_GoodStr: this.category_Goods,
      specialCampaignStr: this.specialCampaign,
      dealerProductIdStr: JSON.stringify(this.dealerProductId),
      methodTypeStr: this.pageType,
      editAbleStr: this.editAble,
      consumableorderdetailsRecordsviewStr: JSON.stringify(
        this.consumableorderdetailsRecordsview
      ),
      proLimitAndDateList: this.proLimitAndDate
    })
      .then((result) => {
        if (result.result == "Success") {
          this.consumableorderdetailsRecordsview =
            result.consumableorderdetailsRecordsview;
          this.currentPage = 1;
          this.currentRecord = [];
          this.showCurrentReocrd();
          this.getAllChecked();
          this.showSpinner = false;
          this.errorMsgs = result.errorMsgList;
          this.warningMsgs = result.warningMsgList;
          // this.hasError = result.hasError;
          // this.hasWarning = result.hasWarning;
          this.showMyToast("搜索成功", result.errorMsg, "success");
    //是否显示附件移除
    get attDelBtn() {
        if (
            this.fileName != '' &&
            this.fileName != null &&
            this.fileName != '请选择一个文件上传'
        ) {
            return true;
        } else {
          this.showSpinner = false;
          console.log("Error:" + result.errorMsg);
          if (result.errorMsg == "没有搜索到相关数据") {
            this.showMyToast(result.errorMsg, "", "error");
          } else {
            this.showMyToast("搜索失败", result.errorMsg, "error");
          }
            return false;
        }
      })
      .catch((error) => {
        console.log("Error:" + error);
      });
  }
    }
  //清除搜索栏
  clear(event) {
    this.category1 = "";
    this.category3 = "";
    this.category4 = "";
    this.category5 = "";
    this.showSpinner = true;
    searchConsumableorderdetails({
      userWorkLocationStr: this.userWorkLocation,
      agencyProTypeStr: this.agencyProType,
      accountNameStr: this.accountName,
      accountIdStr: this.accountid,
      contractIdStr: this.contractId,
      hospitalIdStr: this.hospitalId,
      category1Str: this.category1,
      category3Str: this.category3,
      category4Str: this.category4,
      category5Str: this.category5,
      category_GoodStr: this.category_Goods,
      specialCampaignStr: this.specialCampaign,
      dealerProductIdStr: JSON.stringify(this.dealerProductId),
      methodTypeStr: this.pageType,
      editAbleStr: this.editAble,
      consumableorderdetailsRecordsviewStr: JSON.stringify(
        this.consumableorderdetailsRecordsview
      ),
      proLimitAndDateList: this.proLimitAndDate
    }).then((result) => {
      if (result.result == "Success") {
        this.consumableorderdetailsRecordsview =
          result.consumableorderdetailsRecordsview;
    //关闭附件弹窗
    closePop() {
        this.showAttPop = false;
        this.filesUploaded = [];
        this.fileName = null;
    }
    //移除附件
    removeAtt() {
        this.filesUploaded = [];
        this.fileName = '';
    }
    //上传附件
    uploadAtt(event) {
        if (this.filesUploaded.length > 0) {
            this.file = this.filesUploaded[0];
            if (this.file.size > this.MAX_FILE_SIZE) {
                window.console.log('文件过大');
                return;
            }
            this.fileReader = new FileReader();
            this.fileReader.onloadend = () => {
                this.fileContents = this.fileReader.result;
                let base64 = 'base64,';
                this.content =
                    this.fileContents.indexOf(base64) + base64.length;
                this.fileContents = this.fileContents.substring(this.content);
                this.saveToFile();
            };
            this.fileReader.readAsDataURL(this.file);
        } else {
            this.fileName = '请选择一个文件上传';
        }
    }
    //调用上传附件后台方法
    saveToFile() {
        this.showPopSpinner = true;
        filesUpload({
            pId: this.esetId,
            fileName: this.file.name,
            base64Data: encodeURIComponent(this.fileContents)
        })
            .then((result) => {
                this.showPopSpinner = false;
                if (result.result == 'Success') {
                    this.closePop();
                    window.location.reload();
                } else {
                    console.log('Error:' + result.errorMsg);
                    this.showMyToast('上传失败', result.errorMsg, 'error');
                }
            })
            .catch((error) => {
                this.showPopSpinner = false;
                this.showMyToast('上传失败', error, 'error');
            });
    }
    //删除附件
    deleteAtt(event) {
        this.showSpinner = true;
        var recordId = event.target.getAttribute('data-fileid');
        console.log('attid:' + recordId);
        deleteAtt({ contentVersionId: recordId, cocId: this.esetId })
            .then((result) => {
                this.showSpinner = false;
                if (result.result == 'Success') {
                    window.location.reload();
                } else {
                    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');
            });
    }
    //预览附件
    previweAtt(event) {
        var recordId = event.target.getAttribute('data-fileid');
        console.log(recordId);
        this[NavigationMixin.Navigate]({
            type: 'standard__namedPage',
            attributes: {
                pageName: 'filePreview'
            },
            state: {
                recordIds: recordId,
                selectedRecordId: recordId
            }
        });
    }
    //打开搜索弹窗,并初始化弹窗
    showSearchHos(event) {
        initHospital()
            .then((result) => {
                if (result.result == 'Success') {
                    this.showAttHosPop = true;
                    this.hospitalList = result.attList;
                    for (var i in this.hospitalList) {
                        if (this.hospitalList[i].State_Master__c) {
                            this.hospitalList[i]['StateMaster'] =
                                this.hospitalList[i].State_Master__r.Name;
                        }
                    }
                } else {
                    console.log('Error:' + result.errorMsg);
                    this.showMyToast(
                        '初始化检索医院页面失败',
                        result.errorMsg,
                        'error'
                    );
                }
            })
            .catch((error) => {
                console.log('Error:' + error);
                this.showMyToast('初始化检索医院页面失败', error, 'error');
            });
    }
    //检索医院
    searchHos(event) {
        searchHospital({
            searchName: this.searchNameHos,
            accountId: this.accountid
        })
            .then((result) => {
                if (result.result == 'Success') {
                    this.hospitalList = result.attList;
                    for (var i in this.hospitalList) {
                        if (this.hospitalList[i].State_Master__c) {
                            this.hospitalList[i]['StateMaster'] =
                                this.hospitalList[i].State_Master__r.Name;
                        }
                    }
                } else {
                    console.log('Error:' + result.errorMsg);
                    this.showMyToast('搜索失败', result.errorMsg, 'error');
                }
            })
            .catch((error) => {
                console.log('Error:' + error);
                this.showMyToast('搜索失败', error, 'error');
            });
    }
    //医院名称change
    searchNameHosChange(event) {
        this.searchNameHos = event.detail.value;
    }
    //关闭弹窗
    closeHospitalPop() {
        this.showAttHosPop = false;
        this.chooseHospital = '';
        this.chooseHospitalId = '';
    }
    // //选择医院
    // chooseHos(event){
    //    var hosName = event.target.getAttribute("data-name");
    //    var hosid = event.target.getAttribute("data-hosid");
    //    console.log('hos:'+hosName+'---'+hosid);
    //    this.chooseHospital = hosName;
    //    this.chooseHospitalId = hosid;
    // }
    changeHos(event) {
        this.hospitalName = event.detail.value;
    }
    changeCon(event) {
        this.contractName = event.detail.value;
    }
    chooseHos(event) {
        const row = event.detail.row;
        this.chooseHospitalId = row.Id;
        this.chooseHospital = row.Name;
        console.log('row.Id:' + row.Id);
        console.log('row.Name:' + row.Name);
        this.confirmHospital();
    }
    //确认选择医院
    confirmHospital() {
        if (this.chooseHospital != '' && this.chooseHospital != null) {
            this.hospitalId = this.chooseHospitalId;
            this.tempidHp = this.chooseHospitalId;
            this.hospitalName = this.chooseHospital;
            this.closeHospitalPop();
            //消除警告
            var arr = [];
            for (var i in this.warningMsgs) {
                if (this.warningMsgs[i] != '请选择医院') {
                    arr.push(this.warningMsgs[i]);
                }
            }
            this.warningMsgs = arr;
            if (this.tempidHp != 'tempId' && this.tempidHp != '') {
                searchorderdetails({
                    methodTypeStr: this.pageType,
                    accountIdStr: this.accountid,
                    hospitalIdStr: this.hospitalId,
                    contractIdStr: this.contractId,
                    userWorkLocationStr: this.userWorkLocation,
                    accountNameStr: this.accountName,
                    proLimitAndDateList: this.proLimitAndDate,
                    editAbleStr: this.editAble
                })
                    .then((result) => {
                        if (result.result == 'Success') {
                            this.consumableorderdetailsRecordsview =
                                result.consumableorderdetailsRecordsview;
                            this.currentPage = 1;
                            this.currentRecord = [];
                            this.showCurrentReocrd();
                            this.getAllChecked();
                            this.showMyToast(
                                '搜索成功',
                                result.errorMsg,
                                'success'
                            );
                        } else {
                            console.log('Error:' + result.errorMsg);
                            if (result.errorMsg == '没有搜索到相关数据') {
                                this.showMyToast(result.errorMsg, '', 'error');
                            } else {
                                this.showMyToast(
                                    '搜索产品失败',
                                    result.errorMsg,
                                    'error'
                                );
                            }
                        }
                    })
                    .catch((error) => {
                        console.log('Error:' + error);
                        this.showMyToast('搜索产品失败', error, 'error');
                    });
                this.tempidHp = 'tempId';
            }
        } else {
            this.showMyToast('请选择医院', '', 'error');
        }
    }
    //打开合同检索弹窗并初始化
    showSearchCon() {
        initContract({ ctype: this.agencyProType1 })
            .then((result) => {
                if (result.result == 'Success') {
                    this.showConPop = true;
                    this.contractList = result.attList;
                    for (var i in this.contractList) {
                        if (this.contractList[i].State_Master__c) {
                            this.contractList[i]['StateMaster'] =
                                this.contractList[i].State_Master__r.Name;
                        }
                    }
                } else {
                    console.log('Error:' + result.errorMsg);
                    this.showMyToast(
                        '初始化检索合同页面失败',
                        result.errorMsg,
                        'error'
                    );
                }
            })
            .catch((error) => {
                console.log('Error:' + error);
                this.showMyToast('初始化检索合同页面失败', error, 'error');
            });
    }
    //检索合同
    searchCon() {
        searchContract({
            searchName: this.searchNameCon,
            accountId: this.accountid,
            ctype: this.agencyProType1,
            OSHFLGStr: this.OSHFLG
        })
            .then((result) => {
                if (result.result == 'Success') {
                    this.contractList = result.attList;
                    for (var i in this.contractList) {
                        if (this.contractList[i].State_Master__c) {
                            this.contractList[i]['StateMaster'] =
                                this.contractList[i].State_Master__r.Name;
                        }
                    }
                } else {
                    console.log('Error:' + result.errorMsg);
                    this.showMyToast('搜索失败', result.errorMsg, 'error');
                }
            })
            .catch((error) => {
                console.log('Error:' + error);
                this.showMyToast('搜索失败', error, 'error');
            });
    }
    searchNameConChange(event) {
        this.searchNameCon = event.detail.value;
    }
    //关闭弹窗
    closeContractPop() {
        this.showConPop = false;
        this.chooseContract = '';
        this.chooseContractId = '';
    }
    //选择合同
    // chooseCon(event){
    //    var conName = event.target.getAttribute("data-name");
    //    var conid = event.target.getAttribute("data-hosid");
    //    console.log('hos:'+conName+'---'+conid);
    //    this.chooseContract = conName;
    //    this.chooseContractId = conid;
    // }
    chooseCon(event) {
        const row = event.detail.row;
        this.chooseContractId = row.Id;
        this.chooseContract = row.Name;
        console.log('row.Id:' + row.Id);
        console.log('row.Name:' + row.Name);
        this.confirmContract();
    }
    //确认选择合同
    confirmContract() {
        if (this.chooseContract != '' && this.chooseContract != null) {
            this.contractId = this.chooseContractId;
            this.tempidPp = this.chooseContractId;
            this.contractName = this.chooseContract;
            this.closeContractPop();
            if (
                this.tempidPp != 'tempId' &&
                this.tempidPp != '' &&
                this.contractId != '' &&
                this.pageType == 'promotionorder'
            ) {
                searchorderdetails({
                    methodTypeStr: this.pageType,
                    accountIdStr: this.accountid,
                    hospitalIdStr: this.hospitalId,
                    contractIdStr: this.contractId,
                    userWorkLocationStr: this.userWorkLocation,
                    accountNameStr: this.accountName,
                    proLimitAndDateList: this.proLimitAndDate,
                    editAbleStr: this.editAble
                })
                    .then((result) => {
                        if (result.result == 'Success') {
                            this.consumableorderdetailsRecordsview =
                                result.consumableorderdetailsRecordsview;
                            this.currentPage = 1;
                            this.currentRecord = [];
                            this.showCurrentReocrd();
                            this.getAllChecked();
                            this.showMyToast(
                                '搜索成功',
                                result.errorMsg,
                                'success'
                            );
                        } else {
                            console.log('Error:' + result.errorMsg);
                            if (result.errorMsg == '没有搜索到相关数据') {
                                this.showMyToast(result.errorMsg, '', 'error');
                            } else {
                                this.showMyToast(
                                    '搜索产品失败',
                                    result.errorMsg,
                                    'error'
                                );
                            }
                        }
                    })
                    .catch((error) => {
                        console.log('Error:' + error);
                        this.showMyToast('搜索产品失败', error, 'error');
                    });
                this.tempidPp = 'tempId';
            }
        } else {
            this.showMyToast('请选择合同', '', 'error');
        }
    }
    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);
    }
    //分页
    showCurrentReocrd() {
        var startIndex = 0;
        var endIndex = 0;
        console.log('len:' + this.consumableorderdetailsRecordsview.length);
        if (
            this.consumableorderdetailsRecordsview != null &&
            this.consumableorderdetailsRecordsview.length > 0
        ) {
            var currentRecord = [];
            var currentCount = 0;
            var mu =
                this.consumableorderdetailsRecordsview.length % this.pageSize;
            if (this.currentPage == this.totalPage) {
                if (mu != 0) {
                    currentCount = mu;
                } else {
                    currentCount = this.pageSize;
                }
            } else {
                currentCount = this.pageSize;
            }
            console.log('this.totalPage:' + this.totalPage);
            console.log('this.pageSize:' + this.pageSize);
            console.log('mu:' + mu);
            console.log('currentCount:' + currentCount);
            startIndex = (this.currentPage - 1) * this.pageSize;
            endIndex = parseInt(startIndex) + parseInt(currentCount) - 1;
            console.log('startIndex:' + startIndex);
            console.log('endIndex:' + endIndex);
            if (this.editAble) {
                for (var i in this.currentRecord) {
                    if (this.currentRecord[i].check) {
                        currentRecord.push(this.currentRecord[i]);
                    }
                }
            }
            for (var i = startIndex; i <= endIndex; i++) {
                var count = 0;
                for (var j in this.currentRecord) {
                    if (
                        this.consumableorderdetailsRecordsview[i].recordId ==
                        this.currentRecord[j].recordId
                    ) {
                        count++;
                    }
                }
                if (count == 0) {
                    currentRecord.push(
                        this.consumableorderdetailsRecordsview[i]
                    );
                }
            }
            this.recordStart = startIndex + 1;
            this.recordEnd = endIndex + 1;
            this.currentRecord = currentRecord;
        } else {
            this.currentPage = 0;
            this.currentRecord = [];
        }
    }
    get prePage() {
        return this.currentPage - 1;
    }
    get nextPage() {
        return this.currentPage + 1;
    }
    get totalPage() {
        if (
            this.consumableorderdetailsRecordsview.length % this.pageSize ==
            0
        ) {
            return Math.trunc(
                this.consumableorderdetailsRecordsview.length / this.pageSize
            );
        } else {
            return (
                Math.trunc(
                    this.consumableorderdetailsRecordsview.length /
                        this.pageSize
                ) + 1
            );
        }
    }
    get totalRecords() {
        return this.consumableorderdetailsRecordsview.length;
    }
    //第一页
    goFirstPage() {
        this.currentPage = 1;
        this.showCurrentReocrd();
    }
    //最后一页
    goLastPage() {
        this.currentPage = this.totalPage;
        this.showCurrentReocrd();
    }
    //上一页
    prePageClick() {
        this.currentPage = this.currentPage - 1;
        this.showCurrentReocrd();
    }
    //下一页
    nextPageClick() {
        this.currentPage = this.currentPage + 1;
        this.showCurrentReocrd();
    }
    //page size change
    pageSizeChange(event) {
        console.log('pagesize:' + event.detail);
        this.pageSize = event.detail;
        this.currentPage = 1;
        this.currentRecord = [];
        this.showCurrentReocrd();
        this.getAllChecked();
        this.showSpinner = false;
        this.showMyToast("搜索成功", result.errorMsg, "success");
      } else {
        this.showSpinner = false;
        console.log("Error:" + result.errorMsg);
        if (result.errorMsg == "没有搜索到相关数据") {
          this.showMyToast(result.errorMsg, "", "error");
        } else {
          this.showMyToast("搜索失败", result.errorMsg, "error");
        }
      }
    });
  }
  //选择所有
  checkAll(event) {
    for (
      let i = 0, len = this.consumableorderdetailsRecordsview.length;
      i < len;
      i++
    ) {
      this.consumableorderdetailsRecordsview[i].check = event.target.checked;
    }
  }
  //选择
  check(event) {
    let index = event.target.getAttribute("data-index");
    this.consumableorderdetailsRecordsview[index].check = event.target.checked;
  }
  //采购数量change事件
  // consumableCountChange(event){
  //    let index = event.target.getAttribute("data-index");
  //    var value = event.target.value;
  //    this.consumableorderdetailsRecordsview[index].esd.Consumable_count__c = value;
  //    if(isNaN(value)){
  //       value=0.00;
  //    }
  //    if(value != null && value !=0 && value!=''){
  //       this.consumableorderdetailsRecordsview[index].check = true;
  //    }else{
  //       this.consumableorderdetailsRecordsview[index].check = false;
  //    }
  // }
  //保存订单
  saveOrder(event) {
    this.showSpinner = true;
    console.log("start save");
    save({
      contractNameStr: this.contractName,
      cocStr: JSON.stringify(this.coc),
      agencyProTypeStr: this.agencyProType,
      accountidStr: this.accountid,
      consumableorderdetailsRecordsviewStr: JSON.stringify(
        this.consumableorderdetailsRecordsview
      ),
      contactDealerStr: JSON.stringify(this.contactDealer),
      methodTypeStr: this.pageType,
      eSetIdStr: this.esetId,
      hospitalIdStr: this.hospitalId,
      contractIdStr: this.contractId,
      agencyProType1Str: this.agencyProType1,
      OSHFLGStr: this.OSHFLG
    }).then((result) => {
      this.showSpinner = false;
      if (result.result == "Success") {
        this.esetId = result.eSetId;
        const config = {
          type: "standard__webPage",
          attributes: {
            url:
              "/lexconsumable?ESetid=" + this.esetId + "&type=" + this.pageType
          }
        };
        this[NavigationMixin.Navigate](config);
      } else {
        this.showSpinner = false;
        console.log("Error:" + result.errorMsg);
        this.showMyToast("保存失败", result.errorMsg, "error");
      }
    });
  }
  //保存订单(驳回)
  orderCopy(event) {
    this.showSpinner = true;
    ordrCopy({
      contractNameStr: this.contractName,
      cocStr: JSON.stringify(this.coc),
      agencyProTypeStr: this.agencyProType,
      accountidStr: this.accountid,
      consumableorderdetailsRecordsviewStr: JSON.stringify(
        this.consumableorderdetailsRecordsview
      ),
      contactDealerStr: JSON.stringify(this.contactDealer),
      methodTypeStr: this.pageType,
      hospitalIdStr: this.hospitalId,
      contractIdStr: this.contractId,
      agencyProType1Str: this.agencyProType1,
      OSHFLGStr: this.OSHFLG
    }).then((result) => {
      this.showSpinner = false;
      if (result.result == "Success") {
        this.esetId = result.eSetId;
        const config = {
          type: "standard__webPage",
          attributes: {
            url:
              "/lexconsumable?ESetid=" + this.esetId + "&type=" + this.pageType
          }
        };
        this[NavigationMixin.Navigate](config);
      } else {
        this.showSpinner = false;
        console.log("Error:" + result.errorMsg);
        this.showMyToast("保存失败", result.errorMsg, "error");
      }
    });
  }
  //编辑
  editOrder(event) {
    setEditAble({ eSetidStr: this.esetId }).then((result) => {
      if (result.result == "Success") {
        const config = {
          type: "standard__webPage",
          attributes: {
            url: result.url
          }
        };
        this[NavigationMixin.Navigate](config);
      } else {
        this.showSpinner = false;
        console.log("Error:" + result.errorMsg);
        this.showMyToast("编辑失败", result.errorMsg, "error");
      }
    });
  }
  //打印配置单
  printOrder(event) {
    var site = window.location.origin;
    const config = {
      type: "standard__webPage",
      attributes: {
        url: site + "/consumable/PrintConsumblePDF?ESetid=" + this.esetId
      }
    };
    this[NavigationMixin.Navigate](config);
  }
  //上传配置单
  uploadOrder(event) {
    this.showAttPop = true;
  }
  //提交订单
  submitOrder(event) {
    sorder({ eSetidStr: this.esetId, accountidStr: this.accountid })
      .then((result) => {
        if (result.result == "Success") {
          const config = {
            type: "standard__webPage",
            attributes: {
              url: result.url
            }
          };
          this[NavigationMixin.Navigate](config);
        } else {
          this.showSpinner = false;
          this.errorMsgs = result.errorMsgList;
          this.warningMsgs = result.warningMsgList;
          console.log("Error:" + result.errorMsg);
          if (result.errorMsg.indexOf("请上传订货配置单附件") != -1) {
            result.errorMsg = "请上传订货配置单附件";
          }
          this.showMyToast("提交失败", result.errorMsg, "error");
        }
      })
      .catch((error) => {
        console.log("Error:" + error);
      });
  }
  //删除订单
  deleteOrder(event) {
    if (!window.confirm("删除是不可恢复的,你确认要删除吗?")) {
      return;
    //上一页按钮是否disable
    get previousButtonDisabled() {
        return this.currentPage == 1 || this.currentPage == 0;
    }
    delConsumable({ eSetidStr: this.esetId }).then((result) => {
      if (result.result == "Success") {
        const config = {
          type: "standard__webPage",
          attributes: {
            url: result.url
          }
        };
        this[NavigationMixin.Navigate](config);
      } else {
        this.showSpinner = false;
        console.log("Error:" + result.errorMsg);
        this.showMyToast("删除失败", result.errorMsg, "error");
      }
    });
  }
  //特价金额录入
  inputOfferPrice(event) {
    this.edoffersPrice = true;
    if (!(this.editAble || this.edoffersPrice)) {
      this.showEditBtn = true;
      this.showOfferPriceInputBtn = true;
    } else {
      this.showEditBtn = false;
      this.showOfferPriceInputBtn = false;
    //下一页按钮是否disable
    get nextButtonDisabled() {
        return this.currentPage == this.totalPage;
    }
    if (
      !(this.editDelCommitBtnDisabled || this.editAble || this.edoffersPrice)
    ) {
      this.showPrintSheetBtn = true;
      this.showUploadSheetBtn = true;
      this.showSubOrderbtn = true;
      this.showDeleteBtn = true;
    } else {
      this.showPrintSheetBtn = false;
      this.showUploadSheetBtn = false;
      this.showSubOrderbtn = false;
      this.showDeleteBtn = false;
    }
    if (
      (this.editDelCommitBtnDisabled || this.editAble || this.edoffersPrice) &&
      this.coc.Order_status__c != "驳回"
    ) {
      this.showSaveOrderbtn1 = true;
    } else {
      this.showSaveOrderbtn1 = false;
    }
  }
  //再申请
  reapplyOrder(event) {
    backOrder({ eSetidStr: this.esetId }).then((result) => {
      if (result.result == "Success") {
        const config = {
          type: "standard__webPage",
          attributes: {
            url: result.url
          }
        };
        this[NavigationMixin.Navigate](config);
      } else {
        this.showSpinner = false;
        console.log("Error:" + result.errorMsg);
        this.showMyToast("再申请失败", result.errorMsg, "error");
      }
    });
  }
  //附件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);
    }
  }
  //是否显示附件移除
  get attDelBtn() {
    if (
      this.fileName != "" &&
      this.fileName != null &&
      this.fileName != "请选择一个文件上传"
    ) {
      return true;
    } else {
      return false;
    }
  }
  //关闭附件弹窗
  closePop() {
    this.showAttPop = false;
    this.filesUploaded = [];
    this.fileName = null;
  }
  //移除附件
  removeAtt() {
    this.filesUploaded = [];
    this.fileName = "";
  }
  //上传附件
  uploadAtt(event) {
    if (this.filesUploaded.length > 0) {
      this.file = this.filesUploaded[0];
      if (this.file.size > this.MAX_FILE_SIZE) {
        window.console.log("文件过大");
        return;
      }
      this.fileReader = new FileReader();
      this.fileReader.onloadend = () => {
        this.fileContents = this.fileReader.result;
        let base64 = "base64,";
        this.content = this.fileContents.indexOf(base64) + base64.length;
        this.fileContents = this.fileContents.substring(this.content);
        this.saveToFile();
      };
      this.fileReader.readAsDataURL(this.file);
    } else {
      this.fileName = "请选择一个文件上传";
    }
  }
  //调用上传附件后台方法
  saveToFile() {
    this.showPopSpinner = true;
    filesUpload({
      pId: this.esetId,
      fileName: this.file.name,
      base64Data: encodeURIComponent(this.fileContents)
    })
      .then((result) => {
        this.showPopSpinner = false;
        if (result.result == "Success") {
          this.closePop();
          window.location.reload();
        } else {
          console.log("Error:" + result.errorMsg);
          this.showMyToast("上传失败", result.errorMsg, "error");
        }
      })
      .catch((error) => {
        this.showPopSpinner = false;
        this.showMyToast("上传失败", error, "error");
      });
  }
  //删除附件
  deleteAtt(event) {
    this.showSpinner = true;
    var recordId = event.target.getAttribute("data-fileid");
    console.log("attid:" + recordId);
    deleteAtt({ contentVersionId: recordId, cocId: this.esetId })
      .then((result) => {
        this.showSpinner = false;
        if (result.result == "Success") {
          window.location.reload();
        } else {
          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");
      });
  }
  //预览附件
  previweAtt(event) {
    var recordId = event.target.getAttribute("data-fileid");
    console.log(recordId);
    this[NavigationMixin.Navigate]({
      type: "standard__namedPage",
      attributes: {
        pageName: "filePreview"
      },
      state: {
        recordIds: recordId,
        selectedRecordId: recordId
      }
    });
  }
  //打开搜索弹窗,并初始化弹窗
  showSearchHos(event) {
    initHospital()
      .then((result) => {
        if (result.result == "Success") {
          this.showAttHosPop = true;
          this.hospitalList = result.attList;
          for (var i in this.hospitalList) {
            if (this.hospitalList[i].State_Master__c) {
              this.hospitalList[i]["StateMaster"] =
                this.hospitalList[i].State_Master__r.Name;
            }
          }
        } else {
          console.log("Error:" + result.errorMsg);
          this.showMyToast("初始化检索医院页面失败", result.errorMsg, "error");
        }
      })
      .catch((error) => {
        console.log("Error:" + error);
        this.showMyToast("初始化检索医院页面失败", error, "error");
      });
  }
  //检索医院
  searchHos(event) {
    searchHospital({
      searchName: this.searchNameHos,
      accountId: this.accountid
    })
      .then((result) => {
        if (result.result == "Success") {
          this.hospitalList = result.attList;
          for (var i in this.hospitalList) {
            if (this.hospitalList[i].State_Master__c) {
              this.hospitalList[i]["StateMaster"] =
                this.hospitalList[i].State_Master__r.Name;
            }
          }
        } else {
          console.log("Error:" + result.errorMsg);
          this.showMyToast("搜索失败", result.errorMsg, "error");
        }
      })
      .catch((error) => {
        console.log("Error:" + error);
        this.showMyToast("搜索失败", error, "error");
      });
  }
  //医院名称change
  searchNameHosChange(event) {
    this.searchNameHos = event.detail.value;
  }
  //关闭弹窗
  closeHospitalPop() {
    this.showAttHosPop = false;
    this.chooseHospital = "";
    this.chooseHospitalId = "";
  }
  // //选择医院
  // chooseHos(event){
  //    var hosName = event.target.getAttribute("data-name");
  //    var hosid = event.target.getAttribute("data-hosid");
  //    console.log('hos:'+hosName+'---'+hosid);
  //    this.chooseHospital = hosName;
  //    this.chooseHospitalId = hosid;
  // }
  changeHos(event) {
    this.hospitalName = event.detail.value;
  }
  changeCon(event) {
    this.contractName = event.detail.value;
  }
  chooseHos(event) {
    const row = event.detail.row;
    this.chooseHospitalId = row.Id;
    this.chooseHospital = row.Name;
    console.log("row.Id:" + row.Id);
    console.log("row.Name:" + row.Name);
    this.confirmHospital();
  }
  //确认选择医院
  confirmHospital() {
    if (this.chooseHospital != "" && this.chooseHospital != null) {
      this.hospitalId = this.chooseHospitalId;
      this.tempidHp = this.chooseHospitalId;
      this.hospitalName = this.chooseHospital;
      this.closeHospitalPop();
      //消除警告
      var arr = [];
      for (var i in this.warningMsgs) {
        if (this.warningMsgs[i] != "请选择医院") {
          arr.push(this.warningMsgs[i]);
        }
      }
      this.warningMsgs = arr;
      if (this.tempidHp != "tempId" && this.tempidHp != "") {
        searchorderdetails({
          methodTypeStr: this.pageType,
          accountIdStr: this.accountid,
          hospitalIdStr: this.hospitalId,
          contractIdStr: this.contractId,
          userWorkLocationStr: this.userWorkLocation,
          accountNameStr: this.accountName,
          proLimitAndDateList: this.proLimitAndDate,
          editAbleStr: this.editAble
        })
          .then((result) => {
            if (result.result == "Success") {
              this.consumableorderdetailsRecordsview =
                result.consumableorderdetailsRecordsview;
              this.currentPage = 1;
              this.currentRecord = [];
              this.showCurrentReocrd();
              this.getAllChecked();
              this.showMyToast("搜索成功", result.errorMsg, "success");
            } else {
              console.log("Error:" + result.errorMsg);
              if (result.errorMsg == "没有搜索到相关数据") {
                this.showMyToast(result.errorMsg, "", "error");
              } else {
                this.showMyToast("搜索产品失败", result.errorMsg, "error");
              }
            }
          })
          .catch((error) => {
            console.log("Error:" + error);
            this.showMyToast("搜索产品失败", error, "error");
          });
        this.tempidHp = "tempId";
      }
    } else {
      this.showMyToast("请选择医院", "", "error");
    }
  }
  //打开合同检索弹窗并初始化
  showSearchCon() {
    initContract({ ctype: this.agencyProType1 })
      .then((result) => {
        if (result.result == "Success") {
          this.showConPop = true;
          this.contractList = result.attList;
          for (var i in this.contractList) {
            if (this.contractList[i].State_Master__c) {
              this.contractList[i]["StateMaster"] =
                this.contractList[i].State_Master__r.Name;
            }
          }
        } else {
          console.log("Error:" + result.errorMsg);
          this.showMyToast("初始化检索合同页面失败", result.errorMsg, "error");
        }
      })
      .catch((error) => {
        console.log("Error:" + error);
        this.showMyToast("初始化检索合同页面失败", error, "error");
      });
  }
  //检索合同
  searchCon() {
    searchContract({
      searchName: this.searchNameCon,
      accountId: this.accountid,
      ctype: this.agencyProType1,
      OSHFLGStr: this.OSHFLG
    })
      .then((result) => {
        if (result.result == "Success") {
          this.contractList = result.attList;
          for (var i in this.contractList) {
            if (this.contractList[i].State_Master__c) {
              this.contractList[i]["StateMaster"] =
                this.contractList[i].State_Master__r.Name;
            }
          }
        } else {
          console.log("Error:" + result.errorMsg);
          this.showMyToast("搜索失败", result.errorMsg, "error");
        }
      })
      .catch((error) => {
        console.log("Error:" + error);
        this.showMyToast("搜索失败", error, "error");
      });
  }
  searchNameConChange(event) {
    this.searchNameCon = event.detail.value;
  }
  //关闭弹窗
  closeContractPop() {
    this.showConPop = false;
    this.chooseContract = "";
    this.chooseContractId = "";
  }
  //选择合同
  // chooseCon(event){
  //    var conName = event.target.getAttribute("data-name");
  //    var conid = event.target.getAttribute("data-hosid");
  //    console.log('hos:'+conName+'---'+conid);
  //    this.chooseContract = conName;
  //    this.chooseContractId = conid;
  // }
  chooseCon(event) {
    const row = event.detail.row;
    this.chooseContractId = row.Id;
    this.chooseContract = row.Name;
    console.log("row.Id:" + row.Id);
    console.log("row.Name:" + row.Name);
    this.confirmContract();
  }
  //确认选择合同
  confirmContract() {
    if (this.chooseContract != "" && this.chooseContract != null) {
      this.contractId = this.chooseContractId;
      this.tempidPp = this.chooseContractId;
      this.contractName = this.chooseContract;
      this.closeContractPop();
      if (
        this.tempidPp != "tempId" &&
        this.tempidPp != "" &&
        this.contractId != "" &&
        this.pageType == "promotionorder"
      ) {
        searchorderdetails({
          methodTypeStr: this.pageType,
          accountIdStr: this.accountid,
          hospitalIdStr: this.hospitalId,
          contractIdStr: this.contractId,
          userWorkLocationStr: this.userWorkLocation,
          accountNameStr: this.accountName,
          proLimitAndDateList: this.proLimitAndDate,
          editAbleStr: this.editAble
        })
          .then((result) => {
            if (result.result == "Success") {
              this.consumableorderdetailsRecordsview =
                result.consumableorderdetailsRecordsview;
              this.currentPage = 1;
              this.currentRecord = [];
              this.showCurrentReocrd();
              this.getAllChecked();
              this.showMyToast("搜索成功", result.errorMsg, "success");
            } else {
              console.log("Error:" + result.errorMsg);
              if (result.errorMsg == "没有搜索到相关数据") {
                this.showMyToast(result.errorMsg, "", "error");
              } else {
                this.showMyToast("搜索产品失败", result.errorMsg, "error");
              }
            }
          })
          .catch((error) => {
            console.log("Error:" + error);
            this.showMyToast("搜索产品失败", error, "error");
          });
        this.tempidPp = "tempId";
      }
    } else {
      this.showMyToast("请选择合同", "", "error");
    }
  }
  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);
  }
  //分页
  showCurrentReocrd() {
    var startIndex = 0;
    var endIndex = 0;
    console.log("len:" + this.consumableorderdetailsRecordsview.length);
    if (
      this.consumableorderdetailsRecordsview != null &&
      this.consumableorderdetailsRecordsview.length > 0
    ) {
      var currentRecord = [];
      var currentCount = 0;
      var mu = this.consumableorderdetailsRecordsview.length % this.pageSize;
      if (this.currentPage == this.totalPage) {
        if (mu != 0) {
          currentCount = mu;
        } else {
          currentCount = this.pageSize;
        }
      } else {
        currentCount = this.pageSize;
      }
      console.log("this.totalPage:" + this.totalPage);
      console.log("this.pageSize:" + this.pageSize);
      console.log("mu:" + mu);
      console.log("currentCount:" + currentCount);
      startIndex = (this.currentPage - 1) * this.pageSize;
      endIndex = parseInt(startIndex) + parseInt(currentCount) - 1;
      console.log("startIndex:" + startIndex);
      console.log("endIndex:" + endIndex);
      if (this.editAble) {
        for (var i in this.currentRecord) {
          if (this.currentRecord[i].check) {
            currentRecord.push(this.currentRecord[i]);
          }
        }
      }
      for (var i = startIndex; i <= endIndex; i++) {
        var count = 0;
        for (var j in this.currentRecord) {
          if (
            this.consumableorderdetailsRecordsview[i].recordId ==
            this.currentRecord[j].recordId
          ) {
            count++;
          }
        }
        if (count == 0) {
          currentRecord.push(this.consumableorderdetailsRecordsview[i]);
        }
      }
      this.recordStart = startIndex + 1;
      this.recordEnd = endIndex + 1;
      this.currentRecord = currentRecord;
    } else {
      this.currentPage = 0;
      this.currentRecord = [];
    }
  }
  get prePage() {
    return this.currentPage - 1;
  }
  get nextPage() {
    return this.currentPage + 1;
  }
  get totalPage() {
    if (this.consumableorderdetailsRecordsview.length % this.pageSize == 0) {
      return Math.trunc(
        this.consumableorderdetailsRecordsview.length / this.pageSize
      );
    } else {
      return (
        Math.trunc(
          this.consumableorderdetailsRecordsview.length / this.pageSize
        ) + 1
      );
    }
  }
  get totalRecords() {
    return this.consumableorderdetailsRecordsview.length;
  }
  //第一页
  goFirstPage() {
    this.currentPage = 1;
    this.showCurrentReocrd();
  }
  //最后一页
  goLastPage() {
    this.currentPage = this.totalPage;
    this.showCurrentReocrd();
  }
  //上一页
  prePageClick() {
    this.currentPage = this.currentPage - 1;
    this.showCurrentReocrd();
  }
  //下一页
  nextPageClick() {
    this.currentPage = this.currentPage + 1;
    this.showCurrentReocrd();
  }
  //page size change
  pageSizeChange(event) {
    console.log("pagesize:" + event.detail);
    this.pageSize = event.detail;
    this.currentPage = 1;
    this.currentRecord = [];
    this.showCurrentReocrd();
  }
  //上一页按钮是否disable
  get previousButtonDisabled() {
    return this.currentPage == 1 || this.currentPage == 0;
  }
  //下一页按钮是否disable
  get nextButtonDisabled() {
    return this.currentPage == this.totalPage;
  }
}
}
force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js
@@ -1,822 +1,867 @@
import { LightningElement, wire, api, track } from "lwc";
import { ShowToastEvent } from "lightning/platformShowToastEvent";
import init from "@salesforce/apex/LexConsumableAccountController.init";
import changeFiscalYearView from "@salesforce/apex/LexConsumableAccountController.changeFiscalYearView";
import changelistView from "@salesforce/apex/LexConsumableAccountController.changelistView";
import accountInit from "@salesforce/apex/LexConsumableAccountInfoController.init";
import { LightningElement, wire, api, track } from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import init from '@salesforce/apex/LexConsumableAccountController.init';
import changeFiscalYearView from '@salesforce/apex/LexConsumableAccountController.changeFiscalYearView';
import changelistView from '@salesforce/apex/LexConsumableAccountController.changelistView';
import accountInit from '@salesforce/apex/LexConsumableAccountInfoController.init';
//table css
import { loadStyle } from "lightning/platformResourceLoader";
import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
import { loadStyle } from 'lightning/platformResourceLoader';
import WrappedHeaderTable from '@salesforce/resourceUrl/lexdatatable';
const columns = [
  {
    label: "客户名",
    fieldName: "NameUrl",
    hideDefaultActions: true,
    wrapText: true,
    initialWidth: 200,
    sortable: true,
    type: "url",
    typeAttributes: {
      label: {
        fieldName: "Name"
      },
      target: "_blank"
    {
        label: '客户名',
        fieldName: 'NameUrl',
        hideDefaultActions: true,
        wrapText: true,
        initialWidth: 200,
        sortable: true,
        type: 'url',
        typeAttributes: {
            label: {
                fieldName: 'Name'
            },
            target: '_blank'
        }
    },
    // {
    //     label: "省",
    //     fieldName: "StateMasterUrl",
    //     hideDefaultActions: true,
    //     wrapText: true,
    //     sortable: true,
    //     type: "url",
    //     typeAttributes: {
    //         label: {
    //             fieldName: "StateMasterName",
    //         },
    //         target: "_blank",
    //     },
    // },
    {
        label: '省',
        fieldName: 'StateMasterName',
        hideDefaultActions: true,
        wrapText: true,
        sortable: true
    },
    {
        label: '销售本部医院',
        fieldName: 'Salesdepartment_HP__c',
        hideDefaultActions: true,
        sortable: true,
        wrapText: true
    },
    {
        label: '创建日期',
        fieldName: 'CreatedDate',
        hideDefaultActions: true,
        sortable: true,
        wrapText: true,
        type: 'date',
        typeAttributes: {
            timeZone: 'Asia/Shanghai',
            day: 'numeric',
            month: 'numeric',
            year: 'numeric'
        }
    },
    {
        label: '有效/无效',
        fieldName: 'Is_Active__c',
        hideDefaultActions: true,
        sortable: true,
        wrapText: true
    },
    // {
    //     label: "客户记录类型",
    //     fieldName: "RecordTypeName",
    //     hideDefaultActions: true,
    //     sortable: true,
    //     wrapText: true,
    //     initialWidth: 130,
    // },
    {
        label: '政府等级',
        fieldName: 'Grade__c',
        hideDefaultActions: true,
        sortable: true,
        wrapText: true
    },
    // {
    //     label: "OCSM分类(医院)",
    //     fieldName: "OCM_Category__c",
    //     hideDefaultActions: true,
    //     sortable: true,
    //     wrapText: true,
    // },
    // {
    //     label: "市",
    //     fieldName: "CityMasterNameUrl",
    //     hideDefaultActions: true,
    //     sortable: true,
    //     wrapText: true,
    //     type: "url",
    //     typeAttributes: {
    //         label: {
    //             fieldName: "CityMasterName",
    //         },
    //         target: "_blank",
    //     },
    // },
    {
        label: '市',
        fieldName: 'CityMasterName',
        hideDefaultActions: true,
        sortable: true,
        wrapText: true
    },
    {
        label: '县/区',
        fieldName: 'Town__c',
        hideDefaultActions: true,
        sortable: true,
        wrapText: true
    },
    {
        label: '客户电话',
        fieldName: 'Phone',
        hideDefaultActions: true,
        sortable: true,
        wrapText: true
    }
  },
  // {
  //     label: "省",
  //     fieldName: "StateMasterUrl",
  //     hideDefaultActions: true,
  //     wrapText: true,
  //     sortable: true,
  //     type: "url",
  //     typeAttributes: {
  //         label: {
  //             fieldName: "StateMasterName",
  //         },
  //         target: "_blank",
  //     },
  // },
  {
    label: "省",
    fieldName: "StateMasterName",
    hideDefaultActions: true,
    wrapText: true,
    sortable: true
  },
  {
    label: "销售本部医院",
    fieldName: "Salesdepartment_HP__c",
    hideDefaultActions: true,
    sortable: true,
    wrapText: true
  },
  {
    label: "创建日期",
    fieldName: "CreatedDate",
    hideDefaultActions: true,
    sortable: true,
    wrapText: true,
    type: "date",
    typeAttributes: {
      timeZone: "Asia/Shanghai",
      day: "numeric",
      month: "numeric",
      year: "numeric"
    }
  },
  {
    label: "有效/无效",
    fieldName: "Is_Active__c",
    hideDefaultActions: true,
    sortable: true,
    wrapText: true
  },
  // {
  //     label: "客户记录类型",
  //     fieldName: "RecordTypeName",
  //     hideDefaultActions: true,
  //     sortable: true,
  //     wrapText: true,
  //     initialWidth: 130,
  // },
  {
    label: "政府等级",
    fieldName: "Grade__c",
    hideDefaultActions: true,
    sortable: true,
    wrapText: true
  },
  // {
  //     label: "OCSM分类(医院)",
  //     fieldName: "OCM_Category__c",
  //     hideDefaultActions: true,
  //     sortable: true,
  //     wrapText: true,
  // },
  // {
  //     label: "市",
  //     fieldName: "CityMasterNameUrl",
  //     hideDefaultActions: true,
  //     sortable: true,
  //     wrapText: true,
  //     type: "url",
  //     typeAttributes: {
  //         label: {
  //             fieldName: "CityMasterName",
  //         },
  //         target: "_blank",
  //     },
  // },
  {
    label: "市",
    fieldName: "CityMasterName",
    hideDefaultActions: true,
    sortable: true,
    wrapText: true
  },
  {
    label: "县/区",
    fieldName: "Town__c",
    hideDefaultActions: true,
    sortable: true,
    wrapText: true
  },
  {
    label: "客户电话",
    fieldName: "Phone",
    hideDefaultActions: true,
    sortable: true,
    wrapText: true
  }
];
const topColumns = [
  {
    label: "客户名",
    hideDefaultActions: true,
    fieldName: "accountName",
    wrapText: true,
    type: "customShowAccountUrl",
    typeAttributes: {
      accountName: { fieldName: "accountName" },
      accountUrl: { fieldName: "accountUrl" },
      isDisable: { fieldName: "isDisable" }
    }
  },
  // {
  //     label: "市",
  //     fieldName: "CityMasterName",
  //     hideDefaultActions: true,
  //     wrapText: true,
  //     type: "customShowAccountUrl",
  //     typeAttributes: {
  //         accountName: { fieldName: "CityMasterName" },
  //         accountUrl: { fieldName: "CityMasterNameUrl" },
  //         isDisable: { fieldName: "isDisable" },
  //     },
  // },
  {
    label: "市",
    fieldName: "CityMasterName",
    hideDefaultActions: true,
    wrapText: true
  },
  {
    label: "县/区",
    fieldName: "Town__c",
    hideDefaultActions: true,
    wrapText: true
  },
  {
    label: "销量占比",
    fieldName: "proportion",
    hideDefaultActions: true,
    wrapText: true,
    initialWidth: 100,
    cellAttributes: { alignment: "right" }
  },
  {
    label: "操作",
    fieldName: "Town__c",
    type: "weeklyReport",
    initialWidth: 150,
    typeAttributes: {
      recordId: { fieldName: "Id" },
      hospitalName: { fieldName: "Name" },
      isShowButton: { fieldName: "isShowButton" }
    {
        label: '客户名',
        hideDefaultActions: true,
        fieldName: 'accountName',
        wrapText: true,
        type: 'customShowAccountUrl',
        typeAttributes: {
            accountName: { fieldName: 'accountName' },
            accountUrl: { fieldName: 'accountUrl' },
            isDisable: { fieldName: 'isDisable' }
        }
    },
    hideDefaultActions: true
  }
    // {
    //     label: "市",
    //     fieldName: "CityMasterName",
    //     hideDefaultActions: true,
    //     wrapText: true,
    //     type: "customShowAccountUrl",
    //     typeAttributes: {
    //         accountName: { fieldName: "CityMasterName" },
    //         accountUrl: { fieldName: "CityMasterNameUrl" },
    //         isDisable: { fieldName: "isDisable" },
    //     },
    // },
    {
        label: '市',
        fieldName: 'CityMasterName',
        hideDefaultActions: true,
        wrapText: true
    },
    {
        label: '县/区',
        fieldName: 'Town__c',
        hideDefaultActions: true,
        wrapText: true
    },
    {
        label: '销量占比',
        fieldName: 'proportion',
        hideDefaultActions: true,
        wrapText: true,
        initialWidth: 100,
        cellAttributes: { alignment: 'right' }
    },
    {
        label: '操作',
        fieldName: 'Town__c',
        type: 'weeklyReport',
        initialWidth: 150,
        typeAttributes: {
            recordId: { fieldName: 'Id' },
            hospitalName: { fieldName: 'Name' },
            isShowButton: { fieldName: 'isShowButton' }
        },
        hideDefaultActions: true
    }
];
export default class LexConsumableAccount extends LightningElement {
  columns = columns;
  topColumns = topColumns;
  @track isShowSpinner = false;
  @track pageRecords = [];
  @track accountId = "";
  @track agencyProType = "";
  @track agencyProTypestr = "";
  @track listViewOptions = [
    {
      label: "01. 医院_Hospital",
      value: "01. 医院_Hospital"
    },
    // {
    //     label: "61. 医院_Hospital草案中的医院",
    //     value: "61. 医院_Hospital草案中的医院",
    // },
    // {
    //     label: "62. 医院_Hospital申请中的医院",
    //     value: "62. 医院_Hospital申请中的医院",
    // },
    {
      label: "63. 医院_Hospital上周创建的医院",
      value: "63. 医院_Hospital上周创建的医院"
    }
  ];
  @track viewOption = "01. 医院_Hospital";
  @track isShowAccountInfo = false;
  @track topAccountData = [];
  //前端排序
  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
  @track AccId = "";
  @track printUrl = "";
  @track accountDataInfo = {
    name: "",
    ownerName: "",
    site: "",
    isActive: "",
    aliasName2: "",
    banOnUseReason: "",
    grade: "",
    attributeType: "",
    oCMCategory: "",
    specialityType: "",
    stateMasterName: "",
    phone: "",
    cityMasterName: "",
    phoneCall: "",
    town: "",
    fax: "",
    street: "",
    postalCode: "",
    address: "",
    parentName: ""
  };
  stylesLoaded = false;
  //财年
  @track fiscalYearOptions = [
    { label: "本财年", value: "thisYear" },
    { label: "上一财年", value: "lastYear" },
    { label: "上一财年+本财年", value: "allYear" }
  ];
  @track fiscalYearOption = "thisYear";
  @track topInfo = [];
  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.isShowSpinner = true;
    this.AccId = this.getQueryString("AccId");
    this.AccId = this.AccId == null ? "" : this.AccId;
    if (this.AccId != "") {
      console.log("this.AccId = " + this.AccId);
      accountInit({
        accId: this.AccId
      })
        .then((r) => {
          r = JSON.parse(JSON.stringify(r));
          console.log("r = " + JSON.stringify(r));
          if (r.status == "Success") {
            console.log("r.entity.obj = " + JSON.stringify(r.entity.obj));
            this.accountDataInfo.name = r.entity.obj.Name;
            this.accountDataInfo.ownerName =
              r.entity.obj.Owner == null ? "" : r.entity.obj.Owner.Name;
            this.accountDataInfo.site = r.entity.obj.site;
            this.accountDataInfo.isActive = r.entity.obj.Is_Active__c;
            this.accountDataInfo.aliasName2 = r.entity.obj.Alias_Name2__c;
            this.accountDataInfo.banOnUseReason =
              r.entity.obj.Ban_On_Use_Reason__c;
            this.accountDataInfo.grade = r.entity.obj.Grade__c;
            this.accountDataInfo.attributeType = r.entity.obj.Attribute_Type__c;
            this.accountDataInfo.oCMCategory = r.entity.obj.OCM_Category__c;
            this.accountDataInfo.specialityType =
              r.entity.obj.Speciality_Type__c;
            this.accountDataInfo.stateMasterName =
              r.entity.obj.State_Master__r == null
                ? ""
                : r.entity.obj.State_Master__r.Name;
            this.accountDataInfo.phone = r.entity.obj.Phone;
            this.accountDataInfo.cityMasterName =
              r.entity.obj.City_Master__r == null
                ? ""
                : r.entity.obj.City_Master__r.Name;
            this.accountDataInfo.phoneCall = r.entity.obj.PhoneCall__c;
            this.accountDataInfo.town = r.entity.obj.Town__c;
            this.accountDataInfo.fax = r.entity.obj.Fax;
            this.accountDataInfo.street = r.entity.obj.Street__c;
            this.accountDataInfo.postalCode = r.entity.obj.Postal_Code__c;
            this.accountDataInfo.address = r.entity.obj.Address__c;
            this.accountDataInfo.parentName =
              r.entity.obj.Parent == null ? "" : r.entity.obj.Parent.Name;
            console.log(
              "this.accountDataInfo = " + JSON.stringify(this.accountDataInfo)
            );
            this.printUrl =
              "/lexconsumableaccountinfoprint?AccId=" + this.AccId;
            this.isShowAccountInfo = true;
            this.isShowSpinner = false;
          } else {
            console.log("r = " + JSON.stringify(r));
            this.showMyToast("Error", r.msg, "Error");
          }
        })
        .catch((error) => {
          console.log("error = " + JSON.stringify(error));
          this.showMyToast("Error", "初始化失败", "Error");
        });
    } else {
      init({
        pageSizeLWC: this.pageSize,
        pageTokenLWC: this.currentPageToken,
        fiscalYear: this.fiscalYearOption
      })
        .then((r) => {
          r = JSON.parse(JSON.stringify(r));
          console.log("r = " + JSON.stringify(r));
          if (r.status == "Success") {
            //分页
            this.nextPageToken = r.entity.paginatedAccounts.nextPageToken;
            this.totalRecords = r.entity.paginatedAccounts.totalRecords;
            this.recordStart = r.entity.paginatedAccounts.recordStart;
            this.recordEnd = r.entity.paginatedAccounts.recordEnd;
            this.totalPages = Math.ceil(
              r.entity.paginatedAccounts.totalRecords / this.pageSize
            );
            console.log("this.totalPages = " + this.totalPages);
            this.paginationVisibility = this.totalPages > 1 ? true : false;
            this.pageRecords = r.entity.pageRecords;
            this.accountId = r.entity.accountId;
            this.agencyProType = r.entity.agencyProType;
            this.agencyProTypestr = r.entity.agencyProTypestr;
            console.log("this.agencyProTypestr = " + this.agencyProTypestr);
            for (var i in this.pageRecords) {
              this.pageRecords[i]["Is_Active__c"] = this.pageRecords[
                i
              ].Is_Active__c.replace("効", "效");
              this.pageRecords[i]["NameUrl"] =
                "/s/lexconsumableaccount?AccId=" + this.pageRecords[i].Id;
              this.pageRecords[i]["StateMasterName"] =
                this.pageRecords[i].State_Master__r.Name;
              this.pageRecords[i]["StateMasterUrl"] =
                "/" + this.pageRecords[i].State_Master__c;
              this.pageRecords[i]["CityMasterName"] =
                this.pageRecords[i].City_Master__r.Name;
              this.pageRecords[i]["CityMasterNameUrl"] =
                "/" + this.pageRecords[i].City_Master__c;
              this.pageRecords[i]["RecordTypeName"] =
                this.pageRecords[i].RecordType.Name;
            }
            console.log(
              "this.listViewOptions = " + JSON.stringify(this.listViewOptions)
            );
            console.log(
              "r.entity.topInfo = " + JSON.stringify(r.entity.topInfo)
            );
            //top10客户
            this.topInfo = r.entity.topInfo;
            console.log("this.topInfo = " + JSON.stringify(this.topInfo));
            this.topAccountData = this.topInfo.acList;
            console.log(
              "this.topAccountData = " + JSON.stringify(this.topAccountData)
            );
            console.log(
              "9/3 = " +
                this.keepTwoDecimalStr(this.amend(9, 3, "/").toFixed(2))
            );
            let total = 100;
            try {
              for (var i in this.topAccountData) {
                this.topAccountData[i]["accountName"] =
                  this.topAccountData[i].Name;
                this.topAccountData[i]["accountUrl"] =
                  "/s/lexconsumableaccount?AccId=" + this.topAccountData[i].Id;
                this.topAccountData[i]["isDisable"] = false;
                this.topAccountData[i]["StateMasterName"] =
                  this.topAccountData[i].State_Master__r.Name;
                this.topAccountData[i]["StateMasterUrl"] =
                  "/" + this.topAccountData[i].State_Master__c;
                this.topAccountData[i]["CityMasterName"] =
                  this.topAccountData[i].City_Master__r.Name;
                this.topAccountData[i]["CityMasterNameUrl"] =
                  "/" + this.topAccountData[i].City_Master__c;
                this.topAccountData[i]["RecordTypeName"] =
                  this.topAccountData[i].RecordType.Name;
                this.topAccountData[i]["isShowButton"] = true;
                let number = this.keepTwoDecimalStr(
                  (
                    this.amend(
                      this.topInfo.deList[i],
                      this.topInfo.saleAmount,
                      "/"
                    ) * 100
                  ).toFixed(2)
                );
                console.log(
                  "this.amend = " +
                    this.amend(
                      this.topInfo.deList[i],
                      this.topInfo.saleAmount,
                      "/"
                    ) *
                      100
                );
                total -= number;
                this.topAccountData[i]["proportion"] = number + "%";
              }
              console.log(
                "this.topAccountData = " + JSON.stringify(this.topAccountData)
              );
              //其他
              console.log(
                "(total.toFixed(2) > 0.00 ? total.toFixed(2) : 0.00) = " +
                  (total.toFixed(2) > 0.0 ? total.toFixed(2) : "0.00")
              );
              if (total != 100) {
                this.topAccountData.push({
                  accountName: "...",
                  accountUrl: "/s/lexconsumableaccount",
                  isDisable: true,
                  proportion:
                    (total.toFixed(2) > 0.0 ? total.toFixed(2) : "0.00") + "%",
                  CityMasterName: "...",
                  CityMasterNameUrl: "/lexconsumableaccount",
                  Town__c: "...",
                  isShowButton: false
                });
              } else {
                let title = "";
                for (var key in this.fiscalYearOptions) {
                  if (
                    this.fiscalYearOption == this.fiscalYearOptions[key].value
                  )
                    title = this.fiscalYearOptions[key].label;
                }
                this.showMyToast(title, "无数据", "Error");
              }
              this.isShowSpinner = false;
            } catch (error) {
              console.log("error = " + error.message);
            }
          } else {
            console.log("r = " + JSON.stringify(r));
            this.showMyToast("Error", r.msg, "Error");
          }
        })
        .catch((error) => {
          console.log("error = " + JSON.stringify(error));
          this.showMyToast("Error", "销量前十客户初始化失败", "Error");
        });
    }
  }
  amend(num1, num2, symbol) {
    console.log("num1 = " + num1);
    console.log("num2 = " + num2);
    console.log("symbol = " + 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));
    console.log(step);
    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;
  }
  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 "viewOption":
        this.viewOption = value;
        this.changelistView();
        break;
      case "fiscalYearOption":
        this.fiscalYearOption = value;
        this.changeFiscalYear();
        break;
    }
  }
  changeFiscalYear() {
    this.isShowSpinner = true;
    changeFiscalYearView({
      fiscalYear: this.fiscalYearOption
    })
      .then((r) => {
        r = JSON.parse(JSON.stringify(r));
        console.log("r = " + JSON.stringify(r));
        if (r.status == "Success") {
          //top10客户
          this.topInfo = r.entity.topInfo;
          console.log("this.topInfo = " + JSON.stringify(this.topInfo));
          this.topAccountData = this.topInfo.acList;
          console.log(
            "this.topAccountData = " + JSON.stringify(this.topAccountData)
          );
          let total = 100;
          for (var i in this.topAccountData) {
            console.log("i = " + i);
            this.topAccountData[i]["accountName"] = this.topAccountData[i].Name;
            this.topAccountData[i]["accountUrl"] =
              "/s/lexconsumableaccount?AccId=" + this.topAccountData[i].Id;
            this.topAccountData[i]["isDisable"] = false;
            this.topAccountData[i]["StateMasterName"] =
              this.topAccountData[i].State_Master__r.Name;
            this.topAccountData[i]["StateMasterUrl"] =
              "/" + this.topAccountData[i].State_Master__c;
            this.topAccountData[i]["CityMasterName"] =
              this.topAccountData[i].City_Master__r.Name;
            this.topAccountData[i]["CityMasterNameUrl"] =
              "/" + this.topAccountData[i].City_Master__c;
            this.topAccountData[i]["RecordTypeName"] =
              this.topAccountData[i].RecordType.Name;
            this.topAccountData[i]["isShowButton"] = true;
            let number = this.keepTwoDecimalStr(
              (
                this.amend(
                  this.topInfo.deList[i],
                  this.topInfo.saleAmount,
                  "/"
                ) * 100
              ).toFixed(2)
            );
            total -= number;
            this.topAccountData[i]["proportion"] = number + "%";
          }
          // //其他
          if (total != 100) {
            this.topAccountData.push({
              accountName: "...",
              accountUrl: "/s/lexconsumableaccount",
              isDisable: true,
              proportion:
                (total.toFixed(2) > 0.0 ? total.toFixed(2) : "0.00") + "%",
              CityMasterName: "...",
              CityMasterNameUrl: "/lexconsumableaccount",
              Town__c: "...",
              isShowButton: false
            });
          } else {
            let title = "";
            for (var key in this.fiscalYearOptions) {
              if (this.fiscalYearOption == this.fiscalYearOptions[key].value)
                title = this.fiscalYearOptions[key].label;
            }
            this.showMyToast(title, "无数据", "Error");
          }
          this.isShowSpinner = false;
        } else {
          console.log("r = " + JSON.stringify(r));
          this.showMyToast("Error", r.msg, "Error");
    columns = columns;
    topColumns = topColumns;
    @track isShowSpinner = false;
    @track pageRecords = [];
    @track accountId = '';
    @track agencyProType = '';
    @track agencyProTypestr = '';
    @track listViewOptions = [
        {
            label: '01. 医院_Hospital',
            value: '01. 医院_Hospital'
        },
        // {
        //     label: "61. 医院_Hospital草案中的医院",
        //     value: "61. 医院_Hospital草案中的医院",
        // },
        // {
        //     label: "62. 医院_Hospital申请中的医院",
        //     value: "62. 医院_Hospital申请中的医院",
        // },
        {
            label: '63. 医院_Hospital上周创建的医院',
            value: '63. 医院_Hospital上周创建的医院'
        }
      })
      .catch((error) => {
        console.log("error = " + JSON.stringify(error));
        this.showMyToast("Error", "销量前十客户初始化失败", "Error");
      });
  }
    ];
    @track viewOption = '01. 医院_Hospital';
  changelistView() {
    this.isShowSpinner = true;
    changelistView({
      filterNameLwc: this.viewOption,
      accountIdLwc: this.accountId,
      agencyProTypeLwc: this.agencyProType,
      pageSizeLWC: this.pageSize,
      pageTokenLWC: this.currentPageToken,
      sortFieldLWC: this.sortBy,
      sortOrderLWC: this.sortDirection
    })
      .then((r) => {
        r = JSON.parse(JSON.stringify(r));
        console.log("r = " + JSON.stringify(r));
        if (r.status == "Success") {
          //分页
          this.nextPageToken = r.entity.paginatedAccounts.nextPageToken;
          this.totalRecords = r.entity.paginatedAccounts.totalRecords;
          this.recordStart = r.entity.paginatedAccounts.recordStart;
          this.recordEnd = r.entity.paginatedAccounts.recordEnd;
          this.totalPages = Math.ceil(
            r.entity.paginatedAccounts.totalRecords / this.pageSize
          );
          console.log("this.totalPages = " + this.totalPages);
          this.paginationVisibility = this.totalPages > 1 ? true : false;
    @track isShowAccountInfo = false;
    @track topAccountData = [];
          this.pageRecords = r.entity.pageRecords;
          console.log("this.pageRecords = " + JSON.stringify(this.pageRecords));
          for (var i in this.pageRecords) {
            this.pageRecords[i]["Is_Active__c"] = this.pageRecords[
              i
            ].Is_Active__c.replace("効", "效");
            this.pageRecords[i]["NameUrl"] =
              "/s/lexconsumableaccount?AccId=" + this.pageRecords[i].Id;
            this.pageRecords[i]["StateMasterName"] =
              this.pageRecords[i].State_Master__r.Name;
            this.pageRecords[i]["StateMasterUrl"] =
              "/" + this.pageRecords[i].State_Master__c;
            this.pageRecords[i]["CityMasterName"] =
              this.pageRecords[i].City_Master__r.Name;
            this.pageRecords[i]["CityMasterNameUrl"] =
              "/" + this.pageRecords[i].City_Master__c;
            this.pageRecords[i]["RecordTypeName"] =
              this.pageRecords[i].RecordType.Name;
          }
          this.isShowSpinner = false;
        } else {
          this.showMyToast("Error", r.msg, "Error");
        }
      })
      .catch((error) => {
        console.log("error = " + JSON.stringify(error.message));
      });
  }
    //前端排序
    defaultSortDirection = 'asc';
    sortDirection = 'asc';
    sortedBy;
  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);
  }
    //分页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
  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));
    @track AccId = '';
    @track printUrl = '';
    @track accountDataInfo = {
        name: '',
        ownerName: '',
        site: '',
        isActive: '',
        aliasName2: '',
        banOnUseReason: '',
        grade: '',
        attributeType: '',
        oCMCategory: '',
        specialityType: '',
        stateMasterName: '',
        phone: '',
        cityMasterName: '',
        phoneCall: '',
        town: '',
        fax: '',
        street: '',
        postalCode: '',
        address: '',
        parentName: ''
    };
  }
  onHandleSort(event) {
    console.log("event.detail.fieldName = " + event.detail.fieldName);
    this.sortBy = event.detail.fieldName;
    switch (this.sortBy) {
      case "NameUrl":
        this.sortBy = "Name";
        break;
      case "StateMasterName":
        this.sortBy = "State_Master__r.Name";
        break;
      case "RecordTypeName":
        this.sortBy = "RecordType.Name";
        break;
      case "CityMasterName":
        this.sortBy = "City_Master__r.Name";
        break;
    stylesLoaded = false;
    //财年
    @track fiscalYearOptions = [
        { label: '本财年', value: 'thisYear' },
        { label: '上一财年', value: 'lastYear' },
        { label: '上一财年+本财年', value: 'allYear' }
    ];
    @track fiscalYearOption = 'thisYear';
    @track topInfo = [];
    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');
                });
        }
    }
    this.sortDirection = event.detail.sortDirection;
    this.currentPageToken = 0;
    console.log("this.sortBy = " + this.sortBy);
    console.log("this.sortDirection = " + this.sortDirection);
    this.changelistView();
    const { fieldName: sortedBy, sortDirection } = event.detail;
    this.sortByMethod(sortedBy, sortDirection === "asc" ? 1 : -1);
    this.sortDirection = sortDirection;
    this.sortedBy = sortedBy;
  }
  handlePrevious() {
    this.currentPageToken =
      Number(this.currentPageToken) - Number(this.pageSize);
    this.changelistView();
  }
    //获取链接参数
    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;
    }
  handleNext() {
    this.currentPageToken =
      Number(this.currentPageToken) + Number(this.pageSize);
    this.changelistView();
  }
  handleFirst() {
    this.currentPageToken = 0;
    this.changelistView();
  }
    connectedCallback() {
        this.isShowSpinner = true;
        this.AccId = this.getQueryString('AccId');
        this.AccId = this.AccId == null ? '' : this.AccId;
        if (this.AccId != '') {
            console.log('this.AccId = ' + this.AccId);
            accountInit({
                accId: this.AccId
            })
                .then((r) => {
                    r = JSON.parse(JSON.stringify(r));
                    console.log('r = ' + JSON.stringify(r));
                    if (r.status == 'Success') {
                        console.log(
                            'r.entity.obj = ' + JSON.stringify(r.entity.obj)
                        );
                        this.accountDataInfo.name = r.entity.obj.Name;
                        this.accountDataInfo.ownerName =
                            r.entity.obj.Owner == null
                                ? ''
                                : r.entity.obj.Owner.Name;
                        this.accountDataInfo.site = r.entity.obj.site;
                        this.accountDataInfo.isActive =
                            r.entity.obj.Is_Active__c;
                        this.accountDataInfo.aliasName2 =
                            r.entity.obj.Alias_Name2__c;
                        this.accountDataInfo.banOnUseReason =
                            r.entity.obj.Ban_On_Use_Reason__c;
                        this.accountDataInfo.grade = r.entity.obj.Grade__c;
                        this.accountDataInfo.attributeType =
                            r.entity.obj.Attribute_Type__c;
                        this.accountDataInfo.oCMCategory =
                            r.entity.obj.OCM_Category__c;
                        this.accountDataInfo.specialityType =
                            r.entity.obj.Speciality_Type__c;
                        this.accountDataInfo.stateMasterName =
                            r.entity.obj.State_Master__r == null
                                ? ''
                                : r.entity.obj.State_Master__r.Name;
                        this.accountDataInfo.phone = r.entity.obj.Phone;
                        this.accountDataInfo.cityMasterName =
                            r.entity.obj.City_Master__r == null
                                ? ''
                                : r.entity.obj.City_Master__r.Name;
                        this.accountDataInfo.phoneCall =
                            r.entity.obj.PhoneCall__c;
                        this.accountDataInfo.town = r.entity.obj.Town__c;
                        this.accountDataInfo.fax = r.entity.obj.Fax;
                        this.accountDataInfo.street = r.entity.obj.Street__c;
                        this.accountDataInfo.postalCode =
                            r.entity.obj.Postal_Code__c;
                        this.accountDataInfo.address = r.entity.obj.Address__c;
                        this.accountDataInfo.parentName =
                            r.entity.obj.Parent == null
                                ? ''
                                : r.entity.obj.Parent.Name;
                        console.log(
                            'this.accountDataInfo = ' +
                            JSON.stringify(this.accountDataInfo)
                        );
                        this.printUrl =
                            '/lexconsumableaccountinfoprint?AccId=' +
                            this.AccId;
                        this.isShowAccountInfo = true;
                        this.isShowSpinner = false;
                    } else {
                        console.log('r = ' + JSON.stringify(r));
                        this.showMyToast('Error', r.msg, 'Error');
                    }
                })
                .catch((error) => {
                    console.log('error = ' + JSON.stringify(error));
                    this.showMyToast('Error', '初始化失败', 'Error');
                });
        } else {
            init({
                pageSizeLWC: this.pageSize,
                pageTokenLWC: this.currentPageToken,
                fiscalYear: this.fiscalYearOption
            })
                .then((r) => {
                    r = JSON.parse(JSON.stringify(r));
                    console.log('r = ' + JSON.stringify(r));
                    if (r.status == 'Success') {
                        //分页
                        this.nextPageToken =
                            r.entity.paginatedAccounts.nextPageToken;
                        this.totalRecords =
                            r.entity.paginatedAccounts.totalRecords;
                        this.recordStart =
                            r.entity.paginatedAccounts.recordStart;
                        this.recordEnd = r.entity.paginatedAccounts.recordEnd;
                        this.totalPages = Math.ceil(
                            r.entity.paginatedAccounts.totalRecords /
                            this.pageSize
                        );
                        console.log('this.totalPages = ' + this.totalPages);
                        this.paginationVisibility =
                            this.totalPages > 1 ? true : false;
  handleLast() {
    this.currentPageToken =
      this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
    this.changelistView();
  }
                        this.pageRecords = r.entity.pageRecords;
                        this.accountId = r.entity.accountId;
                        this.agencyProType = r.entity.agencyProType;
                        this.agencyProTypestr = r.entity.agencyProTypestr;
                        console.log(
                            'this.agencyProTypestr = ' + this.agencyProTypestr
                        );
                        for (var i in this.pageRecords) {
                            this.pageRecords[i]['Is_Active__c'] =
                                this.pageRecords[i].Is_Active__c.replace(
                                    '効',
                                    '效'
                                );
                            this.pageRecords[i]['NameUrl'] =
                                '/s/lexconsumableaccount?AccId=' +
                                this.pageRecords[i].Id;
                            this.pageRecords[i]['StateMasterName'] =
                                this.pageRecords[i].State_Master__r.Name;
                            this.pageRecords[i]['StateMasterUrl'] =
                                '/' + this.pageRecords[i].State_Master__c;
                            this.pageRecords[i]['CityMasterName'] =
                                this.pageRecords[i].City_Master__r.Name;
                            this.pageRecords[i]['CityMasterNameUrl'] =
                                '/' + this.pageRecords[i].City_Master__c;
                            this.pageRecords[i]['RecordTypeName'] =
                                this.pageRecords[i].RecordType.Name;
                        }
                        console.log(
                            'this.listViewOptions = ' +
                            JSON.stringify(this.listViewOptions)
                        );
  handlePageschange(event) {
    console.log(event.detail);
    this.pageSize = event.detail;
    this.currentPageToken = 0;
    this.changelistView();
  }
  get previousButtonDisabled() {
    return this.currentPageToken === 0;
  }
                        console.log(
                            'r.entity.topInfo = ' +
                            JSON.stringify(r.entity.topInfo)
                        );
                        //top10客户
                        this.topInfo = r.entity.topInfo;
                        console.log(
                            'this.topInfo = ' + JSON.stringify(this.topInfo)
                        );
                        this.topAccountData = this.topInfo.acList;
                        console.log(
                            'this.topAccountData = ' +
                            JSON.stringify(this.topAccountData)
                        );
                        console.log(
                            '9/3 = ' +
                            this.keepTwoDecimalStr(
                                this.amend(9, 3, '/').toFixed(2)
                            )
                        );
                        let total = 100;
                        try {
                            for (var i in this.topAccountData) {
                                this.topAccountData[i]['accountName'] =
                                    this.topAccountData[i].Name;
                                this.topAccountData[i]['accountUrl'] =
                                    '/s/lexconsumableaccount?AccId=' +
                                    this.topAccountData[i].Id;
                                this.topAccountData[i]['isDisable'] = false;
                                this.topAccountData[i]['StateMasterName'] =
                                    this.topAccountData[i].State_Master__r.Name;
                                this.topAccountData[i]['StateMasterUrl'] =
                                    '/' +
                                    this.topAccountData[i].State_Master__c;
                                this.topAccountData[i]['CityMasterName'] =
                                    this.topAccountData[i].City_Master__r.Name;
                                this.topAccountData[i]['CityMasterNameUrl'] =
                                    '/' + this.topAccountData[i].City_Master__c;
                                this.topAccountData[i]['RecordTypeName'] =
                                    this.topAccountData[i].RecordType.Name;
                                this.topAccountData[i]['isShowButton'] = true;
                                let number = this.keepTwoDecimalStr(
                                    (
                                        this.amend(
                                            this.topInfo.deList[i],
                                            this.topInfo.saleAmount,
                                            '/'
                                        ) * 100
                                    ).toFixed(2)
                                );
                                console.log('this.amend = ' +  this.amend(this.topInfo.deList[i],this.topInfo.saleAmount,'/') * 100);
                                total -= number;
                                this.topAccountData[i]['proportion'] =
                                    number + '%';
                            }
  get nextButtonDisabled() {
    return this.nextPageToken === undefined;
  }
}
                            console.log(
                                'this.topAccountData = ' +
                                JSON.stringify(this.topAccountData)
                            );
                            //其他
                            console.log('(total.toFixed(2) > 0.00 ? total.toFixed(2) : 0.00) = ' + (total.toFixed(2) > 0.00 ? total.toFixed(2) : '0.00'))
                            if (total != 100) {
                                this.topAccountData.push({
                                    accountName: '...',
                                    accountUrl: '/s/lexconsumableaccount',
                                    isDisable: true,
                                    proportion: (total.toFixed(2) > 0.00 ? total.toFixed(2) : '0.00') + '%',
                                    CityMasterName: '...',
                                    CityMasterNameUrl: '/lexconsumableaccount',
                                    Town__c: '...',
                                    isShowButton: false
                                });
                            } else {
                                let title = '';
                                for (var key in this.fiscalYearOptions) {
                                    if (
                                        this.fiscalYearOption ==
                                        this.fiscalYearOptions[key].value
                                    )
                                        title =
                                            this.fiscalYearOptions[key].label;
                                }
                                this.showMyToast(title, '无数据', 'Error');
                            }
                            this.isShowSpinner = false;
                        } catch (error) {
                            console.log('error = ' + error.message);
                        }
                    } else {
                        console.log('r = ' + JSON.stringify(r));
                        this.showMyToast('Error', r.msg, 'Error');
                    }
                })
                .catch((error) => {
                    console.log('error = ' + JSON.stringify(error));
                    this.showMyToast(
                        'Error',
                        '销量前十客户初始化失败',
                        'Error'
                    );
                });
        }
    }
    amend(num1, num2, symbol) {
        console.log('num1 = ' + num1);
        console.log('num2 = ' + num2);
        console.log('symbol = ' + 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));
        console.log(step);
        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;
    }
    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 'viewOption':
                this.viewOption = value;
                this.changelistView();
                break;
            case 'fiscalYearOption':
                this.fiscalYearOption = value;
                this.changeFiscalYear();
                break;
        }
    }
    changeFiscalYear() {
        this.isShowSpinner = true;
        changeFiscalYearView({
            fiscalYear: this.fiscalYearOption
        })
            .then((r) => {
                r = JSON.parse(JSON.stringify(r));
                console.log('r = ' + JSON.stringify(r));
                if (r.status == 'Success') {
                    //top10客户
                    this.topInfo = r.entity.topInfo;
                    console.log(
                        'this.topInfo = ' + JSON.stringify(this.topInfo)
                    );
                    this.topAccountData = this.topInfo.acList;
                    console.log(
                        'this.topAccountData = ' +
                        JSON.stringify(this.topAccountData)
                    );
                    let total = 100;
                    for (var i in this.topAccountData) {
                        console.log('i = ' + i);
                        this.topAccountData[i]['accountName'] =
                            this.topAccountData[i].Name;
                        this.topAccountData[i]['accountUrl'] =
                            '/s/lexconsumableaccount?AccId=' +
                            this.topAccountData[i].Id;
                        this.topAccountData[i]['isDisable'] = false;
                        this.topAccountData[i]['StateMasterName'] =
                            this.topAccountData[i].State_Master__r.Name;
                        this.topAccountData[i]['StateMasterUrl'] =
                            '/' + this.topAccountData[i].State_Master__c;
                        this.topAccountData[i]['CityMasterName'] =
                            this.topAccountData[i].City_Master__r.Name;
                        this.topAccountData[i]['CityMasterNameUrl'] =
                            '/' + this.topAccountData[i].City_Master__c;
                        this.topAccountData[i]['RecordTypeName'] =
                            this.topAccountData[i].RecordType.Name;
                        this.topAccountData[i]['isShowButton'] = true;
                        let number = this.keepTwoDecimalStr(
                            (
                                this.amend(
                                    this.topInfo.deList[i],
                                    this.topInfo.saleAmount,
                                    '/'
                                ) * 100
                            ).toFixed(2)
                        );
                        total -= number;
                        this.topAccountData[i]['proportion'] = number + '%';
                    }
                    // //其他
                    if (total != 100) {
                        this.topAccountData.push({
                            accountName: '...',
                            accountUrl: '/s/lexconsumableaccount',
                            isDisable: true,
                            proportion: (total.toFixed(2) > 0.00 ? total.toFixed(2) : '0.00') + '%',
                            CityMasterName: '...',
                            CityMasterNameUrl: '/lexconsumableaccount',
                            Town__c: '...',
                            isShowButton: false
                        });
                    } else {
                        let title = '';
                        for (var key in this.fiscalYearOptions) {
                            if (
                                this.fiscalYearOption ==
                                this.fiscalYearOptions[key].value
                            )
                                title = this.fiscalYearOptions[key].label;
                        }
                        this.showMyToast(title, '无数据', 'Error');
                    }
                    this.isShowSpinner = false;
                } else {
                    console.log('r = ' + JSON.stringify(r));
                    this.showMyToast('Error', r.msg, 'Error');
                }
            })
            .catch((error) => {
                console.log('error = ' + JSON.stringify(error));
                this.showMyToast('Error', '销量前十客户初始化失败', 'Error');
            });
    }
    changelistView() {
        this.isShowSpinner = true;
        changelistView({
            filterNameLwc: this.viewOption,
            accountIdLwc: this.accountId,
            agencyProTypeLwc: this.agencyProType,
            pageSizeLWC: this.pageSize,
            pageTokenLWC: this.currentPageToken,
            sortFieldLWC: this.sortBy,
            sortOrderLWC: this.sortDirection
        })
            .then((r) => {
                r = JSON.parse(JSON.stringify(r));
                console.log('r = ' + JSON.stringify(r));
                if (r.status == 'Success') {
                    //分页
                    this.nextPageToken =
                        r.entity.paginatedAccounts.nextPageToken;
                    this.totalRecords = r.entity.paginatedAccounts.totalRecords;
                    this.recordStart = r.entity.paginatedAccounts.recordStart;
                    this.recordEnd = r.entity.paginatedAccounts.recordEnd;
                    this.totalPages = Math.ceil(
                        r.entity.paginatedAccounts.totalRecords / this.pageSize
                    );
                    console.log('this.totalPages = ' + this.totalPages);
                    this.paginationVisibility =
                        this.totalPages > 1 ? true : false;
                    this.pageRecords = r.entity.pageRecords;
                    console.log(
                        'this.pageRecords = ' + JSON.stringify(this.pageRecords)
                    );
                    for (var i in this.pageRecords) {
                        this.pageRecords[i]['Is_Active__c'] = this.pageRecords[
                            i
                        ].Is_Active__c.replace('効', '效');
                        this.pageRecords[i]['NameUrl'] =
                            '/s/lexconsumableaccount?AccId=' +
                            this.pageRecords[i].Id;
                        this.pageRecords[i]['StateMasterName'] =
                            this.pageRecords[i].State_Master__r.Name;
                        this.pageRecords[i]['StateMasterUrl'] =
                            '/' + this.pageRecords[i].State_Master__c;
                        this.pageRecords[i]['CityMasterName'] =
                            this.pageRecords[i].City_Master__r.Name;
                        this.pageRecords[i]['CityMasterNameUrl'] =
                            '/' + this.pageRecords[i].City_Master__c;
                        this.pageRecords[i]['RecordTypeName'] =
                            this.pageRecords[i].RecordType.Name;
                    }
                    this.isShowSpinner = false;
                } else {
                    this.showMyToast('Error', r.msg, 'Error');
                }
            })
            .catch((error) => {
                console.log('error = ' + JSON.stringify(error.message));
            });
    }
    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);
    }
    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('event.detail.fieldName = ' + event.detail.fieldName)
        this.sortBy = event.detail.fieldName;
        switch (this.sortBy) {
            case 'NameUrl':
                this.sortBy = 'Name';
                break;
            case 'StateMasterName':
                this.sortBy = 'State_Master__r.Name';
                break;
            case 'RecordTypeName':
                this.sortBy = 'RecordType.Name';
                break;
            case 'CityMasterName':
                this.sortBy = 'City_Master__r.Name';
                break;
        }
        this.sortDirection = event.detail.sortDirection;
        this.currentPageToken = 0;
        console.log('this.sortBy = ' + this.sortBy);
        console.log('this.sortDirection = ' + this.sortDirection);
        this.changelistView();
        const { fieldName: sortedBy, sortDirection } = event.detail;
        this.sortByMethod(sortedBy, sortDirection === 'asc' ? 1 : -1);
        this.sortDirection = sortDirection;
        this.sortedBy = sortedBy;
    }
    handlePrevious() {
        this.currentPageToken =
            Number(this.currentPageToken) - Number(this.pageSize);
        this.changelistView();
    }
    handleNext() {
        this.currentPageToken =
            Number(this.currentPageToken) + Number(this.pageSize);
        this.changelistView();
    }
    handleFirst() {
        this.currentPageToken = 0;
        this.changelistView();
    }
    handleLast() {
        this.currentPageToken =
            this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
        this.changelistView();
    }
    handlePageschange(event) {
        console.log(event.detail);
        this.pageSize = event.detail;
        this.currentPageToken = 0;
        this.changelistView();
    }
    get previousButtonDisabled() {
        return this.currentPageToken === 0;
    }
    get nextButtonDisabled() {
        return this.nextPageToken === undefined;
    }
}
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.css
@@ -1,43 +1,43 @@
@import "c/lexCssUtility";
.outerBorderCss {
  border: 1px solid #d4d4d4;
  border-radius: 5px;
  border-top: 3px solid #565959;
@import 'c/lexCssUtility';
.outerBorderCss{
    border: 1px solid #D4D4D4;
    border-radius : 5px;
    border-top : 3px solid #565959;
}
.borderCss {
  border: 1px solid #d4d4d4;
  border-radius: 5px;
  margin-bottom: 7px;
  border-top: 3px solid #565959;
.borderCss{
    border: 1px solid #D4D4D4;
    border-radius : 5px;
    margin-bottom : 7px;
    border-top : 3px solid #565959;
}
.headerDorderCss {
  border-top: 1px solid #565959;
  border-bottom: 1px solid #d4d4d4;
  padding: 3px;
.headerDorderCss{
    border-top: 1px solid #565959;
    border-bottom: 1px solid #D4D4D4;
    padding:3px;
}
.centerCss {
  text-align: center;
.centerCss{
    text-align: center;
}
.centerCss .left {
  margin-left: 100px;
.centerCss .left{
    margin-left: 100px;
}
.datatable {
  max-height: 400px !important;
    max-height: 400px !important;
}
.tableColumn {
  margin-top: 5px !important;
  overflow-x: auto;
    margin-top: 5px !important;
    overflow-x: auto;
}
:host {
  --lwc-inputStaticFontSize: 16px;
  --lwc-formLabelFontSize: 16px;
    --lwc-inputStaticFontSize: 16px;
    --lwc-formLabelFontSize: 16px;
}
.fileUpload {
  font-size: 16px;
  --lwc-formLabelFontSize: 16px;
    font-size: 16px;
    --lwc-formLabelFontSize:16px;
}
.disable-row-selection .slds-is-selected {
  outline: none !important;
}
    outline: none !important;
  }
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.html
@@ -1,1299 +1,901 @@
<!-- 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>
                            <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>
          </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>
        </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>
        <!-- 出库单信息 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
                          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-output-field
                          field-name="SummonsForDirction__c"
                          class="searchName"
                        ></lightning-output-field>
                      </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 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 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
                          class="hideHelpText"
                          field-name="ShipmentAccount__c"
                        ></lightning-output-field>
                      </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>
                                            <button
                                                class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                                                onclick={DeleteConsumable} disabled={isDeleteDisabled}>删除</button>
                                        </template>
                                    </td>
                                    <td></td>
                                </tr>
                            </table>
                        </div>
                      </lightning-layout-item>
                    </div>
                </div>
                      <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>
                <!-- 出库单信息 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="1"></lightning-layout-item>
                    </lightning-layout>
                                                <lightning-layout-item size="5">
                                                    <lightning-output-field field-name="Name"
                                                        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 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">
                        <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>
                      <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>
                                            </template>
                                        </lightning-layout>
                    <!-- 没有确定价格 -->
                    <lightning-layout multiple-rows="true">
                      <lightning-layout-item size="1"></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-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>
                                            <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 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 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 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 class="hideHelpText"
                                                    field-name="ShipmentAccount__c"></lightning-output-field>
                                            </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>
                </template>
              </div>
            </div>
          </div>
        </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>
            </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>
                <!-- 出库单信息 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 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
                        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 size="1"></lightning-layout-item>
                    </template>
                  </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 size="5">
                      <lightning-output-field
                        field-name="SummonsForDirction__c"
                        class="hehe-layoutItem"
                      ></lightning-output-field>
                    </lightning-layout-item>
                                            <lightning-layout-item size="1"></lightning-layout-item>
                                        </template>
                                    </lightning-layout>
                    <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 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>
                  <!-- 二级经销商 -->
                  <template if:true={isSummonsForDirctionTwoShow}>
                    <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="5">
                        <lightning-output-field
                          field-name="Order_Dealer_Info__c"
                          class="hehe-layoutItem"
                        ></lightning-output-field>
                      </lightning-layout-item>
                    </lightning-layout>
                  </template>
                                        <lightning-layout-item size="1"></lightning-layout-item>
                  <!-- 客户名 发票-->
                  <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>
                                    </lightning-layout>
                    <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>
                                    <!-- 二级经销商 -->
                                    <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>
                                            <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 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" class="hehe-layoutItem">
                                            <lightning-output-field class="hideHelpText"
                                                field-name="ShipmentAccount__c"></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>
                                        <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-item size="1"></lightning-layout-item>
                  <!-- 没有确定价格 -->
                  <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>
                                    </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>
                                    <!-- 科室 出库金额 -->
                                    <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>
                </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>
                                    </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>
                                <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>
                                <!-- <p>{item.updateDate} · {item.ownerName}</p> -->
                              </lightning-layout-item>
                            </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>
                          </lightning-layout>
                        </lightning-card>
                      </lightning-layout-item>
                    </lightning-layout>
                  </template>
                </lightning-record-edit-form>
              </div>
            </div>
          </div>
        </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: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>
                  </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}>
                            <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>
                <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>
                        <template if:true={isEditShowSpinner}>
                            <lightning-spinner alternative-text="Uploading now"></lightning-spinner>
                        </template>
                    </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>
                <!-- 出库产品明细 -->
                <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>
                        <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 style="padding: 7px">
                            <lightning-datatable key-field="id" data={consumableorderdetails2Records}
                                columns={consumableorderdetails2RecordsColumns} hide-checkbox-column
                                class="wrapped-header-datatable">
                            </lightning-datatable>
                        </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}>
                <!-- 上传附件 -->
                <!-- <template if:false={EditAble}>
                    <div class="borderCss">
                        <div class="headerDorderCss">
                            <lightning-layout>
@@ -1329,319 +931,236 @@
                        </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}
                                            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>
              <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
                                                            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
                                                            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>
                <template if:true={isBarcode}>
                  <div class="borderCss">
            <!-- 出货/销售 -->
            <template if:true={isShippingSales}>
                <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>
                            <lightning-layout-item padding="around-small">
                              <!-- <lightning-textarea name="Barcode" label="BarCode号"
                                <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>
                            <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
                                                            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
                                                            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>
                                <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"
                      >
                      </c-lex-custom-lightning-datatable>
                    </div>
                  </div>
                </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>
                <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>
                                <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>
                                <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>
  </div>
</template>
</template>
force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js
Diff too large
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html
@@ -1,292 +1,292 @@
<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>
  <div style="border: 1px solid #d4d4d4; border-radius: 5px">
    <div
      style="
        border-top: 3px solid #51606e;
        border-bottom: 1px solid #d4d4d4;
        padding: 3px;
      "
    >
      <!-- <p style="font-size: 18px;"><strong>库存管理</strong></p> -->
      <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: 10px">
      <div
        style="
          border: 1px solid #d4d4d4;
          border-radius: 5px;
          margin-bottom: 7px;
        "
      >
    <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>
    <div style="border: 1px solid #d4d4d4; border-radius: 5px">
        <div
          style="
            border-top: 3px solid #51606e;
            border-bottom: 1px solid #d4d4d4;
            padding: 10px;
          "
            style="
                border-top: 3px solid #51606e;
                border-bottom: 1px solid #d4d4d4;
                padding: 3px;
            "
        >
          <!-- <lightning-button variant="brand" class = 'lexstyle' style="margin:12px;" label="库存盘点" title="库存盘点"
            <!-- <p style="font-size: 18px;"><strong>库存管理</strong></p> -->
            <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: 10px">
            <div
                style="
                    border: 1px solid #d4d4d4;
                    border-radius: 5px;
                    margin-bottom: 7px;
                "
            >
                <div
                    style="
                        border-top: 3px solid #51606e;
                        border-bottom: 1px solid #d4d4d4;
                        padding: 10px;
                    "
                >
                    <!-- <lightning-button variant="brand" class = 'lexstyle' style="margin:12px;" label="库存盘点" title="库存盘点"
                        onclick={inventoryCount}></lightning-button>
                    <lightning-button variant="brand" class = 'lexstyle' style="margin: 12px;" label="过期库存销存" title="过期库存销存"
                        onclick={handleExpired}></lightning-button>
                    <lightning-button variant="brand" class = 'lexstyle' style="margin: 12px;" label="拆盒" title="拆盒" onclick={removeBox}></lightning-button>
                    <lightning-button variant="brand" class = 'lexstyle' style="margin: 12px;" label="取消拆盒" title="取消拆盒"
                        onclick={cancelremoveBox}></lightning-button> -->
          <button
            style="margin-left: 5px"
            class="slds-button slds-button_neutral slds-button_stretch lexBorder"
            label="库存盘点"
            onclick={inventoryCount}
          >
            库存盘点
          </button>
          <button
            class="slds-button slds-button_neutral slds-button_stretch lexButtoun"
            label="过期库存销存"
            style="margin-left: 60px"
            onclick={handleExpired}
          >
            过期库存销存
          </button>
          <button
            class="slds-button slds-button_neutral slds-button_stretch lexButtoun"
            label="拆盒"
            style="margin-left: 60px"
            onclick={removeBox}
          >
            拆盒
          </button>
          <button
            class="slds-button slds-button_neutral slds-button_stretch lexButtoun"
            label="取消拆盒"
            style="margin-left: 60px"
            onclick={cancelremoveBox}
          >
            取消拆盒
          </button>
        </div>
      </div>
                    <button
                        style="margin-left: 5px"
                        class="slds-button slds-button_neutral slds-button_stretch lexBorder"
                        label="库存盘点"
                        onclick={inventoryCount}
                    >
                        库存盘点
                    </button>
                    <button
                        class="slds-button slds-button_neutral slds-button_stretch lexButtoun"
                        label="过期库存销存"
                        style="margin-left: 60px"
                        onclick={handleExpired}
                    >
                        过期库存销存
                    </button>
                    <button
                        class="slds-button slds-button_neutral slds-button_stretch lexButtoun"
                        label="拆盒"
                        style="margin-left: 60px"
                        onclick={removeBox}
                    >
                        拆盒
                    </button>
                    <button
                        class="slds-button slds-button_neutral slds-button_stretch lexButtoun"
                        label="取消拆盒"
                        style="margin-left: 60px"
                        onclick={cancelremoveBox}
                    >
                        取消拆盒
                    </button>
                </div>
            </div>
      <div
        style="
          border: 1px solid #d4d4d4;
          border-radius: 5px;
          margin-bottom: 7px;
          margin-top: 30px;
        "
      >
        <div
          style="
            border-top: 3px solid #51606e;
            border-bottom: 1px solid #d4d4d4;
            padding: 3px;
            height: 115px;
          "
        >
          <table style="margin-top: 10px">
            <colgroup>
              <col width="160px" />
              <col width="100px" />
              <col width="10px" />
              <col width="70px" />
              <col width="100px" />
              <col width="10px" />
              <col width="70px" />
              <col width="100px" />
              <col width="10px" />
              <col width="90px" />
              <col width="100px" />
              <col width="85px" />
              <col width="100px" />
              <col width="10px" />
              <col width="70px" />
              <col width="100px" />
            </colgroup>
            <tbody>
              <tr>
                <td style="width: 10px"></td>
                <td style="width: 250px">
                  <div
                    style="width: 90px; margin-left: 12px"
                    class="searchName"
                  >
                    消耗品名称
                  </div>
                </td>
                <td style="width: 21%">
                  <lightning-input
                    class="searchName"
                    type="text"
                    name="Name"
                    label="消耗品名称"
                    value={Name}
                    variant="label-hidden"
                    onchange={dataChange}
                    data-field="Name"
                  ></lightning-input>
                </td>
                <td style="width: 150px">
                  <div
                    style="width: 90px; text-align: center"
                    class="searchName"
                  >
                    第3分类
                  </div>
                </td>
                <td style="width: 21%">
                  <lightning-combobox
                    class="inputFont"
                    style="margin-left: 5px"
                    name="CategoryThree"
                    label="第3分类"
                    value={value}
                    placeholder="请选择..."
                    options={category3Options}
                    variant="label-hidden"
                    data-field="CategoryThree"
                    onchange={dataChange}
                  ></lightning-combobox>
                </td>
                <td style="width: 150px">
                  <div
                    style="width: 90px; text-align: center"
                    class="searchName"
                  >
                    第4分类
                  </div>
                </td>
                <td style="width: 21%">
                  <lightning-combobox
                    class="inputFont"
                    name="CategoryFour"
                    label="第4分类"
                    value={value}
                    placeholder="请选择..."
                    options={category4Options}
                    variant="label-hidden"
                    data-field="CategoryFour"
                    onchange={dataChange}
                  ></lightning-combobox>
                </td>
                <td style="width: 150px">
                  <div
                    style="width: 90px; text-align: center"
                    class="searchName"
                  >
                    第5分类
                  </div>
                </td>
                <td style="width: 21%">
                  <lightning-combobox
                    class="inputFont"
                    name="CategoryFive"
                    label="第5分类"
                    value={value}
                    placeholder="请选择..."
                    options={category5Options}
                    variant="label-hidden"
                    data-field="CategoryFive"
                    onchange={dataChange}
                  ></lightning-combobox>
                </td>
                <td style="width: 1%"></td>
              </tr>
            </tbody>
          </table>
          <br />
          <div style="float: right; margin-right: 10px">
            <button
              class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
              label="消耗品搜索"
              onclick={searchOrderDetail}
            <div
                style="
                    border: 1px solid #d4d4d4;
                    border-radius: 5px;
                    margin-bottom: 7px;
                    margin-top: 30px;
                "
            >
              消耗品搜索
            </button>
            <button
              style="margin-left: 10px"
              class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
              label="清空"
              onclick={clearAll}
                <div
                    style="
                        border-top: 3px solid #51606e;
                        border-bottom: 1px solid #d4d4d4;
                        padding: 3px;
                        height: 115px;
                    "
                >
                    <table style="margin-top: 10px">
                        <colgroup>
                            <col width="160px" />
                            <col width="100px" />
                            <col width="10px" />
                            <col width="70px" />
                            <col width="100px" />
                            <col width="10px" />
                            <col width="70px" />
                            <col width="100px" />
                            <col width="10px" />
                            <col width="90px" />
                            <col width="100px" />
                            <col width="85px" />
                            <col width="100px" />
                            <col width="10px" />
                            <col width="70px" />
                            <col width="100px" />
                        </colgroup>
                        <tbody>
                            <tr>
                                <td style="width: 10px"></td>
                                <td style="width: 250px">
                                    <div
                                        style="width: 90px; margin-left: 12px"
                                        class="searchName"
                                    >
                                        消耗品名称
                                    </div>
                                </td>
                                <td style="width: 21%">
                                    <lightning-input
                                        class="searchName"
                                        type="text"
                                        name="Name"
                                        label="消耗品名称"
                                        value={Name}
                                        variant="label-hidden"
                                        onchange={dataChange}
                                        data-field="Name"
                                    ></lightning-input>
                                </td>
                                <td style="width: 150px">
                                    <div
                                        style="width: 90px; text-align: center"
                                        class="searchName"
                                    >
                                        第3分类
                                    </div>
                                </td>
                                <td style="width: 21%">
                                    <lightning-combobox
                                        class="inputFont"
                                        style="margin-left: 5px"
                                        name="CategoryThree"
                                        label="第3分类"
                                        value={value}
                                        placeholder="请选择..."
                                        options={category3Options}
                                        variant="label-hidden"
                                        data-field="CategoryThree"
                                        onchange={dataChange}
                                    ></lightning-combobox>
                                </td>
                                <td style="width: 150px">
                                    <div
                                        style="width: 90px; text-align: center"
                                        class="searchName"
                                    >
                                        第4分类
                                    </div>
                                </td>
                                <td style="width: 21%">
                                    <lightning-combobox
                                        class="inputFont"
                                        name="CategoryFour"
                                        label="第4分类"
                                        value={value}
                                        placeholder="请选择..."
                                        options={category4Options}
                                        variant="label-hidden"
                                        data-field="CategoryFour"
                                        onchange={dataChange}
                                    ></lightning-combobox>
                                </td>
                                <td style="width: 150px">
                                    <div
                                        style="width: 90px; text-align: center"
                                        class="searchName"
                                    >
                                        第5分类
                                    </div>
                                </td>
                                <td style="width: 21%">
                                    <lightning-combobox
                                        class="inputFont"
                                        name="CategoryFive"
                                        label="第5分类"
                                        value={value}
                                        placeholder="请选择..."
                                        options={category5Options}
                                        variant="label-hidden"
                                        data-field="CategoryFive"
                                        onchange={dataChange}
                                    ></lightning-combobox>
                                </td>
                                <td style="width: 1%"></td>
                            </tr>
                        </tbody>
                    </table>
                    <br />
                    <div style="float: right; margin-right: 10px">
                        <button
                            class="slds-button slds-button_neutral slds-button_stretch lexsearchStyle"
                            label="消耗品搜索"
                            onclick={searchOrderDetail}
                        >
                            消耗品搜索
                        </button>
                        <button
                            style="margin-left: 10px"
                            class="slds-button slds-button_neutral slds-button_stretch lexclearStyle"
                            label="清空"
                            onclick={clearAll}
                        >
                            清空
                        </button>
                    </div>
                </div>
            </div>
            <div
                style="
                    border: 1px solid #d4d4d4;
                    border-radius: 5px;
                    margin-bottom: 7px;
                "
            >
              清空
            </button>
          </div>
                <div
                    style="
                        border-top: 3px solid #51606e;
                        border-bottom: 1px solid #d4d4d4;
                        padding: 3px;
                    "
                >
                    <!-- <p style="font-size: 16px;"><strong>库存详情</strong></p> -->
                    <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: 10px">
                    <template if:true={showTable}>
                        <c-lex-custom-lightning-datatable
                            key-field="id"
                            data={data}
                            columns={columns}
                            default-sort-direction={defaultSortDirection}
                            sorted-direction={sortDirection}
                            sorted-by={sortedBy}
                            onsort={onHandleSort}
                            hide-checkbox-column={hidecheckboxcolumn}
                            style="word-wrap:break-word; word-break:break-all;"
                            class="wrapped-header-datatable"
                        >
                        </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>
                </div>
            </div>
        </div>
      </div>
      <div
        style="
          border: 1px solid #d4d4d4;
          border-radius: 5px;
          margin-bottom: 7px;
        "
      >
        <div
          style="
            border-top: 3px solid #51606e;
            border-bottom: 1px solid #d4d4d4;
            padding: 3px;
          "
        >
          <!-- <p style="font-size: 16px;"><strong>库存详情</strong></p> -->
          <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: 10px">
          <template if:true={showTable}>
            <c-lex-custom-lightning-datatable
              key-field="id"
              data={data}
              columns={columns}
              default-sort-direction={defaultSortDirection}
              sorted-direction={sortDirection}
              sorted-by={sortedBy}
              onsort={onHandleSort}
              hide-checkbox-column={hidecheckboxcolumn}
              style="word-wrap: break-word; word-break: break-all"
              class="wrapped-header-datatable"
            >
            </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>
        </div>
      </div>
    </div>
  </div>
</template>
</template>
force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js
@@ -1,682 +1,726 @@
import { LightningElement, wire, api, track } from "lwc";
import oninit from "@salesforce/apex/LexInventoryViewController.init";
import { ShowToastEvent } from "lightning/platformShowToastEvent";
import searchOrder from "@salesforce/apex/LexInventoryViewController.searchConsumableorderdetails";
import categoryAllload from "@salesforce/apex/LexInventoryViewController.categoryAllload";
import { NavigationMixin } from "lightning/navigation";
import { LightningElement, wire, api, track } from 'lwc';
import oninit from '@salesforce/apex/LexInventoryViewController.init';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import searchOrder from '@salesforce/apex/LexInventoryViewController.searchConsumableorderdetails';
import categoryAllload from '@salesforce/apex/LexInventoryViewController.categoryAllload';
import { NavigationMixin } from 'lightning/navigation';
//table css
import { loadStyle } from "lightning/platformResourceLoader";
import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
import { loadStyle } from 'lightning/platformResourceLoader';
import WrappedHeaderTable from '@salesforce/resourceUrl/lexdatatable';
export default class LexinventoryViewLWC extends NavigationMixin(
  LightningElement
    LightningElement
) {
  //分页start
  @track sortBy = "";
  //@track sortDirection = "asc";
  @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 sortDirection = "asc";
    @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 data = [];
  @track message = "";
  @track Name;
  @track CategoryThree;
    @track data = [];
    @track message = '';
    @track Name;
    @track CategoryThree;
  @track category3Options = [];
  @track CategoryFour;
  @track category4Options = [];
  @track CategoryFive;
  @track category5Options = [];
  @track orderDetZaikuList = [];
  @track accountName;
  @track agencyProType;
  @track userWorkLocation;
  @track value = "";
  @track showTable = false;
  @track hidecheckboxcolumn = true;
  @track check = false;
  @track productkucun;
  //加载
  @track showSpinner = false;
  @track showSpinners = false;
  //医院特价
  @track hasHos = false;
  //表头样式
  stylesLoaded = false;
    @track category3Options = [];
    @track CategoryFour;
    @track category4Options = [];
    @track CategoryFive;
    @track category5Options = [];
    @track orderDetZaikuList = [];
    @track accountName;
    @track agencyProType;
    @track userWorkLocation;
    @track value = '';
    @track showTable = false;
    @track hidecheckboxcolumn = true;
    @track check = false;
    @track productkucun;
    //加载
    @track showSpinner = false;
    @track showSpinners = false;
    //医院特价
    @track hasHos = false;
    //表头样式
    stylesLoaded = false;
  @track columns = [
    {
      label: "消耗品名称",
      fieldName: "Name__c",
      type: "Name",
      sortable: true,
      hideDefaultActions: true,
      // initialWidth: 200,
      wrapText: true,
      cellAttributes: { alignment: "left" }
    },
    {
      label: "第三分类",
      fieldName: "Category3__c",
      initialWidth: 102,
      cellAttributes: { alignment: "left" },
      hideDefaultActions: true,
      sortable: true,
      wrapText: true
    },
    {
      label: "第四分类",
      fieldName: "Category4__c",
      cellAttributes: { alignment: "left" },
      initialWidth: 102,
      hideDefaultActions: true,
      wrapText: true,
      sortable: true
    },
    {
      label: "第五分类",
      fieldName: "Category5__c",
      cellAttributes: { alignment: "left" },
      initialWidth: 102,
      hideDefaultActions: true,
      wrapText: true,
      sortable: true
    },
    @track columns = [
        {
            label: '消耗品名称',
            fieldName: 'Name__c',
            type: 'Name',
            sortable: true,
            hideDefaultActions: true,
            // initialWidth: 200,
            wrapText: true,
            cellAttributes: { alignment: 'left' }
        },
        {
            label: '第三分类',
            fieldName: 'Category3__c',
            initialWidth: 102,
            cellAttributes: { alignment: 'left' },
            hideDefaultActions: true,
            sortable: true,
            wrapText: true
        },
        {
            label: '第四分类',
            fieldName: 'Category4__c',
            cellAttributes: { alignment: 'left' },
            initialWidth: 102,
            hideDefaultActions: true,
            wrapText: true,
            sortable: true
        },
        {
            label: '第五分类',
            fieldName: 'Category5__c',
            cellAttributes: { alignment: 'left' },
            initialWidth: 102,
            hideDefaultActions: true,
            wrapText: true,
            sortable: true
        },
    {
      label: "规格",
      fieldName: "packing_list",
      cellAttributes: { alignment: "right" },
      initialWidth: 50,
      wrapText: true,
      hideDefaultActions: true
    },
    {
      label: "单位",
      fieldName: "BoxPiece",
      cellAttributes: { alignment: "left" },
      initialWidth: 50,
      wrapText: true,
      hideDefaultActions: true
    },
    {
      label: "注册证编码号",
      fieldName: "approbation_No",
      cellAttributes: { alignment: "left" },
      wrapText: true,
      initialWidth: 104,
      hideDefaultActions: true
    },
    {
      label: "注册有效期",
      fieldName: "expiration_Date",
      cellAttributes: { alignment: "left" },
      wrapText: true,
      hideDefaultActions: true,
      initialWidth: 95
    },
    {
      label: "CFDA状态",
      fieldName: "SFDA_Status__c",
      cellAttributes: { alignment: "left" },
      initialWidth: 84,
      wrapText: true,
      hideDefaultActions: true
    },
    {
      label: "使用期限",
      fieldName: "guaranteeperiod",
      cellAttributes: { alignment: "left" },
      hideDefaultActions: true,
      initialWidth: 95
    },
    {
      label: "有效期内库存",
      type: "customInventoryColor",
      fieldName: "limitCount",
      sortable: true,
      cellAttributes: { alignment: "right" },
      typeAttributes: {
        value: { fieldName: "limitCount" },
        upperlimit: { fieldName: "upperlimit" },
        lowerlimit: { fieldName: "lowerlimit" },
        boxPrice: { fieldName: "BoxPiece" }
      },
      hideDefaultActions: true,
      initialWidth: 110
    },
        {
            label: '规格',
            fieldName: 'packing_list',
            cellAttributes: { alignment: 'right' },
            initialWidth: 50,
            wrapText: true,
            hideDefaultActions: true
        },
        {
            label: '单位',
            fieldName: 'BoxPiece',
            cellAttributes: { alignment: 'left' },
            initialWidth: 50,
            wrapText: true,
            hideDefaultActions: true
        },
        {
            label: '注册证编码号',
            fieldName: 'approbation_No',
            cellAttributes: { alignment: 'left' },
            wrapText: true,
            initialWidth: 104,
            hideDefaultActions: true
        },
        {
            label: '注册有效期',
            fieldName: 'expiration_Date',
            cellAttributes: { alignment: 'left' },
            wrapText: true,
            hideDefaultActions: true,
            initialWidth: 95
        },
        {
            label: 'CFDA状态',
            fieldName: 'SFDA_Status__c',
            cellAttributes: { alignment: 'left' },
            initialWidth: 84,
            wrapText: true,
            hideDefaultActions: true
        },
        {
            label: '使用期限',
            fieldName: 'guaranteeperiod',
            cellAttributes: { alignment: 'left' },
            hideDefaultActions: true,
            initialWidth: 95
        },
        {
            label: '有效期内库存',
            type: 'customInventoryColor',
            fieldName: 'limitCount',
            sortable: true,
            cellAttributes: { alignment: 'right' },
            typeAttributes: {
                value: { fieldName: 'limitCount' },
                upperlimit: { fieldName: 'upperlimit' },
                lowerlimit: { fieldName: 'lowerlimit' },
                boxPrice: { fieldName: 'BoxPiece' }
            },
            hideDefaultActions: true,
            initialWidth: 110
        },
    {
      label: "过期库存",
      fieldName: "overlimitCount",
      hideDefaultActions: true,
      cellAttributes: { alignment: "right" },
      initialWidth: 78
        {
            label: '过期库存',
            fieldName: 'overlimitCount',
            hideDefaultActions: true,
            cellAttributes: { alignment: 'right' },
            initialWidth: 78
        }
    ];
    defaultSortDirection = 'asc';
    sortDirection = 'asc';
    sortedBy;
    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');
                });
        }
    }
  ];
  defaultSortDirection = "asc";
  sortDirection = "asc";
  sortedBy;
  renderedCallback() {
    if (!this.stylesLoaded) {
      Promise.all([loadStyle(this, WrappedHeaderTable)])
        .then(() => {
          console.log("Custom styles loaded");
          this.stylesLoaded = true;
    connectedCallback() {
        this.loader = true;
        this.init();
    }
    init() {
        this.showSpinner = true;
        oninit({
            pageSizeLWC: this.pageSize,
            pageTokenLWC: this.currentPageToken,
            sortFieldLWC: this.sortBy,
            sortOrderLWC: this.sortDirection
        })
        .catch((error) => {
          console.error("Error loading custom styles");
            .then((result) => {
                result = JSON.parse(JSON.stringify(result));
                console.log(
                    'result.pageRecords = ' +
                        JSON.stringify(result.entity.pageRecords)
                );
                console.log(
                    'result.consumableorderdetailsRecords = ' +
                        JSON.stringify(
                            result.entity.consumableorderdetailsRecords
                        )
                );
                console.log('result.status = ' + result.status);
                console.log('result = ' + JSON.stringify(result));
                console.log('result 1= ' + JSON.stringify(result.entity));
                console.log(
                    'result 2= ' + JSON.stringify(result.entity.pageRecords)
                );
                if (result.status == 'Success') {
                    console.log(
                        'result.entity.paginatedAccounts = ' +
                            JSON.stringify(result.entity.paginatedAccounts)
                    );
                    this.nextPageToken =
                        result.entity.paginatedAccounts.nextPageToken;
                    this.totalRecords =
                        result.entity.paginatedAccounts.totalRecords;
                    this.recordStart =
                        result.entity.paginatedAccounts.recordStart;
                    this.recordEnd = result.entity.paginatedAccounts.recordEnd;
                    this.totalPages = Math.ceil(
                        result.entity.paginatedAccounts.totalRecords /
                            this.pageSize
                    );
                    console.log('this.totalPages = ' + this.totalPages);
                    this.paginationVisibility =
                        this.totalPages > 1 ? true : false;
                    this.loader = false;
                    this.data = result.entity.pageRecords;
                    this.productkucun = result.entity.productkucun;
                    for (var i in this.data) {
                        this.data[i]['Name__c'] = this.data[i].Prod.Name__c;
                        this.data[i]['Category3__c'] =
                            this.data[i].Prod.Category3__c;
                        this.data[i]['Category4__c'] =
                            this.data[i].Prod.Category4__c;
                        this.data[i]['Category5__c'] =
                            this.data[i].Prod.Category5__c;
                        this.data[i]['SFDA_Status__c'] =
                            this.data[i].Prod.SFDA_Status__c;
                    }
                    this.showTable = true;
                    this.orderDetZaikuList = result.entity.orderDetZaikuList;
                    this.accountName = result.entity.accountName;
                    this.agencyProType = result.entity.agencyProType;
                    this.userWorkLocation = result.entity.userWorkLocation;
                    let option1ValueTemp = [];
                    for (var key in result.entity.categoryOptionMap) {
                        let object = {};
                        object['label'] = result.entity.categoryOptionMap[key];
                        object['value'] = key;
                        option1ValueTemp.push(object);
                    }
                    this.category3Options = option1ValueTemp;
                    console.log(
                        ' this.optionscatone===>' +
                            JSON.stringify(this.optionscatone)
                    );
                    let option2ValueTemp = [];
                    for (var key in result.entity.category4OptionMap) {
                        let object = {};
                        object['label'] = result.entity.category4OptionMap[key];
                        object['value'] = key;
                        option2ValueTemp.push(object);
                    }
                    this.category4Options = option2ValueTemp;
                    let option3ValueTemp = [];
                    for (var key in result.entity.category5OptionMap) {
                        let object = {};
                        object['label'] = result.entity.category5OptionMap[key];
                        object['value'] = key;
                        option3ValueTemp.push(object);
                    }
                    this.category5Options = option3ValueTemp;
                    this.hasHos = result.entity.hasHos;
                    console.log('this.hasHos' + this.hasHos);
                    //颜色标记
                    //hasHos = true 医院特价
                    if (this.hasHos) {
                        let object1 = {
                            label: '医院特价',
                            fieldName: 'hospitalSpecialOffer__c',
                            hideDefaultActions: true,
                            type: 'boolean',
                            cellAttributes: { alignment: 'left' },
                            initialWidth: 80
                        };
                        this.columns.push(object1);
                        console.log(' this.columns' + this.columns);
                        for (var j in this.data) {
                            this.data[j]['Name__c'] = this.data[j].Prod.Name__c;
                            this.data[j]['Category3__c'] =
                                this.data[j].Prod.Category3__c;
                            this.data[j]['Category4__c'] =
                                this.data[j].Prod.Category4__c;
                            this.data[j]['Category5__c'] =
                                this.data[j].Prod.Category5__c;
                            this.data[j]['SFDA_Status__c'] =
                                this.data[j].Prod.SFDA_Status__c;
                            this.data[j]['hospitalSpecialOffer__c'] =
                                this.data[j].hospitalSpecialOffer;
                            console.log(
                                'this.data[j].hospitalSpecialOffer__c' +
                                    this.data[j].hospitalSpecialOffer
                            );
                        }
                    }
                    this.showSpinner = false;
                } else {
                    // this.showToast("Error",'Error', result.msg);
                    this.showMyToast('初始化失败', result.msg, 'error');
                }
            })
            .catch((error) => {
                this.loader = false;
                this.showSpinner = false;
                console.log('error = ' + JSON.stringify(error));
            });
    }
    handleChange(event) {
        let fieldName = event.target.getAttribute('data-field');
        let value = event.detail.value;
        console.log('======>fieldName' + fieldName);
        console.log('======>value' + value);
        switch (fieldName) {
            case 'Name':
                this.Name = value;
                break;
            case 'CategoryThree':
                this.CategoryThree = value;
                break;
            case 'CategoryFour':
                this.CategoryFour = value;
                break;
            case 'CategoryFive':
                this.CategoryFive = value;
                break;
            default:
                console.log('no data');
        }
    }
    dataChange(event) {
        let fieldName = event.target.getAttribute('data-field');
        let value = event.detail.value;
        console.log('fieldName = ' + fieldName + ' value = ' + value);
        switch (fieldName) {
            case 'Name':
                this.Name = value;
                break;
            case 'CategoryThree':
                this.CategoryThree = value;
                //调用后台显示第四五分类
                this.showAllCate();
                if (this.CategoryThree == '') {
                    this.CategoryFour = '';
                    this.CategoryFive = '';
                }
                break;
            case 'CategoryFour':
                this.CategoryFour = value;
                //调用后台显示第五分类
                this.showCate();
                if (this.CategoryFour == '') {
                    this.CategoryFive = '';
                }
                break;
            case 'CategoryFive':
                this.CategoryFive = value;
                break;
        }
    }
    showAllCate() {
        categoryAllload({
            category3LWC: this.CategoryThree,
            agencyProTypeLWC: this.agencyProType
        })
            .then((result) => {
                result = JSON.parse(JSON.stringify(result));
                console.log('result = ' + JSON.stringify(result));
                if (result.status == 'Success') {
                    this.category4Options = [];
                    this.category5Options = [];
                    //第4分类
                    for (var key in result.entity.category4OptionMap) {
                        let object = {};
                        object['label'] = result.entity.category4OptionMap[key];
                        object['value'] = key;
                        this.category4Options.push(object);
                    }
                    console.log(
                        'this.category4Options = ' +
                            JSON.stringify(this.category4Options)
                    );
                    //第5分类
                    for (var key in result.entity.category5OptionMap) {
                        let object = {};
                        object['label'] = result.entity.category5OptionMap[key];
                        object['value'] = key;
                        this.category5Options.push(object);
                    }
                } else {
                    console.log('result = ' + JSON.stringify(result));
                    this.showMyToast(result.msg, '', 'error');
                }
            })
            .catch((error) => {
                console.log('error' + JSON.stringify(error));
            });
    }
    searchOrderDetail() {
        this.showTable = false;
        this.showSpinner = true;
        searchOrder({
            category1: this.Name,
            Category3: this.CategoryThree,
            Category4: this.CategoryFour,
            Category5: this.CategoryFive,
            orderDetZaikuListLWC: JSON.stringify(this.orderDetZaikuList),
            accountName: this.accountName,
            agencyProType: this.agencyProType,
            userWorkLocation: this.userWorkLocation,
            pageSizeLWC: this.pageSize,
            pageTokenLWC: this.currentPageToken,
            productkucunLWC: this.productkucun
            // sortFieldLWC: this.sortBy,
            // sortOrderLWC: this.sortDirection
        })
            .then((result) => {
                result = JSON.parse(JSON.stringify(result));
                if (result.status == 'Success') {
                    this.nextPageToken =
                        result.entity.paginatedAccounts.nextPageToken;
                    this.totalRecords =
                        result.entity.paginatedAccounts.totalRecords;
                    this.recordStart =
                        result.entity.paginatedAccounts.recordStart;
                    this.recordEnd = result.entity.paginatedAccounts.recordEnd;
                    this.totalPages = Math.ceil(
                        result.entity.paginatedAccounts.totalRecords /
                            this.pageSize
                    );
                    console.log(
                        'result.entity.paginatedAccounts = ' +
                            JSON.stringify(result.entity.paginatedAccounts)
                    );
                    console.log('this.totalPages = ' + this.totalPages);
                    this.paginationVisibility =
                        this.totalPages > 1 ? true : false;
                    console.log('this.sortDirection = ' + this.sortDirection);
                    // this.showToast("Success",'搜索成功', result.msg);
                    // this.showMyToast('搜索成功',result.msg,'success');
                    this.data = result.entity.pageRecords;
                    console.log('搜索Data==>' + JSON.stringify(this.data));
                    for (var i in this.data) {
                        this.data[i]['Name__c'] = this.data[i].Prod.Name__c;
                        this.data[i]['Category3__c'] =
                            this.data[i].Prod.Category3__c;
                        this.data[i]['Category4__c'] =
                            this.data[i].Prod.Category4__c;
                        this.data[i]['Category5__c'] =
                            this.data[i].Prod.Category5__c;
                        this.data[i]['SFDA_Status__c'] =
                            this.data[i].Prod.SFDA_Status__c;
                        this.data[i]['hospitalSpecialOffer__c'] =
                            this.data[i].hospitalSpecialOffer;
                        this.data[i]['guaranteeperiod'] =
                            this.data[i].guaranteeperiod;
                    }
                    this.data = [...this.data];
                    console.log('this.data = ' + JSON.stringify(this.data));
                    this.showTable = true;
                    this.showSpinner = false;
                } else {
                    this.nextPageToken = this.pageSize;
                    this.totalRecords = 0;
                    this.recordStart = 0;
                    this.recordEnd = 0;
                    this.totalPages = 0;
                    // this.showToast("Error",'Error', result.msg);
                    // this.showMyToast('搜索失败',result.msg,'error');
                    this.showSpinner = false;
                }
            })
            .catch((error) => {
                console.log('error = ' + JSON.stringify(error));
                this.showSpinner = false;
            });
    }
    inventoryCount() {
        this[NavigationMixin.Navigate]({
            type: 'standard__webPage',
            attributes: {
                url: '/lexinventory'
            }
        });
    }
  }
  connectedCallback() {
    this.loader = true;
    this.init();
  }
  init() {
    this.showSpinner = true;
    oninit({
      pageSizeLWC: this.pageSize,
      pageTokenLWC: this.currentPageToken,
      sortFieldLWC: this.sortBy,
      sortOrderLWC: this.sortDirection
    })
      .then((result) => {
        result = JSON.parse(JSON.stringify(result));
        console.log(
          "result.pageRecords = " + JSON.stringify(result.entity.pageRecords)
        );
        console.log(
          "result.consumableorderdetailsRecords = " +
            JSON.stringify(result.entity.consumableorderdetailsRecords)
        );
        console.log("result.status = " + result.status);
        console.log("result = " + JSON.stringify(result));
        console.log("result 1= " + JSON.stringify(result.entity));
        console.log("result 2= " + JSON.stringify(result.entity.pageRecords));
        if (result.status == "Success") {
          console.log(
            "result.entity.paginatedAccounts = " +
              JSON.stringify(result.entity.paginatedAccounts)
          );
          this.nextPageToken = result.entity.paginatedAccounts.nextPageToken;
          this.totalRecords = result.entity.paginatedAccounts.totalRecords;
          this.recordStart = result.entity.paginatedAccounts.recordStart;
          this.recordEnd = result.entity.paginatedAccounts.recordEnd;
          this.totalPages = Math.ceil(
            result.entity.paginatedAccounts.totalRecords / this.pageSize
          );
          console.log("this.totalPages = " + this.totalPages);
          this.paginationVisibility = this.totalPages > 1 ? true : false;
          this.loader = false;
          this.data = result.entity.pageRecords;
          this.productkucun = result.entity.productkucun;
          for (var i in this.data) {
            this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
            this.data[i]["Category3__c"] = this.data[i].Prod.Category3__c;
            this.data[i]["Category4__c"] = this.data[i].Prod.Category4__c;
            this.data[i]["Category5__c"] = this.data[i].Prod.Category5__c;
            this.data[i]["SFDA_Status__c"] = this.data[i].Prod.SFDA_Status__c;
          }
          this.showTable = true;
          this.orderDetZaikuList = result.entity.orderDetZaikuList;
          this.accountName = result.entity.accountName;
          this.agencyProType = result.entity.agencyProType;
          this.userWorkLocation = result.entity.userWorkLocation;
          let option1ValueTemp = [];
          for (var key in result.entity.categoryOptionMap) {
            let object = {};
            object["label"] = result.entity.categoryOptionMap[key];
            object["value"] = key;
            option1ValueTemp.push(object);
          }
          this.category3Options = option1ValueTemp;
          console.log(
            " this.optionscatone===>" + JSON.stringify(this.optionscatone)
          );
          let option2ValueTemp = [];
          for (var key in result.entity.category4OptionMap) {
            let object = {};
            object["label"] = result.entity.category4OptionMap[key];
            object["value"] = key;
            option2ValueTemp.push(object);
          }
          this.category4Options = option2ValueTemp;
          let option3ValueTemp = [];
          for (var key in result.entity.category5OptionMap) {
            let object = {};
            object["label"] = result.entity.category5OptionMap[key];
            object["value"] = key;
            option3ValueTemp.push(object);
          }
          this.category5Options = option3ValueTemp;
          this.hasHos = result.entity.hasHos;
          console.log("this.hasHos" + this.hasHos);
          //颜色标记
          //hasHos = true 医院特价
          if (this.hasHos) {
            let object1 = {
              label: "医院特价",
              fieldName: "hospitalSpecialOffer__c",
              hideDefaultActions: true,
              type: "boolean",
              cellAttributes: { alignment: "left" },
              initialWidth: 80
            };
            this.columns.push(object1);
            console.log(" this.columns" + this.columns);
            for (var j in this.data) {
              this.data[j]["Name__c"] = this.data[j].Prod.Name__c;
              this.data[j]["Category3__c"] = this.data[j].Prod.Category3__c;
              this.data[j]["Category4__c"] = this.data[j].Prod.Category4__c;
              this.data[j]["Category5__c"] = this.data[j].Prod.Category5__c;
              this.data[j]["SFDA_Status__c"] = this.data[j].Prod.SFDA_Status__c;
              this.data[j]["hospitalSpecialOffer__c"] =
                this.data[j].hospitalSpecialOffer;
              console.log(
                "this.data[j].hospitalSpecialOffer__c" +
                  this.data[j].hospitalSpecialOffer
              );
    handleExpired() {
        console.log('过期库存呢销存');
        this[NavigationMixin.Navigate]({
            type: 'standard__webPage',
            attributes: {
                url: '/lexoverduestock'
            }
          }
          this.showSpinner = false;
        } else {
          // this.showToast("Error",'Error', result.msg);
          this.showMyToast("初始化失败", result.msg, "error");
        }
      })
      .catch((error) => {
        this.loader = false;
        this.showSpinner = false;
        console.log("error = " + JSON.stringify(error));
      });
  }
  handleChange(event) {
    let fieldName = event.target.getAttribute("data-field");
    let value = event.detail.value;
    console.log("======>fieldName" + fieldName);
    console.log("======>value" + value);
    switch (fieldName) {
      case "Name":
        this.Name = value;
        break;
      case "CategoryThree":
        this.CategoryThree = value;
        break;
      case "CategoryFour":
        this.CategoryFour = value;
        break;
      case "CategoryFive":
        this.CategoryFive = value;
        break;
      default:
        console.log("no data");
        });
    }
  }
  dataChange(event) {
    let fieldName = event.target.getAttribute("data-field");
    let value = event.detail.value;
    console.log("fieldName = " + fieldName + " value = " + value);
    switch (fieldName) {
      case "Name":
        this.Name = value;
        break;
      case "CategoryThree":
        this.CategoryThree = value;
        //调用后台显示第四五分类
        this.showAllCate();
        if (this.CategoryThree == "") {
          this.CategoryFour = "";
          this.CategoryFive = "";
        }
        break;
      case "CategoryFour":
        this.CategoryFour = value;
        //调用后台显示第五分类
        this.showCate();
        if (this.CategoryFour == "") {
          this.CategoryFive = "";
        }
        break;
      case "CategoryFive":
        this.CategoryFive = value;
        break;
    removeBox() {
        this[NavigationMixin.Navigate]({
            type: 'standard__webPage',
            attributes: {
                url: '/lexremovebox'
            }
        });
    }
  }
    cancelremoveBox() {
        this[NavigationMixin.Navigate]({
            type: 'standard__webPage',
            attributes: {
                url: '/lexcancelremovebox'
            }
        });
    }
  showAllCate() {
    categoryAllload({
      category3LWC: this.CategoryThree,
      agencyProTypeLWC: this.agencyProType
    })
      .then((result) => {
        result = JSON.parse(JSON.stringify(result));
        console.log("result = " + JSON.stringify(result));
        if (result.status == "Success") {
          this.category4Options = [];
          this.category5Options = [];
          //第4分类
          for (var key in result.entity.category4OptionMap) {
            let object = {};
            object["label"] = result.entity.category4OptionMap[key];
            object["value"] = key;
            this.category4Options.push(object);
          }
          console.log(
            "this.category4Options = " + JSON.stringify(this.category4Options)
          );
          //第5分类
          for (var key in result.entity.category5OptionMap) {
            let object = {};
            object["label"] = result.entity.category5OptionMap[key];
            object["value"] = key;
            this.category5Options.push(object);
          }
        } else {
          console.log("result = " + JSON.stringify(result));
          this.showMyToast(result.msg, "", "error");
        }
      })
      .catch((error) => {
        console.log("error" + JSON.stringify(error));
      });
  }
    clearAll() {
        this.showSpinner = true;
        this.showTable = false;
        this.Name = '';
        this.CategoryThree = '';
        this.CategoryFour = '';
        this.CategoryFive = '';
        this.template.querySelectorAll('lightning-combobox').forEach((each) => {
            each.value = null;
        });
        console.log(' this.CategoryThree' + this.CategoryThree);
        console.log('数据列表' + this.data);
        searchOrder({
            category1: this.Name,
            Category3: this.CategoryThree,
            Category4: this.CategoryFour,
            Category5: this.CategoryFive,
            orderDetZaikuListLWC: JSON.stringify(this.orderDetZaikuList),
            accountName: this.accountName,
            agencyProType: this.agencyProType,
            userWorkLocation: this.userWorkLocation,
            pageSizeLWC: this.pageSize,
            pageTokenLWC: this.currentPageToken,
            productkucunLWC: this.productkucun
        })
            .then((result) => {
                console.log('result搜索 = ' + JSON.stringify(result));
                result = JSON.parse(JSON.stringify(result));
                if (result.status == 'Success') {
                    this.nextPageToken =
                        result.entity.paginatedAccounts.nextPageToken;
                    this.totalRecords =
                        result.entity.paginatedAccounts.totalRecords;
                    this.recordStart =
                        result.entity.paginatedAccounts.recordStart;
                    this.recordEnd = result.entity.paginatedAccounts.recordEnd;
                    this.totalPages = Math.ceil(
                        result.entity.paginatedAccounts.totalRecords /
                            this.pageSize
                    );
                    console.log('this.totalPages = ' + this.totalPages);
                    this.paginationVisibility =
                        this.totalPages > 1 ? true : false;
                    console.log('this.sortDirection = ' + this.sortDirection);
                    this.data = result.entity.pageRecords;
  searchOrderDetail() {
    this.showTable = false;
    this.showSpinner = true;
    searchOrder({
      category1: this.Name,
      Category3: this.CategoryThree,
      Category4: this.CategoryFour,
      Category5: this.CategoryFive,
      orderDetZaikuListLWC: JSON.stringify(this.orderDetZaikuList),
      accountName: this.accountName,
      agencyProType: this.agencyProType,
      userWorkLocation: this.userWorkLocation,
      pageSizeLWC: this.pageSize,
      pageTokenLWC: this.currentPageToken,
      productkucunLWC: this.productkucun
                    for (var i in this.data) {
                        this.data[i]['Name__c'] = this.data[i].Prod.Name__c;
                        this.data[i]['Category3__c'] =
                            this.data[i].Prod.Category3__c;
                        this.data[i]['Category4__c'] =
                            this.data[i].Prod.Category4__c;
                        this.data[i]['Category5__c'] =
                            this.data[i].Prod.Category5__c;
                        this.data[i]['SFDA_Status__c'] =
                            this.data[i].Prod.SFDA_Status__c;
                        this.data[i]['guaranteeperiod'] =
                            this.data[i].guaranteeperiod;
                    }
                    this.showSpinner = false;
                    this.showTable = true;
                    // this.showMyToast('搜索成功',result.msg,'success');
                    // this.showToast("Success",'搜索成功', result.msg);
                } else {
                    // this.showToast("Error", 'Error',result.msg);
                    // this.showMyToast('搜索失败',result.msg,'error');
                    this.showSpinner = false;
                }
            })
            .catch((error) => {
                console.log('error = ' + JSON.stringify(error));
                this.showSpinner = false;
            });
    }
      // sortFieldLWC: this.sortBy,
      // sortOrderLWC: this.sortDirection
    })
      .then((result) => {
        result = JSON.parse(JSON.stringify(result));
        if (result.status == "Success") {
          this.nextPageToken = result.entity.paginatedAccounts.nextPageToken;
          this.totalRecords = result.entity.paginatedAccounts.totalRecords;
          this.recordStart = result.entity.paginatedAccounts.recordStart;
          this.recordEnd = result.entity.paginatedAccounts.recordEnd;
          this.totalPages = Math.ceil(
            result.entity.paginatedAccounts.totalRecords / this.pageSize
          );
          console.log(
            "result.entity.paginatedAccounts = " +
              JSON.stringify(result.entity.paginatedAccounts)
          );
          console.log("this.totalPages = " + this.totalPages);
          this.paginationVisibility = this.totalPages > 1 ? true : false;
          console.log("this.sortDirection = " + this.sortDirection);
          // this.showToast("Success",'搜索成功', result.msg);
          // this.showMyToast('搜索成功',result.msg,'success');
          this.data = result.entity.pageRecords;
          console.log("搜索Data==>" + JSON.stringify(this.data));
          for (var i in this.data) {
            this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
            this.data[i]["Category3__c"] = this.data[i].Prod.Category3__c;
            this.data[i]["Category4__c"] = this.data[i].Prod.Category4__c;
            this.data[i]["Category5__c"] = this.data[i].Prod.Category5__c;
            this.data[i]["SFDA_Status__c"] = this.data[i].Prod.SFDA_Status__c;
            this.data[i]["hospitalSpecialOffer__c"] =
              this.data[i].hospitalSpecialOffer;
            this.data[i]["guaranteeperiod"] = this.data[i].guaranteeperiod;
          }
          this.data = [...this.data];
          console.log("this.data = " + JSON.stringify(this.data));
          this.showTable = true;
          this.showSpinner = false;
        } else {
          this.nextPageToken = this.pageSize;
          this.totalRecords = 0;
          this.recordStart = 0;
          this.recordEnd = 0;
          this.totalPages = 0;
    sortByMethod(field, reverse, primer) {
        const key = primer
            ? function (x) {
                  return primer(x[field]);
              }
            : function (x) {
                  return x[field];
              };
          // this.showToast("Error",'Error', result.msg);
          // this.showMyToast('搜索失败',result.msg,'error');
          this.showSpinner = false;
        }
      })
      .catch((error) => {
        console.log("error = " + JSON.stringify(error));
        this.showSpinner = false;
      });
  }
  inventoryCount() {
    this[NavigationMixin.Navigate]({
      type: "standard__webPage",
      attributes: {
        url: "/lexinventory"
      }
    });
  }
  handleExpired() {
    console.log("过期库存呢销存");
    this[NavigationMixin.Navigate]({
      type: "standard__webPage",
      attributes: {
        url: "/lexoverduestock"
      }
    });
  }
  removeBox() {
    this[NavigationMixin.Navigate]({
      type: "standard__webPage",
      attributes: {
        url: "/lexremovebox"
      }
    });
  }
  cancelremoveBox() {
    this[NavigationMixin.Navigate]({
      type: "standard__webPage",
      attributes: {
        url: "/lexcancelremovebox"
      }
    });
  }
  clearAll() {
    this.showSpinner = true;
    this.showTable = false;
    this.Name = "";
    this.CategoryThree = "";
    this.CategoryFour = "";
    this.CategoryFive = "";
    this.template.querySelectorAll("lightning-combobox").forEach((each) => {
      each.value = null;
    });
    console.log(" this.CategoryThree" + this.CategoryThree);
    console.log("数据列表" + this.data);
    searchOrder({
      category1: this.Name,
      Category3: this.CategoryThree,
      Category4: this.CategoryFour,
      Category5: this.CategoryFive,
      orderDetZaikuListLWC: JSON.stringify(this.orderDetZaikuList),
      accountName: this.accountName,
      agencyProType: this.agencyProType,
      userWorkLocation: this.userWorkLocation,
      pageSizeLWC: this.pageSize,
      pageTokenLWC: this.currentPageToken,
      productkucunLWC: this.productkucun
    })
      .then((result) => {
        console.log("result搜索 = " + JSON.stringify(result));
        result = JSON.parse(JSON.stringify(result));
        if (result.status == "Success") {
          this.nextPageToken = result.entity.paginatedAccounts.nextPageToken;
          this.totalRecords = result.entity.paginatedAccounts.totalRecords;
          this.recordStart = result.entity.paginatedAccounts.recordStart;
          this.recordEnd = result.entity.paginatedAccounts.recordEnd;
          this.totalPages = Math.ceil(
            result.entity.paginatedAccounts.totalRecords / this.pageSize
          );
          console.log("this.totalPages = " + this.totalPages);
          this.paginationVisibility = this.totalPages > 1 ? true : false;
          console.log("this.sortDirection = " + this.sortDirection);
          this.data = result.entity.pageRecords;
          for (var i in this.data) {
            this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
            this.data[i]["Category3__c"] = this.data[i].Prod.Category3__c;
            this.data[i]["Category4__c"] = this.data[i].Prod.Category4__c;
            this.data[i]["Category5__c"] = this.data[i].Prod.Category5__c;
            this.data[i]["SFDA_Status__c"] = this.data[i].Prod.SFDA_Status__c;
            this.data[i]["guaranteeperiod"] = this.data[i].guaranteeperiod;
          }
          this.showSpinner = false;
          this.showTable = true;
          // this.showMyToast('搜索成功',result.msg,'success');
          // this.showToast("Success",'搜索成功', result.msg);
        } else {
          // this.showToast("Error", 'Error',result.msg);
          // this.showMyToast('搜索失败',result.msg,'error');
          this.showSpinner = false;
        }
      })
      .catch((error) => {
        console.log("error = " + JSON.stringify(error));
        this.showSpinner = false;
      });
  }
  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));
        };
    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);
    // if('limitCount' != this.sortBy)
    //     this.searchOrderDetail();
    // else{
    //     const { fieldName: sortedBy, sortDirection } = event.detail;
    //     const cloneData = [...this.data];
    //     cloneData.sort(this.sortByMethod(sortedBy, sortDirection === 'asc' ? 1 : -1));
    //     this.data = cloneData;
    //     this.sortDirection = sortDirection;
    //     this.sortedBy = sortedBy;
    // }
    const { fieldName: sortedBy, sortDirection } = event.detail;
    const cloneData = [...this.data];
    cloneData.sort(
      this.sortByMethod(sortedBy, sortDirection === "asc" ? 1 : -1)
    );
    this.data = 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.searchOrderDetail();
  }
  handleNext() {
    this.currentPageToken =
      Number(this.currentPageToken) + Number(this.pageSize);
    this.searchOrderDetail();
  }
  handleFirst() {
    this.currentPageToken = 0;
    this.searchOrderDetail();
  }
  handleLast() {
    this.currentPageToken =
      this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
    this.searchOrderDetail();
  }
  handlePageschange(event) {
    console.log(event.detail);
    this.pageSize = event.detail;
    this.currentPageToken = 0;
    this.searchOrderDetail();
  }
  get previousButtonDisabled() {
    return this.currentPageToken === 0;
  }
  get nextButtonDisabled() {
    return this.nextPageToken === undefined;
  }
  showMyToast(title, message, variant) {
    console.log("show custom message");
    var iconName = "";
    var content = "";
    if (variant == "success") {
      iconName = "utility:check";
    } else {
      iconName = "utility:error";
    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);
        // if('limitCount' != this.sortBy)
        //     this.searchOrderDetail();
        // else{
        //     const { fieldName: sortedBy, sortDirection } = event.detail;
        //     const cloneData = [...this.data];
        //     cloneData.sort(this.sortByMethod(sortedBy, sortDirection === 'asc' ? 1 : -1));
        //     this.data = cloneData;
        //     this.sortDirection = sortDirection;
        //     this.sortedBy = sortedBy;
        // }
        const { fieldName: sortedBy, sortDirection } = event.detail;
        const cloneData = [...this.data];
        cloneData.sort(
            this.sortByMethod(sortedBy, sortDirection === 'asc' ? 1 : -1)
        );
        this.data = cloneData;
        this.sortDirection = sortDirection;
        this.sortedBy = sortedBy;
    }
    if (message != "") {
      content =
        "<h2><strong>" + title + "<strong/></h2><h5>" + message + "</h5>";
    } else {
      content = "<h2><strong>" + title + "<strong/></h2>";
    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;
        }
    }
    this.template
      .querySelector("c-common-toast")
      .showToast(variant, content, iconName, 10000);
  }
}
    handlePrevious() {
        this.currentPageToken =
            Number(this.currentPageToken) - Number(this.pageSize);
        this.searchOrderDetail();
    }
    handleNext() {
        this.currentPageToken =
            Number(this.currentPageToken) + Number(this.pageSize);
        this.searchOrderDetail();
    }
    handleFirst() {
        this.currentPageToken = 0;
        this.searchOrderDetail();
    }
    handleLast() {
        this.currentPageToken =
            this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
        this.searchOrderDetail();
    }
    handlePageschange(event) {
        console.log(event.detail);
        this.pageSize = event.detail;
        this.currentPageToken = 0;
        this.searchOrderDetail();
    }
    get previousButtonDisabled() {
        return this.currentPageToken === 0;
    }
    get nextButtonDisabled() {
        return this.nextPageToken === undefined;
    }
    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);
    }
}