agentSplit.vue 6.96 KB
<template>
  <d2-container>
    <el-card shadow="never">
      <el-form :inline="true" :model="formInline" class="demo-form-inline" size="small">
        <el-form-item label="客户">
          <el-input v-model="formInline.customerName" placeholder="请输入客户编码/客户名称" />
        </el-form-item>
        <el-form-item label="物料">
          <el-input v-model="formInline.materialName" placeholder="请输入物料编码/物料名称" />
        </el-form-item>
        <el-form-item label="销售组">
          <el-input v-model="formInline.saleGroupName" placeholder="请输入销售编码/销售名称" />
        </el-form-item>
        <el-form-item label="月份">
          <el-date-picker
            v-model="registerDate"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            value-format="yyyy-MM-dd"
          />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" :loading="tableLoading" @click="getList()">搜索</el-button>
        </el-form-item>
      </el-form>
    </el-card>

    <!-- 表格区域 开始 -->
    <div class="table_box">
      <el-table v-loading="tableLoading" :data="tableData" stripe style="width: 100%" size="small" border>
        <el-table-column type="index" :index="index => {return index+1}" label="序号" width="80" />
        <el-table-column prop="billTypeCode" label="单据编码" :width="tdWidth" />
        <el-table-column prop="billTypeName" label="单据名称" :width="tdWidth" />
        <el-table-column prop="billNumber" label="单据编号" :width="tdWidth" />
        <el-table-column prop="time" label="日期" :width="tdWidth">
          <template slot-scope="scope">{{ DATEFORMATE(scope.row.time, 'YYYY-MM') }}</template>
        </el-table-column>
        <el-table-column prop="salesCode" label="销售组织编码" :width="tdWidth" />
        <el-table-column prop="salesName" label="销售组织名称" :width="tdWidth" />
        <el-table-column prop="customerCode" label="客户编码" :width="tdWidth" />
        <el-table-column prop="customerName" label="客户名称" :width="tdWidth" />
        <el-table-column prop="saleGroupCode" label="销售组编码" :width="tdWidth" />
        <el-table-column prop="saleGroupName" label="销售组名称" :width="tdWidth" />
        <el-table-column label="间隔列" :width="tdWidth" />
        <el-table-column prop="statementCurrencyCode" label="结算币别编码" :width="tdWidth" />
        <el-table-column prop="statementCurrencyName" label="结算币别名称" :width="tdWidth" />
        <el-table-column label="间隔列" :width="tdWidth" />
        <el-table-column prop="materialCode" label="物料编码" :width="tdWidth" />
        <el-table-column prop="materialName" label="物料名称" :width="tdWidth" />
        <el-table-column prop="salesUnitCode" label="销售单位编码" :width="tdWidth" />
        <el-table-column prop="salesUnitName" label="销售单位名称" :width="tdWidth" />
        <el-table-column prop="salesQuantity" label="销售数量" :width="tdWidth" />
        <el-table-column prop="price" label="含税单价" :width="tdWidth" />
        <el-table-column prop="gift" label="是否赠品" :width="tdWidth" />
        <el-table-column prop="taxRate" label="税率%" :width="tdWidth" />
        <el-table-column prop="takeGoodsDate" label="要货日期" :width="tdWidth" />
        <el-table-column prop="statementOrganizeCode" label="结算组织编码" :width="tdWidth" />
        <el-table-column prop="statementOrganizeName" label="结算组织名称" :width="tdWidth" />
        <el-table-column prop="reserveType" label="预留类型" :width="tdWidth" />
        <el-table-column prop="warehouseCode" label="发货仓库编码" :width="tdWidth" />
        <el-table-column prop="warehouseName" label="发货仓库名称" :width="tdWidth" />
        <el-table-column label="间隔列" :width="tdWidth" />
        <el-table-column prop="quantity" label="(交货明细)数量" :width="tdWidth" />
      </el-table>
      <div class="pagination_list">
        <el-pagination
          background
          layout="sizes, total,prev, pager, next, jumper"
          :total="pageTotal"
          :page-size="pageSize"
          :page-sizes="pageSizes"
          @current-change="getList"
          @size-change="changePageSize"
        />
      </div>
    </div>
    <!-- 表格区域 end -->

  </d2-container>
</template>

<script>
import {
  GETLISTSTATEMENTCOLLECTIONSPLIT,
  GETDEVICETYPE
} from '@/http/interface'
export default {
  data() {
    return {
      formInline: {},
      tableData: [],
      dialogVisible: false,
      tableLoading: false,
      pageTotal: 0,
      userInfo: {},
      currentPage: 1,
      pageSizes: [10, 20, 30, 40],
      pageSize: 10,
      registerDate: [],
      tdWidth: 170,
      DATEFORMATE: str => {
        return this.$Util.dateFormate(str)
      },
      deviceTypeList: []
    }
  },
  created() {

  },

  mounted: function() {
    this.getList()
    this.getDeviceList()
  },
  methods: {

    /**
       * 查询列表
       */
    getList: function(current) {
      const _this = this
      const oParams = _this.getParams()
      console.log(current)
      oParams.pageNum = current || _this.currentPage
      _this.tableLoading = true
      GETLISTSTATEMENTCOLLECTIONSPLIT(oParams).then(res => {
        console.log(res)
        _this.tableLoading = false
        if (res.returnCode == 0) {
          const {
            data
          } = res
          const {
            total,
            list
          } = data
          _this.tableData = list || []
          _this.pageTotal = total
        }
      })
    },

    /**
       * 获取查询参数
       */
    getParams: function() {
      const n = this.formInline
      const m = this.registerDate
      let oParams = {}
      if (m && m.length > 0) {
        n.startDate = m[0]
        n.endDate = m[1]
      } else {
        delete n.startDate
        delete n.endDate
      }

      if (n.customerName) {
        n.customerCode = n.customerName
      } else {
        delete n.customerCode
      }

      if (n.saleGroupName) {
        n.saleGroupCode = n.saleGroupName
      } else {
        delete n.saleGroupCode
      }

      if (n.materialName) {
        n.materialCode = n.materialName
      } else {
        delete n.materialCode
      }

      oParams.condition = n
      oParams.pageSize = this.pageSize
      return oParams
    },

    /**
       * 每页展示
       */
    changePageSize: function(e) {
      this.pageSize = e
      this.getList()
    },

    /**
       * 获取设备类型列表
       */
    getDeviceList: function() {
      const _this = this
      GETDEVICETYPE().then(res => {
        const {
          data
        } = res
        _this.deviceTypeList = data || []
      })
    }

  }

}
</script>

<style lang="scss" scoped>
  .table_box {
    margin: 20px 0;
  }
  .line{
    text-align:center !important;
  }
</style>