index.vue 2.26 KB
<template>
  <div class="StInventoryAccountDetail">
    <div class="sub-title sub-title-fix">库存详情</div>
    <dee-up-table
      v-if="show"
      :pagination="pagination"
      :columns="parentColumns"
      :data="tableData"
      :options="options"
      @pagination-current-change="onPageIndexChange"
    />
  </div>
</template>

<script>
import _get from 'lodash.get'
import columns from './columns'
import { post } from '@/utils/http'
export default {
  name: 'StInventoryAccountDetail',
  componentName: '库存台账详情',
  mixins: [columns],
  data() {
    return {
      emitMethods: [
        {
          methods: 'getData',
          methodsName: '获取列表数据'
        }
      ],
      pagination: {
        currentPage: 1,
        pageSize: 20,
        total: 0,
        pageSizes: [20, 50, 100]
      },
      tableData: [],
      currentRow: {},
      show: false,
      options: {
        rowKey: 'dxStLocationId'
      }
    }
  },
  computed: {
    tableQueryParams() {
      return {
        pageFrom: this.pagination.currentPage,
        pageSize: this.pagination.pageSize
      }
    }
  },
  methods: {
    getData(params) {
      if (!params) {
        this.pagination.total = 0
        this.tableData = []
        return
      }
      this.show = false
      this.$nextTick(() => {
        this.show = true
      })
      this.currentRow = params
      this.pagination.currentPage = 1
      this.getTableData()
    },
    getTableData() {
      const url = 'DxStInventoryAccount/getInventoryDetails'
      const params = Object.assign({}, this.tableQueryParams, {
        dxResNumber: this.currentRow.dxResNumber,
        dxStHouseId: this.currentRow.dxStHouseId
      })
      post(url, params).then((res) => {
        this.pagination.total = _get(res, 'items.totalElements', 0)
        this.tableData = _get(res, 'items.content', [])
      })
    },
    onPageIndexChange(pageIndex) {
      this.getTableData()
    }
  }
}
</script>

<style lang="scss">
.StInventoryAccountDetail{
  margin-top: 8px;
.sub-title-fix{
    margin-left: 8px;
    margin-bottom: 8px;
    padding-top: 0px;
    padding-bottom: 0px;
    font-size: 16px;
  }
}
.StInventoryAccountDetail>.dee-up-table{
  height: calc(100% - 32px);
  .el-table__body-wrapper{
    overflow: auto;
  }
}

</style>