<template>
  <div>
    <!-- 筛选条件 -->
    <div class="table-page-search-wrapper" style="margin:0">
      <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
        <a-row :gutter="15" type="flex">
          <a-col flex="1">
            <a-form-item label="出库仓库" prop="warehouseSn">
              <chooseWarehouse id="salesEdit-warehouseSn" ref="warehouse" v-model="queryParam.warehouseSn" @load="warehouseLoad"></chooseWarehouse>
            </a-form-item>
          </a-col>
          <a-col flex="1">
            <a-form-item label="产品编码" prop="productCode">
              <a-input id="salesEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
            </a-form-item>
          </a-col>
          <a-col flex="1">
            <a-form-item label="产品名称" prop="productName">
              <a-input id="salesEdit-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
            </a-form-item>
          </a-col>
          <a-col flex="1">
            <a-form-item label="品牌">
              <ProductBrand id="salesEdit-productBrandSn" v-model="queryParam.productBrandSn"></ProductBrand>
            </a-form-item>
          </a-col>
          <a-col flex="1">
            <a-form-item label="产品分类">
              <productTypeAll placeholder="请选择产品分类" @change="changeProductType" v-model="productType" id="salesEdit-productType"></productTypeAll>
            </a-form-item>
          </a-col>
          <a-col flex="2" style="margin-bottom: 10px;">
            <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="salesEdit-refresh">查询</a-button>
            <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesEdit-reset">重置</a-button>
            <!-- <a-button
              :loading="loading"
              style="margin-left: 15px"
              type="primary"
              class="button-info"
              @click="searchThreeStock"
              id="salesEdit-updateStock">第三方库存</a-button> -->
          </a-col>
        </a-row>
      </a-form>
    </div>

    <div class="table-page-search-wrapper">
      <a-row :gutter="15" type="flex" justify="space-between" align="middle">
        <a-col :md="12" :sm="24" style="text-align:left;">
          <a-dropdown>
            <a-menu slot="overlay" @click="handleMenuClick">
              <a-menu-item key="0" id="salesEdit-pl-0">
                部分仓库设置
              </a-menu-item>
              <a-menu-item key="1" id="salesEdit-pl-1">
                删除已选项
              </a-menu-item>
              <a-menu-item key="4" id="salesEdit-pl-4" v-if="hasActive">
                批量匹配促销
              </a-menu-item>
              <!-- <a-menu-divider />
              <a-menu-item key="3" id="salesEdit-pl-3">
                全部仓库设置
              </a-menu-item>
              <a-menu-item key="2" id="salesEdit-pl-2">
                全部删除
              </a-menu-item> -->
            </a-menu>
            <a-button
              type="default"
              class="button-info"
              id="salesEdit-plaction"
              size="small"
            > 批量操作 <a-icon type="down" /> </a-button>
          </a-dropdown>
          <span v-if="selectTotal" style="margin:0 10px;">已选 {{ selectTotal }} 项</span>
          <a-button
            :id="'salesEdit-allSetWare'"
            type="link"
            class="button-info"
            size="small"
            @click="handleMenuClick({key:3})"
          ><a-icon type="setting"/> 全部仓库设置</a-button>
          <a-button
            :id="'salesEdit-allDel'"
            type="link"
            class="button-error"
            size="small"
            @click="handleMenuClick({key:2})"
          ><a-icon type="delete"/> 全部删除</a-button>
        </a-col>
        <a-col :md="12" :sm="24" style="text-align:right;">
          <a-button
            type="link"
            class="button-info"
            id="salesEdit-import-product"
            @click="handleGuideModal"><a-icon type="login" /> 导入产品</a-button>
          <a-button
            id="salesEdit-new-product"
            type="link"
            class="button-info"
            @click="openCpModal"><a-icon type="plus" /> 添加产品</a-button>
        </a-col>
      </a-row>
    </div>

    <!-- 已选配件列表 -->
    <v-table
      class="sTable"
      ref="table"
      size="small"
      :scroll="showTotal ? {y:200} :{ y: tableHeight }"
      :columns="columns"
      :data="loadData"
      :row-selection="{ columnWidth: '4%' }"
      @rowSelection="rowSelectionFun"
      :defaultLoadData="false"
      :showPagination="false"
      pageAlign="right"
      bordered>
      <!-- 产品编码 -->
      <template slot="productCode" slot-scope="text, record">
        <div style="display: flex;align-items: center;" v-if="Number(record.stockQty||0) < Number(record.unpushedQty||0)" >
          <div style="padding-right: 5px;">{{ text }}</div>
          <a-badge count="缺" :number-style="{ zoom:'0.7' }">
          </a-badge>
        </div>
        <span v-if="!(Number(record.stockQty||0) < Number(record.unpushedQty||0))">{{ text }}</span>
      </template>
      <!-- 销售数量 -->
      <template slot="salesNums" slot-scope="text, record">
        <a-input-number
          :id="'salesEdit-qty-'+record.id"
          size="small"
          v-model="record.qty"
          :precision="0"
          :min="1"
          :max="99999999"
          placeholder="请输入"
          @blur="e => onCellBlur(e.target.value, record)"
          style="width: 100%;" />
      </template>
      <!-- 当前库存 -->
      <template slot="stockQty" slot-scope="text, record">
        <div v-if="record.stockQty || record.stockQty==0">
          <p style="margin: 0;" v-if="Number(record.stockQty) < Number(record.unpushedQty)">{{ record.stockQty }}(<span class="redStyle">缺{{ Number(record.unpushedQty||0) - Number(record.stockQty||0) }}</span>)</p>
          <p style="margin: 0;" v-else>{{ record.stockQty }}</p>
        </div>
        <span v-else>--</span>
      </template>
      <!-- 出库仓库 -->
      <template slot="warehouseBox" slot-scope="text, record">
        <a-select
          size="small"
          style="width:100%;"
          :id="'salesEdit-warehouse-'+record.id"
          placeholder="请选择仓库"
          v-model="record.warehouseSn"
          :showSearch="true"
          @change="handleWarehouseBox(record)"
          mode="default"
          :filter-option="filterOption">
          <a-select-option v-for="item in warehouseDataList" :key="item.warehouseSn" :value="item.warehouseSn">{{ item.name }}</a-select-option>
        </a-select>
      </template>
      <!-- 操作 -->
      <template slot="action" slot-scope="text, record">
        <a-button
          size="small"
          type="link"
          :loading="delLoading"
          class="button-info"
          v-if="hasActive"
          :id="'salesEdit-addPromo-'+record.id"
          @click="handleAddPromo(record)"
        >参与促销</a-button>
        <a-button
          size="small"
          type="link"
          :loading="delLoading"
          class="button-error"
          :id="'salesEdit-del-'+record.id"
          @click="handleDel(record)"
        >删除</a-button>
      </template>
    </v-table>
    <!-- 总计 -->
    <div v-if="showTotal" style="padding:6px 0 0;text-align: right;">
      总款数：<strong>{{ countData&&(countData.totalCategory || countData.totalCategory==0) ? countData.totalCategory : 0 }}</strong>；
      总数量：<strong>{{ countData&&(countData.totalQty || countData.totalQty==0) ? countData.totalQty : 0 }}</strong>；
      <span v-if="$hasPermissions('B_salesEdit_salesPrice')">总金额：<strong>{{ countData&&(countData.totalAmount || countData.totalAmount==0) ? toThousands(countData.totalAmount) : '0.00' }}</strong>；</span>
    </div>
    <!-- 导入产品 -->
    <importGuideModal ref="guideModal" :openModal="openGuideModal" @close="closeGuideModel" @ok="hanldeOk" />
    <!-- 仓库设置 -->
    <setWarehouse :show="openWarehouseModal" :title="warehouseTit" @ok="chooseWarehouseOk" @cancel="openWarehouseModal=false"></setWarehouse>
    <!-- 换促销 -->
    <updateActiveModal ref="updateActive" :show="openUpActiveModal" @ok="upActiveOk" @batchOk="batchUpActiveOk" @cancel="openUpActiveModal=false"></updateActiveModal>
  </div>
</template>

<script>
import { commonMixin } from '@/utils/mixin'
import { VTable, VSelect } from '@/components'
import ImportGuideModal from './importGuideModal.vue'
import setWarehouse from './setWarehouse.vue'
import updateActiveModal from './updateActiveModal.vue'
import chooseWarehouse from '@/views/common/chooseWarehouse'
import ProductBrand from '@/views/common/productBrand.js'
import productTypeAll from '@/views/common/productTypeAll.js'
import {
  salesDetailAllList,
  salesDetailInsert,
  salesDetailUpdateQty,
  salesDetailDel,
  salesDetailBatchDel,
  deleteNormalAll,
  updateWarehouse,
  salesDetaiCount,
  salesBatchInsert } from '@/api/salesDetailNew'
export default {
  name: 'ProductList',
  mixins: [commonMixin],
  components: {
    VTable,
    VSelect,
    ImportGuideModal,
    chooseWarehouse,
    setWarehouse,
    ProductBrand,
    productTypeAll,
    updateActiveModal
  },
  props: {
    openModal: { //  弹框显示状态
      type: Boolean,
      default: false
    },
    newLoading: Boolean,
    detailData: { // 销售单详情
      type: Object,
      default: function () { return null }
    },
    warehouseSn: { // 仓库sn
      type: String,
      default: ''
    },
    salesBillSn: { // 销售单sn
      type: String,
      default: ''
    },
    showTotal: { // 是否显示总计
      type: Boolean,
      default: true
    },
    activeList: {
      type: Array,
      default: () => []
    },
    hasActive: { // 是否显示参与促销
      type: Boolean,
      default: false
    }
  },
  data () {
    return {
      spinning: false,
      loading: false,
      openUpActiveModal: false,
      // 加载数据方法 必须为 Promise 对象
      loadData: parameter => {
        this.disabled = true
        this.queryParam.salesBillSn = this.salesBillSn || ''
        this.getCount()
        return salesDetailAllList(Object.assign(parameter, this.queryParam, { showStock: true })).then(res => {
          let data
          if (res.status == 200) {
            data = res.data
            const no = 0
            for (var i = 0; i < data.length; i++) {
              data[i].no = no + i + 1
              // 存储变更前的数量和仓库
              data[i].qtyBackups = data[i].qty
              data[i].warehouseBackups = data[i].warehouseSn
            }
            this.dataSource = data
          }
          this.disabled = false
          this.loading = false
          return data
        })
      },
      showSearch: false, // 收起展开搜索
      openWarehouseModal: false, // 打开仓库设置
      openGuideModal: false, //  导入产品引导
      delLoading: false, // 删除loading
      disabled: false, //  查询、重置按钮是否可操作
      queryParam: {
        warehouseSn: undefined, // 仓库
        productCode: '', // 产品编码
        productName: '', // 产品名称
        productBrandSn: undefined, // 产品品牌
        productTypeSn1: '', //  产品一级分类
        productTypeSn2: '', //  产品二级分类
        productTypeSn3: '' //  产品三级分类
      },
      productType: [], // 产品分类
      rowSelectionInfo: null, // 已选的产品数据
      warehouseDataList: [], // 仓库列表
      countData: null, // 统计数据
      isInster: false, // 是否添加
      warehouseTit: '', // 仓库设置弹框标题
      showStockCol: false // 是否显示第三方库存
    }
  },
  watch: {
    spinning (a, b) {
      if (a) {
        this.$emit('spinning', a)
      }
    }
  },
  computed: {
    // 已选产品数量
    selectTotal () {
      return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length || 0
    },
    // 表格高度
    tableHeight () {
      return window.innerHeight - (this.showTotal ? 335 : 300)
    },
    w1 () {
      return window.innerWidth - 200
    },
    // 表格列定义
    columns () {
      const arr = [
        { title: '序号', dataIndex: 'no', width: 40, align: 'center' },
        { title: '产品编码', dataIndex: 'productEntity.code', scopedSlots: { customRender: 'productCode' }, width: '150px', align: 'left' },
        { title: '产品名称', dataIndex: 'productEntity.name', align: 'left', width: 200, ellipsis: true },
        { title: '销售数量', scopedSlots: { customRender: 'salesNums' }, width: 100, align: 'center' },
        { title: '库存', dataIndex: 'stockQty', scopedSlots: { customRender: 'stockQty' }, width: 100, align: 'center' },
        { title: '出库仓库', scopedSlots: { customRender: 'warehouseBox' }, width: 150, align: 'center' },
        { title: '单位', dataIndex: 'productEntity.unit', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
        { title: '操作', scopedSlots: { customRender: 'action' }, width: 120, align: 'center' }
      ]
      if (this.showStockCol) {
        arr.splice(5, 0, { title: '第三方库存', dataIndex: 'thirdStockQty', width: 100, align: 'center', customRender: text => ((text || text == 0) ? text : '--') })
      }
      // 售价权限
      if (this.$hasPermissions('B_salesEdit_salesPrice')) {
        arr.splice(3, 0, { title: '售价', dataIndex: 'price', width: 100, align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
        arr.splice(4, 0, { title: '价格级别', dataIndex: 'priceLevelDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } })
        arr.splice(this.showStockCol ? 8 : 7, 0, { title: '售价小计', dataIndex: 'totalAmount', width: 100, align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
      }
      let wt = 0
      arr.forEach(item => {
        if (item.width) {
          wt += parseInt(item.width)
        }
      })
      const w1 = this.w1 - wt
      arr[2].width = w1 < 120 ? 120 : w1
      return arr
    }
  },
  methods: {
    // 仓库下拉列表筛选
    filterOption (input, option) {
      return (
        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
      )
    },
    // 导入产品
    handleGuideModal () {
      this.$refs.guideModal.pageInit({ salesBillSn: this.salesBillSn })
      this.openGuideModal = true
    },
    // 仓库下拉列表数据加载完成
    warehouseLoad (sn, list) {
      this.warehouseDataList = list
    },
    //  产品分类  change
    changeProductType (val, opt) {
      this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
      this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
      this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
    },
    // 表格选中项
    rowSelectionFun (obj) {
      this.rowSelectionInfo = obj || null
    },
    // 打开产品列表弹框
    openCpModal () {
      this.$emit('openCpModal', 0, 'productNormalList')
    },
    // 查询第三方库存
    searchThreeStock () {
      this.loading = true
      this.$emit('allThreeStock')
    },
    searchThreeStockOk () {
      this.showStockCol = true
      this.resetSearchForm()
    },
    // 获取统计
    getCount () {
      salesDetaiCount(Object.assign(this.queryParam, { showStock: true })).then(res => {
        if (res.status == 200) {
          this.countData = res.data
        }
        this.$emit('count', this.countData)
      })
    },
    // 删除产品
    handleDel (row) {
      const _this = this
      this.$confirm({
        title: '提示',
        content: '确认要删除吗？',
        centered: true,
        closable: true,
        onOk () {
          _this.delLoading = true
          _this.spinning = true
          salesDetailDel({ salesBillDetailSn: row.salesBillDetailSn, salesBillSn: _this.salesBillSn }).then(res => {
            if (res.status == 200) {
              _this.$message.success(res.message)
              _this.$refs.table.refresh(false)
              _this.$emit('refash', 'normal', 'del')
            }
            _this.delLoading = false
            _this.spinning = false
          })
        }
      })
    },
    // 删除全部已选产品
    handleBatchDelAll () {
      const _this = this
      if (_this.dataSource.length == 0) {
        _this.$message.warning('暂无可删除的产品！')
        return
      }
      this.$confirm({
        title: '提示',
        content: '确认要删除全部产品吗？',
        centered: true,
        onOk () {
          _this.spinning = true
          deleteNormalAll({ salesBillSn: _this.salesBillSn }).then(res => {
            if (res.status == 200) {
              _this.resetSearchForm()
              // 触发事件给父级组件
              _this.$emit('refash', 'normal', 'batchDel')
              _this.$message.success(res.message)
            }
            _this.spinning = false
          })
        }
      })
    },
    // 批量删除已选产品
    handleBatchDel () {
      const _this = this
      if (!_this.selectTotal) {
        _this.$message.warning('请先选择要批量删除的产品！')
        return
      }
      const obj = _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => item.salesBillDetailSn) || []
      this.$confirm({
        title: '提示',
        content: '已选产品' + obj.length + '项，确认要批量删除吗？',
        centered: true,
        onOk () {
          _this.spinning = true
          salesDetailBatchDel({
            salesBillSn: _this.salesBillSn,
            salesBillDetailSnList: obj
          }).then(res => {
            if (res.status == 200) {
              _this.clearTable()
              // 触发事件给父级组件
              _this.$emit('refash', 'normal', 'batchDel')
              _this.$message.success(res.message)
            }
            _this.spinning = false
          })
        }
      })
    },
    // 单个设置出库仓库
    handleWarehouseBox (row) {
      const snArr = [row.salesBillDetailSn]
      const ajax_data = {
        warehouseSn: row.warehouseSn,
        salesBillDetailSnList: snArr,
        salesBillSn: this.salesBillSn,
        allFlag: false
      }
      this.setWarehouseInfo(ajax_data)
    },
    // 全部或批量仓库设置确认
    chooseWarehouseOk (sn) {
      const _this = this
      const snArr = []
      if (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows && _this.rowSelectionInfo.selectedRows.length > 0) {
        _this.rowSelectionInfo.selectedRows.forEach(item => {
          snArr.push(item.salesBillDetailSn)
        })
      }
      const ajax_data = {
        warehouseSn: sn,
        salesBillDetailSnList: snArr,
        salesBillSn: _this.salesBillSn,
        allFlag: snArr.length == 0
      }
      _this.setWarehouseInfo(ajax_data)
    },
    // 修改仓库
    setWarehouseInfo (data) {
      const _this = this
      _this.spinning = true
      updateWarehouse(data).then(res => {
        if (res.status == 200) {
          _this.$message.success(res.message)
          _this.$emit('refash', 'promo', 'update')
          if (data.allFlag) {
            _this.resetSearchForm()
          } else {
            _this.clearTable()
          }
        }
        _this.openWarehouseModal = false
        _this.spinning = false
      })
    },
    // 操作下拉菜单
    handleMenuClick (e) {
      const _this = this
      if (e.key == 0) { // 仓库设置
        if (!this.selectTotal) {
          _this.$message.warning('请先选择要设置的产品！')
        } else {
          _this.openWarehouseModal = true
          _this.warehouseTit = '部分仓库设置'
        }
      } else if (e.key == 1) { // 删除已选项
        this.handleBatchDel()
      } else if (e.key == 3) {
        if (_this.dataSource && _this.dataSource.length == 0) {
          _this.$message.warning('暂无可设置的产品！')
          return
        }
        this.$refs.table.clearSelected()
        this.rowSelectionInfo = null
        _this.warehouseTit = '全部仓库设置'
        _this.openWarehouseModal = true
      } else if (e.key == 4) { // 批量匹配活动
        _this.handleBatchAddPromo()
      } else {
        this.handleBatchDelAll()
      }
    },
    // 已选产品 修改销售数量
    onCellBlur (val, record) {
      const _this = this
      //  光标移出，值发生改变再调用编辑接口
      if (val && val != record.qtyBackups) {
        _this.spinning = true
        salesDetailUpdateQty({
          salesBillDetailSn: record.salesBillDetailSn,
          qty: record.qty,
          salesBillSn: _this.salesBillSn
        }).then(res => {
          if (res.status == 200) {
            _this.$emit('refash', 'normal', 'update')
            _this.$message.success(res.message)
          }
          _this.$refs.table.refresh(false)
          _this.spinning = false
        })
      } else {
        record.qty = record.qtyBackups
      }
    },
    // 重置查询
    resetSearchForm () {
      this.queryParam.productCode = ''
      this.queryParam.productName = ''
      this.queryParam.warehouseSn = undefined
      this.queryParam.productBrandSn = undefined
      this.queryParam.productTypeSn1 = ''
      this.queryParam.productTypeSn2 = ''
      this.queryParam.productTypeSn3 = ''
      this.productType = []
      this.$refs.table.clearSelected()
      this.rowSelectionInfo = null
      this.$refs.table.refresh(true)
    },
    // 清空选项并查询当前页
    clearTable () {
      this.$refs.table.clearSelected()
      this.rowSelectionInfo = null
      this.$refs.table.refresh(false)
    },
    // 批量参与促销
    handleBatchAddPromo () {
      if (!this.selectTotal) {
        this.$message.warning('请先选择要批量匹配促销的产品！')
      } else {
        const _this = this
        const obj = _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => item.salesBillDetailSn) || []
        _this.$refs.updateActive.setBatchData(obj, _this.activeList)
        _this.openUpActiveModal = true
      }
    },
    // 参与促销选择弹框
    handleAddPromo (record) {
      this.$refs.updateActive.getActiveList({
        productSn: record.productSn,
        salesBillSn: this.salesBillSn,
        promoRuleSn: null
      }, record)
      this.openUpActiveModal = true
    },
    // 确定参与促销
    upActiveOk (salesPromoSnList, editRow) {
      this.spinning = true
      const params = {
        salesBillDetailSn: editRow.salesBillDetailSn,
        salesBillSn: this.salesBillSn,
        priceLevel: editRow.priceLevel,
        salesPromoSnList: salesPromoSnList
      }
      // 参与促销活动
      this.$emit('addActive', params, 0)
    },
    // 批量参与促销
    batchUpActiveOk (data) {
      this.spinning = true
      const params = {
        salesBillSn: this.salesBillSn,
        ...data
      }
      // 参与促销活动
      this.$emit('addActive', params, 0)
    },
    // 参与促销活动成功
    addAcitveSuccess () {
      this.spinning = false
      this.$refs.updateActive.confirmLoading = false
      this.$refs.updateActive.resetData()
      this.openUpActiveModal = false
      this.clearTable()
    },
    // 保存添加的产品到销售列表
    saveNewProduct (row, promotionFlag) {
      // 防止多次添加产品
      if (this.isInster) { return }
      this.$message.loading('正在添加产品...', 1)
      this.isInster = true
      this.spinning = true
      salesDetailInsert({
        packQty: row.productPackQty,
        productSn: row.productSn,
        showCost: row.lastStockCost,
        price: row.productPrice,
        origPrice: row.productPrice,
        promotionGiftsAmount: 0,
        usePromotionGiftsAmount: 0,
        qty: row.salesNums,
        salesBillSn: this.detailData.salesBillSn,
        salesBillNo: this.detailData.salesBillNo,
        purchaseBillSn: this.detailData.purchaseBillSn,
        purchaseBillNo: this.detailData.purchaseBillNo,
        priceLevel: row.priceLevel,
        stockSn: row.stockSn,
        promotableFlag: row.isJoinActivityProduct || 0, // 可促销标记 有活动的传1，没活动的传0
        promotionFlag: 0, // 促销标记 正品传0，促销品传1
        warehouseSn: row.warehouseSn
      }).then(res => {
        if (res.status == 200) {
          this.$message.success('产品添加成功', 2.5)
          this.resetSearchForm()
          // 触发事件给父级组件
          this.$emit('refash', 'normal', 'add')
        } else {
          this.$emit('error', 'normal', 'add')
        }
        this.spinning = false
        this.isInster = false
      }).catch(err => {
        this.$emit('error', 'normal', 'add')
        this.spinning = false
        this.isInster = false
      })
    },
    // 导入产品弹框关闭
    closeGuideModel () {
      this.openGuideModal = false
    },
    // 批量导入产品确认
    hanldeOk (data, salesPromoSn) {
      const params = {
        salesBillSn: this.detailData.salesBillSn,
        salesBillDetailList: data
      }
      salesBatchInsert(params).then(res => {
        if (res.status == 200) {
          this.$message.success('产品导入成功', 2.5)
          this.resetSearchForm()
          // 触发事件给父级组件
          this.$emit('refash', 'normal', 'import')
        }
      })
    }
  }
}
</script>

<style lang="less">
  .ant-input-number-sm input{
    text-align: center;
   }
  .total-bar{
    display:flex;
    justify-content: space-between;
  }
</style>
