<template>
  <div> 
    <el-dialog :visible.sync="visible" append-to-body width="70%">
      <div class="flex-align-center flex-between mt-10">
        <el-input style="width:200px" size="small"  suffix-icon="el-icon-search" v-model="param.content.where.condition" placeholder="搜索" @keyup.enter.native="listData(param.content.pageNumber = 1)" @clear="listData(param.content.pageNumber = 1)" clearable></el-input>
      </div>
      <div>
        <el-table
          ref="multipleTable"
          :data="tableData"
          style="width: 100%"
          size="mini"
          height="50vh"
          border>
          <el-table-column
            prop="billno"
            label="工单号"
            width="180">
          </el-table-column>
          <el-table-column
            prop="projectleader"
            label="工单负责人"
            width="180">
          </el-table-column>
          <el-table-column
            label="省市县">
            <template slot-scope="scope">
              {{scope.row.province}}-{{scope.row.city}}-{{scope.row.county}}
            </template>
          </el-table-column>
          <el-table-column
            prop="address"
            label="地址">
          </el-table-column>
          <el-table-column
            prop="startdate"
            label="需求服务开始时间"
            width="180">
          </el-table-column>
          <el-table-column
            prop="enddate"
            label="需求服务结束时间"
            width="180">
          </el-table-column>
        </el-table>
        <div style="margin-top:16px;text-align:right">
          <el-pagination
            background
            small
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage"
            :page-size="param.content.pageSize"
            layout="total, prev, pager, next, jumper"
            :total="total">
          </el-pagination>
        </div>
      </div>
    </el-dialog>
    <el-button type="primary" size="mini" @click="visible=true">进 度</el-button>
  </div>
</template>

<script>
export default {
  props:[],
  data () {
    return {
      visible:false,
      param:{
        "id": "20230208140203",
        "version":1,
        "content": {
          "pageSize":20,
          "pageNumber":1,
            "where":{
                "condition":""
            }
        }
      },
      tableData: [],
      total:0,
      currentPage:0
    }
  },
  methods:{
    async listData () {
      const res = await this.$api.requested(this.param)
      this.tableData = res.data
      this.total = res.total
      this.currentPage = res.pageNumber
      console.log(this.tableData);
      
    },
    handleSizeChange(val) {
      // console.log(`每页 ${val} 条`);
      this.param.content.pageSize = val
      this.listData()
    },
    handleCurrentChange(val) {
      // console.log(`当前页: ${val}`);
      this.param.content.pageNumber = val
      this.listData()
    }
  },
  created () {
    this.listData()
  },
}

</script>
<style>
</style>