index.vue 2.89 KB
<template>
<div style="margin:40px" class="app-container"> 
  <el-form :inline="true" :model="queryParams" class="demo-form-inline" size="small">
    <el-form-item label="航班号">
      <el-input v-model="queryParams.purposeOfFlightNo" placeholder="航班号"></el-input>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" icon="el-icon-search" @click="getList" size="mini">查询</el-button>
    </el-form-item>
  </el-form>
  <el-button style="margin-bottom:20px" type="primary" icon="el-icon-plus" size="mini">添加</el-button>
  <el-table
    :data="flyList"
    style="width: 800px"
     v-loading="loading" size="small"
    >
    <el-table-column prop="purposeOfFlightNo" label="航班号" align="center"></el-table-column>
    <el-table-column label="操作" prop="id" align="center">
       <template slot-scope="scope" >
        <el-button type="text" size="mini" icon="el-icon-view"  @click="handleClick(scope.row.id, 'detail')">查看</el-button>
        <el-button type="text" size="mini" icon="el-icon-edit" @click="handleClick(scope.row.id, 'update')">修改</el-button>
        <el-button type="text" size="mini" icon="el-icon-delete">删除</el-button>
        <el-button type="text" size="mini" icon="el-icon-video-play">启用</el-button>
        <el-button type="text" size="mini" icon="el-icon-video-pause">停用</el-button>
      </template>
    </el-table-column>
  </el-table>
  <el-pagination
      @size-change="getList"
      @current-change="getList"
      :current-page.sync="curPage"
      :page-sizes="[10, 20, 30, 40]"
      :page-size.sync="limit"
      layout="prev, pager, next, jumper, sizes, total"
      :total="total"
      background
      :hide-on-single-page="true"
      style="margin-top:40px; text-align:right">
  </el-pagination>
</div>
</template>

<script>
  import {
  	findFlightNo
  } from "@/api/destinationFlight";

  export default {
    data() {
      return {
        queryParams: {
          purposeOfFlightNo: '',
          start:0,
          limit:10
        },
        flyList:[],
        curPage:1,
        limit:10,
        total:0,
        loading:false,
      }
    },
    methods: {
      getList(){
        this.queryParams.limit = this.limit;
        if (this.curPage > 1) {
          this.queryParams.start = (this.curPage - 1) * this.queryParams.limit
        }else {
          this.queryParams.start = 0;
        }
        this.loading = true;
        findFlightNo(this.queryParams).then(response => {
        this.flyList = response.data.list;
        this.total = response.data.totalCount;
        this.loading = false;
      });
      },
      //跳转到查看,修改页面
      handleClick(flightiId, handle){
        this.$router.push({ name: 'info', params: { handle: handle, id:flightiId }});
      },
      //删除,启用,停用
      changeStatus(id, handle){
        
      }
    },
    created() {
      this.getList();
    }
  }
</script>