<template>
  <div class="editGrap-wrap">
    <!-- <a-spin :spinning="spinning" tip="Loading..."> -->
    <div class="ant-spin-nested-loading">
      <a-page-header :ghost="false" :backIcon="false" class="editGrap-back" >
        <!-- 自定义的二级文字标题 -->
        <template slot="subTitle">
          <a id="editGrap-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
        </template>
        <!-- 操作区，位于 title 行的行尾 -->
        <template slot="extra">
          <print :params="{allocateReturnSn: $route.params.sn}" :disabled="localDataSource.length==0" @loading="spinning=true" @unloading="spinning=false"></print>
        </template>
      </a-page-header>
      <a-card size="small" :bordered="false" v-if="basicInfoData" class="editGrap-cont">
        <a-collapse :activeKey="['0']">
          <a-collapse-panel key="0" header="基础信息">
            <a-descriptions :column="3">
              <a-descriptions-item label="调拨退货单号">{{ (basicInfoData&&basicInfoData.allocateReturnNo) || '--' }}</a-descriptions-item>
              <a-descriptions-item label="调拨退货对象">{{ (basicInfoData&&basicInfoData.targetTypeDictValue) || '--' }}</a-descriptions-item>
              <a-descriptions-item label="调拨退货对象名称">{{ (basicInfoData&&basicInfoData.targetName) || '--' }}</a-descriptions-item>
              <a-descriptions-item label="调入仓库">
                <!-- <warehouse
                style="width:200px;"
                :allowClear="false"
                  v-model="basicInfoData.warehouseSn"
                  @change="updateWarehouse"
                  id="basicInfo-warehouseSn"
                  placeholder="请选择调入仓库"
                /> -->
                {{ (basicInfoData&&basicInfoData.warehouseName) || '--' }}
              </a-descriptions-item>
              <a-descriptions-item label="费用/调拨退货类型">
                <AllocateType
                  id="allocateEdit-allocateReturnTypeSn"
                  style="width: 220px;"
                  v-model="allocateTypeVal"
                  placeholder="请选择费用/调拨退货类型"
                  @change="changeAllocateType"></AllocateType>
              </a-descriptions-item>
              <a-descriptions-item label="是否抓单">{{ (basicInfoData&&basicInfoData.grabFlagDictValue) || '--' }}</a-descriptions-item>
              <a-descriptions-item label="业务状态">{{ (basicInfoData&&basicInfoData.stateDictValue) || '--' }}</a-descriptions-item>
              <a-descriptions-item label="备注">
                {{ (basicInfoData&&basicInfoData.remarks) }}
                <a-icon type="form" title="编辑备注" @click="editRemark = true" style="color: dodgerblue;font-size: 14px;" />
              </a-descriptions-item>
            </a-descriptions>
          </a-collapse-panel>
        </a-collapse>
      </a-card>
      <!-- 选择产品 -->
      <a-card size="small" :bordered="false" class="editGrap-cont">
        <a-collapse :activeKey="['1']">
          <a-collapse-panel key="1" :forceRender="true" header="选择产品">
            <!-- 筛选条件 -->
            <div class="table-page-search-wrapper" style="display:flex;align-items: center;">
              <div style="margin-bottom: 10px;padding-right: 20px;">
                <a-button
                  type="primary"
                  class="button-info"
                  id="salesEdit-plDel-btn"
                  @click="handleBatchAdd">批量添加</a-button>
                  <span>已选{{ selectTotal }}项</span>
              </div>
              <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
                <a-row :gutter="15">
                  <a-col :md="6" :sm="24">
                    <a-form-item label="调拨单号" prop="allocateNo">
                      <a-input id="editGrap-allocateNo" v-model.trim="queryParam.allocateNo" placeholder="请输入调拨单号" allowClear />
                    </a-form-item>
                  </a-col>
                  <a-col :md="6" :sm="24">
                    <a-form-item label="产品编码" prop="productCode">
                      <a-input id="editGrap-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
                    </a-form-item>
                  </a-col>
                  <a-col :md="6" :sm="24">
                    <a-form-item label="产品名称" prop="productName">
                      <a-input id="editGrap-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
                    </a-form-item>
                  </a-col>
                  <a-col :md="4" :sm="24" style="margin-bottom: 10px;">
                    <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="storeTransferOutList-refresh">查询</a-button>
                    <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="storeTransferOutList-reset">重置</a-button>
                  </a-col>
                </a-row>
              </a-form>
            </div>
            <!-- 列表 -->
            <s-table
              class="sTable"
              ref="table"
              size="small"
              index="0"
              tableId="table1"
              :rowKey="(record) => record.allocateNo +'-'+ record.productSn"
              :columns="columns"
              :customRow="handleClickRow"
              :data="loadData"
              :row-selection="{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: !record.refundableQty } }) }"
              @rowSelection="rowSelectionFun"
              :scroll="{ y: 300 }"
              :defaultLoadData="false"
              bordered>
              <!-- 退货单价 -->
              <template slot="returnPrice" slot-scope="text, record">
                <div @dblclick.stop>
                  <a-input-number
                    size="small"
                    v-model="record.returnPrice"
                    :precision="2"
                    :min="0"
                    :max="999999"
                    placeholder="请输入"
                    style="width: 100%;" />
                </div>
              </template>
              <!-- 操作 -->
              <template slot="action" slot-scope="text, record">
                <a-button
                  size="small"
                  v-if="record.refundableQty"
                  type="link"
                  class="button-primary"
                  @click="handleAdd(record)"
                  id="editGrap-add-btn">添加</a-button>
                <span v-else>--</span>
              </template>
            </s-table>
          </a-collapse-panel>
        </a-collapse>
      </a-card>
      <!-- 已选产品 -->
      <a-card size="small" :bordered="false" class="editGrap-cont">
        <a-collapse :activeKey="['2']">
          <a-collapse-panel key="2" :forceRender="true" header="已选产品">
            <!-- 总计 -->
            <a-alert type="info" style="margin-bottom:10px">
              <div slot="message">
                退货总数量：<strong>{{ (basicInfoData&&(basicInfoData.totalQty || basicInfoData.totalQty==0)) ? basicInfoData.totalQty : '--' }}</strong> ；
                <span>退货总金额：<strong>{{ (basicInfoData&&(basicInfoData.totalPrice || basicInfoData.totalPrice==0)) ? toThousands(basicInfoData.totalPrice) : '--' }}</strong>；</span>
              </div>
            </a-alert>
            <!-- 筛选条件 -->
            <a-row :gutter="15">
              <a-col :span="17">
                <div class="table-page-search-wrapper">
                  <a-form layout="inline" @keyup.enter.native="$refs.chooseTable.refresh(true)">
                    <a-row :gutter="15">
                      <a-col :md="9" :sm="24">
                        <a-form-item label="产品编码" prop="productCode">
                          <a-input id="editGrap-productCode" v-model.trim="chooseQueryParam.productCode" placeholder="请输入产品编码" allowClear />
                        </a-form-item>
                      </a-col>
                      <a-col :md="9" :sm="24">
                        <a-form-item label="产品名称" prop="productName">
                          <a-input id="editGrap-productName" v-model.trim="chooseQueryParam.productName" placeholder="请输入产品名称" allowClear />
                        </a-form-item>
                      </a-col>
                      <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
                        <a-button type="primary" @click="$refs.chooseTable.refresh(true)" :disabled="chooseDisabled" id="storeTransferOutList-refresh">查询</a-button>
                        <a-button style="margin-left: 8px" @click="chooseResetSearchForm" :disabled="chooseDisabled" id="storeTransferOutList-reset">重置</a-button>
                      </a-col>
                    </a-row>
                  </a-form>
                </div>
              </a-col>
              <a-col :span="7" style="text-align: right;">
                <!-- <a-button size="small" id="editGrap-import-btn" @click="openGuideModal=true">导入产品</a-button> -->
                <!-- <a-button size="small" type="danger" style="margin-left: 5px" @click.stop="handleDel('', 'all')" id="chainTransferOutEdit-del-all-btn">整单删除</a-button> -->
              </a-col>
            </a-row>
            <!-- 列表 -->
            <s-table
              class="sTable"
              ref="chooseTable"
              size="small"
              index="1"
              tableId="table2"
              :rowKey="(record) => record.id"
              :columns="chooseColumns"
              :data="chooseLoadData"
              :scroll="{ y: 300 }"
              :defaultLoadData="false"
              bordered>
              <!-- 退货单价 -->
              <template slot="returnPrice" slot-scope="text, record">
                <a-input-number
                  size="small"
                  v-model="record.price"
                  @blur="e => priceChange(e.target.value, record)"
                  :precision="2"
                  :min="0"
                  :max="999999"
                  placeholder="请输入"
                  style="width: 100%;" />
              </template>
              <!-- 操作 -->
              <template slot="action" slot-scope="text, record">
                <a-button size="small" type="link" class="button-error" @click="handleDel(record)" id="editGrap-del-btn">删除</a-button>
              </template>
            </s-table>
          </a-collapse-panel>
        </a-collapse>
      </a-card>
    <!--</a-spin>-->
    </div>
    <div class="affix-cont">
      <a-button
        type="primary"
        id="editGrap-submit"
        size="large"
        :disabled="spinning"
        class="button-primary"
        @click="handleSubmit"
        style="padding: 0 60px;">提交</a-button>
    </div>
    <!-- 导入产品 -->
    <!-- <importGuideModal :openModal="openGuideModal" :params="{allocateReturnSn: $route.params.sn}" @close="openGuideModal=false" @ok="handleGuideOk" /> -->
    <!-- 修改基础信息 -->
    <a-modal
      centered
      wrapClassName="allocateBill-editRemark-modal"
      v-if="basicInfoData"
      :footer="null"
      :maskClosable="false"
      title="修改备注"
      v-model="editRemark"
      @cancel="editRemark = false"
      :width="600">
      <a-textarea
        v-model="basicInfoData.remarks"
        placeholder="请输入备注(最多120个字符)"
        :maxLength="120"
        :auto-size="{ minRows: 3, maxRows: 5 }"
      />
      <div class="btn-cont">
        <a-button type="primary" id="allocateBill-basicInfo-modal-save" @click="handleEditRemark">保存</a-button>
        <a-button id="allocateBill-basicInfo-modal-back" @click="editRemark = false" style="margin-left: 15px;">取消</a-button>
      </div>
    </a-modal>
  </div>
</template>

<script>
import { commonMixin } from '@/utils/mixin'
import { STable, VSelect } from '@/components'
// import ImportGuideModal from './importGuideModal.vue'
import print from './print.vue'
import warehouse from '@/views/common/chooseWarehouse.js'
import { allocDetailQueryPageForReturn } from '@/api/allocateBill'
import AllocateType from '@/views/common/allocateType.js'
import {
  allocateReturnSave,
  allocReturnDetailQueryPage,
  allocateReturnQueryBySn,
  allocReturnDetailInsert,
  allocReturnDetailUpdate,
  allocateReturnSubmit,
  allocReturnDetailDelete,
  allocReturnDetailInsertBatch
} from '@/api/allocateReturn'

export default {
  name: 'TransferReturnGrpEdit',
  mixins: [commonMixin],
  components: { STable, VSelect, AllocateType, print, warehouse },
  data () {
    return {
      spinning: false,
      queryParam: {
        productCode: '',
        productName: '',
        allocateNo: ''
      },
      chooseQueryParam: {
        productCode: '',
        productName: ''
      },
      editRemark: false,
      disabled: false, //  查询、重置按钮是否可操作
      loading: false,
      chooseDisabled: false, //  查询、重置按钮是否可操作
      advanced: false, // 高级搜索 展开/关闭
      // 加载数据方法 必须为 Promise 对象
      loadData: parameter => {
        this.disabled = true
        const warehouseSn = this.basicInfoData.warehouseSn
        const targetSn =  this.basicInfoData.targetSn
        const targetType = this.$route.params.targetType
        const allocateNo = this.queryParam.allocateNo
        const otherParams = { allocateBill: { targetType: targetType , targetSn:targetSn, allocateNo: allocateNo } }
        return allocDetailQueryPageForReturn(Object.assign(parameter, this.queryParam, otherParams)).then(res => {
          const data = res.data
          const no = (data.pageNo - 1) * data.pageSize
          for (var i = 0; i < data.list.length; i++) {
            data.list[i].no = no + i + 1
            data.list[i].returnPrice = data.list[i].price
            data.list[i].oldPrice = data.list[i].price
          }
          this.loadDataSource = data.list || []
          this.disabled = false
          return data
        })
      },
      loadDataSource: [],
      localDataSource: [],
      // 加载数据方法 必须为 Promise 对象
      chooseLoadData: parameter => {
        this.chooseDisabled = true
        const params = Object.assign(parameter, { product: { name: this.chooseQueryParam.productName, code: this.chooseQueryParam.productCode }, allocateReturnSn: this.$route.params.sn })
        return allocReturnDetailQueryPage(params).then(res => {
          const data = res.data
          const no = (data.pageNo - 1) * data.pageSize
          for (var i = 0; i < data.list.length; i++) {
            data.list[i].no = no + i + 1
            data.list[i].oldPrice = data.list[i].price
          }
          this.localDataSource = data.list || []
          this.chooseDisabled = false
          return data
        })
      },
      basicInfoData: null, // 基本信息
      openGuideModal: false, //  导入产品引导
      rowSelectionInfo: null,
      allocateTypeVal: []
    }
  },
  computed: {
    selectTotal () {
      return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length || 0
    },
    columns () {
      const _this = this
      const arr = [
        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
        { title: '调拨单号', dataIndex: 'allocateNo', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
        { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
        { title: '产品名称', dataIndex: 'productName', align: 'center', width: '29%', customRender: function (text) { return text || '--' }, ellipsis: true },
        { title: '单位', dataIndex: 'productUnit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
        { title: '调拨数量', dataIndex: 'qty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
        { title: '剩余可退数量', dataIndex: 'refundableQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
        { title: '退货单价', scopedSlots: { customRender: 'returnPrice' }, width: '10%', align: 'center' },
        { title: '退货数量', dataIndex: 'returnQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
      ]
        arr.splice(5,0,{ title: '调拨单价', dataIndex: 'price', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
      return arr
    },
    chooseColumns () {
      const _this = this
      const arr = [
        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
        { title: '调拨单号', dataIndex: 'allocateNo', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
        { title: '产品编码', dataIndex: 'product.code', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
        { title: '产品名称', dataIndex: 'product.name', align: 'center', width: '29%', customRender: function (text) { return text || '--' }, ellipsis: true },
        { title: '单位', dataIndex: 'product.unit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
        { title: '退货单价', scopedSlots: { customRender: 'returnPrice' }, width: '10%', align: 'center' },
        { title: '退货数量', dataIndex: 'returnQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
      ]
        arr.splice(7,0,{ title: '退货金额', dataIndex: 'totalReturnPrice', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') }})
      return arr
    }
  },
  methods: {
    // 表格选中项
    rowSelectionFun (obj) {
      this.rowSelectionInfo = obj || null
    },
    // 批量添加
    handleBatchAdd () {
      const _this = this
      if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
        _this.$message.warning('请在选择要添加的产品后再进行批量操作！')
        return
      }
      const obj = []
      _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
        obj.push({
          'allocateNo': item.allocateNo,
          'allocateSn': item.allocateSn,
          'oldPrice': item.oldPrice,
          'cost': row.cost,
          'returnQty': row.returnQty,
          'price': item.returnPrice,
          'productSn': item.productSn,
          'productCode': item.productCode
        })
      })
      this.$confirm({
        title: '提示',
        content: '已选产品' + obj.length + '项，确认要批量添加吗？',
        centered: true,
        onOk () {
          _this.spinning = true
          allocReturnDetailInsertBatch({
            allocateReturnSn: _this.$route.params.sn,
            detailDtoList: obj
          }).then(res => {
            if (res.status == 200) {
              _this.$refs.table.clearSelected() // 清空表格选中项
              _this.getDetail(true)
              _this.$refs.chooseTable.refresh()
              if (res.data.failMessage.length) {
                _this.showFailMessage(res.data)
              }
            }
            _this.spinning = false
          })
        }
      })
    },
    showFailMessage (data) {
      const h = this.$createElement
      const htmlStr = [h('p', data.message)]
      for (let i = 0; i < data.failMessage.length; i++) {
        htmlStr.push(h('p', data.failMessage[i]))
      }
      this.$info({
        title: '操作提示',
        content: h('div', {}, htmlStr),
        centered: true
      })
    },
    // 修改备注
    handleEditRemark () {
      const _this = this
      const params = _this.basicInfoData
      allocateReturnSave(params).then(res => {
        if (res.status == 200) {
          _this.$message.success(res.message)
          _this.getDetail(true)
        } else {
          _this.spinning = false
        }
      })
      _this.editRemark = false
    },
    // 修改仓库
    updateWarehouse(warehouseSn){
      this.basicInfoData.warehouseSn = warehouseSn
      this.handleEditRemark()
    },
    // 修改调拨类型
    changeAllocateType (val, opt) {
      console.log(val, opt, '------------')
      const _this = this
      this.allocateTypeVal = val
      this.basicInfoData.costTypeSn = val[0] ? val[0] : ''
      this.basicInfoData.allocateSortSn = val[1] ? val[1] : ''
      this.basicInfoData.allocateReturnTypeSn = val[2] ? val[2] : ''
      // 名称
      this.basicInfoData.costTypeName = opt[0] ? opt[0].name : ''
      this.basicInfoData.allocateSortName = opt[1] ? opt[1].name : ''
      this.basicInfoData.allocateReturnTypeName = opt[2] ? opt[2].name : ''
      this.$confirm({
        title: '提示',
        content: '确定要更改调拨退货类型吗？',
        centered: true,
        onOk () {
          _this.handleEditRemark()
        },
        onCancel () {
          _this.getDetail(true)
        }
      })
    },
    //  重置
    resetSearchForm () {
      this.queryParam.productCode = ''
      this.queryParam.productName = ''
      this.queryParam.allocateNo = ''
      this.$refs.table.refresh(true)
      this.$refs.table.clearSelected() // 清空表格选中项
    },
    // 双击快速添加
    handleClickRow (record) {
      return {
        on: {
          dblclick: (event) => {
            if (record.refundableQty) {
              this.handleAdd(record)
            }
          }
        }
      }
    },
    // // 导入产品
    // handleGuideOk (obj) {
    //   allocateBillBatchInsert(obj).then(res => {
    //     if (res.status == 200) {
    //       this.$refs.chooseTable.refresh(true)
    //     }
    //   })
    // },
    // 已选产品  重置
    chooseResetSearchForm () {
      this.chooseQueryParam.productCode = ''
      this.chooseQueryParam.productName = ''
      this.$refs.chooseTable.refresh(true)
    },
    //  添加/编辑
    handleAdd (row, isEdit, isRefresh) {
      const params = {
        allocateReturnSn: this.$route.params.sn,
        productSn: row.productSn,
        cost: row.cost,
        returnQty: row.returnQty,
        price: isEdit ? row.price : row.returnPrice,
        allocateNo: row.allocateNo,
        allocateSn: row.allocateSn
      }
      const fun = isEdit ? allocReturnDetailUpdate : allocReturnDetailInsert
      if (isEdit) { // 编辑
        if (!row.price) {
          row.price = row.oldPrice
          return
        }
        params.oldPrice = row.oldPrice
      } else {
        params.oldPrice = row.oldPrice
      }

      this.spinning = true
      fun(params).then(res => {
        if (res.status == 200) {
          this.getDetail(true)
          this.$message.success(res.message)
          if (isRefresh != 'noRefresh') {
            this.$refs.table.refresh()
          }
          this.$refs.chooseTable.refresh()
          this.spinning = false
        } else {
          this.spinning = false
          row.price = row.oldPrice
        }
      })
    },
    //  删除
    handleDel (row, isAll) {
      const _this = this
      const content = isAll ? '删除后不可恢复，确定要进行整单删除吗？' : '删除后不可恢复，确定要进行删除吗？'
      this.$confirm({
        title: '提示',
        content: content,
        centered: true,
        onOk () {
          if (isAll) { //  整单删除
            // allocReturnDetailDeleteAll({ sn: _this.$route.params.sn }).then(res => {
            //   if (res.status == 200) {
            //     _this.$message.success(res.message)
            //     _this.refashPage()
            //   }
            // })
          } else { //  单个删除
            allocReturnDetailDelete({
              allocateReturnSn: _this.$route.params.sn,
              allocateDetailSn: row.allocateDetailSn,
              price: row.price,
              productSn: row.productSn }).then(res => {
              if (res.status == 200) {
                _this.$message.success(res.message)
                _this.refashPage()
              }
            })
          }
        }
      })
    },
    //  提交
    handleSubmit () {
      const _this = this
      if (this.localDataSource.length == 0) {
        _this.$message.error('请先选择产品！')
        return
      }
      _this.spinning = true
      allocateReturnSubmit({ allocateReturnSn: this.$route.params.sn }).then(res => {
        if (res.status == 200) {
          this.$message.success(res.message)
          setTimeout(() => {
            _this.handleBack()
            _this.spinning = false
          }, 1000)
        } else {
          _this.spinning = false
        }
      })
    },
    // 基本信息
    getDetail (flag) {
      this.spinning = true
      allocateReturnQueryBySn({ allocateReturnSn: this.$route.params.sn }).then(res => {
        if (res.status == 200) {
          this.basicInfoData = res.data
          if (this.basicInfoData.costTypeSn) {
            this.allocateTypeVal = [this.basicInfoData.costTypeSn, this.basicInfoData.allocateSortSn, this.basicInfoData.allocateReturnTypeSn]
          }
          if (!flag) {
            this.resetSearchForm()
          }
        } else {
          this.basicInfoData = null
        }
        this.spinning = false
      })
    },
    //  返回列表
    handleBack () {
      this.$router.push({ name: 'transferReturnList', query: { closeLastOldTab: true } })
    },
    // 已选产品 退货单价  change
    priceChange (val, record) {
      //  光标移出，值发生改变再调用编辑接口
      if (Number(val) != Number(record.oldPrice)) {
        this.handleAdd(record, true, 'noRefresh')
      }
    },
    // 刷新当前页面
    refashPage () {
      this.getDetail(true)
      this.$refs.table.refresh()
      this.$refs.chooseTable.refresh()
    },
    pageInit () {
      this.getDetail()
      this.chooseResetSearchForm()
    }
  },
  mounted () {
    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
      this.pageInit()
    }
  },
  activated () {
    // 如果是新页签打开或者进入新的子页（例：存在列表第2条数据编辑页页签时再打开第4条数据的编辑页），则重置当前页面
    if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
      this.pageInit()
    }
  },
  beforeRouteEnter (to, from, next) {
    next(vm => {})
  }
}
</script>

<style lang="less">
  .editGrap-wrap{
    position: relative;
    height: 100%;
    box-sizing: border-box;
    >.ant-spin-nested-loading{
      overflow-y: scroll;
      height: 100%;
      padding-bottom: 51px;
    }
    .editGrap-back{
      margin-bottom: 10px;
    }
    .editGrap-cont{
      margin-bottom: 10px;
      .sub-title{
        font-size: 12px;
        color: #808695;
        margin-left: 10px;
      }
      .tag-txt{
        font-size: 12px;
        color: #ed1c24;
      }
      .edit-circle-btn{
        margin-left: 15px;
        i{
          vertical-align: text-bottom;
        }
      }
      .import-btn{
        margin-left: 15px;
      }
    }
  }
  .allocateBill-editRemark-modal{
    .btn-cont{
      text-align: center;
      padding-top: 20px;
    }
  }
</style>
