<template>
  <div>
    <addorderline :sys_enterpriseid="sys_enterpriseid"></addorderline>
    <el-table :data="list" size="mini" border>
      <el-table-column prop="sonum" label="订单号"></el-table-column>
      <el-table-column prop="enterprisename" label="企业名称"></el-table-column>
      <el-table-column prop="remarks" label="备注"></el-table-column>
      <el-table-column label="操作" width="90">
        <template slot-scope="scope">
          <el-button size="small" type="text" @click="createDispatch(scope.row)">选择</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div class="container" style="text-align:right">
      <el-pagination
        background
        small
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-sizes="[20, 50, 100, 200]"
        layout="total,sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
  </div>
</template>

<script>
import addorderline from './addorderline.vue'
export default {
  props:['sys_enterpriseid'],
  components:{
    addorderline
  },
  data () {
    return {
      list:[],
      param:{
        "id": "20221217091303",
        "content": {
          "sa_invoiceapplyid":0,
          "where":{
            "condition":""
          }
        }
      },
      list:[],
      total:0,
      currentPage:0
    }
  },
  methods:{
    async listData () {
      this.param.content.sa_invoiceapplyid = this.$route.query.id
      const res = await this.$api.requested(this.param)
      this.list = res.data
      this.total = res.total
      this.currentPage = res.pageNumber
    },
    handleSizeChange(val) {
      // console.log(`每页 ${val} 条`);
      this.param.content.pageSize = val
      this.listData()
    },
    handleCurrentChange(val) {
      // console.log(`当前页: ${val}`);
      this.param.content.pageNumber = val
      this.listData()
    },
  },
  mounted () {
    this.listData()
  }
}

</script>
<style>
</style>