<template>
  <div class="view-CarrierListMachineryPreparation-s">
    <div class="view-AerospaceCompileLineList-right-summarizing">
      <!-- 通用代码 左侧按钮 右侧输入框 下拉框 -->
      <div class="view-common-header">
        <!-- 占据左侧位置 -->
        <div class="view-common-header-left"></div>
        <div class="view-common-header-right">
          <el-input @keyup.enter.native="fetchTableData('search')" placeholder="请输入内容" v-model="searchValue" class="input-select">
            <el-button @click="fetchTableData('search')" slot="append" icon="el-icon-search"></el-button>
          </el-input>
        </div>
      </div>
      <LTable ref="table" :defaultFetch="false" :columns="columns" :dataSource="tableData" :options="options" :fetch="fetchTableData" :pagination="tableRequset"></LTable>
    </div>
  </div>
</template>

<script>
import { columns, options } from './index'
import { queryCarryingMainteOrgan } from '@/api/task/carrierFlightMission'

export default {
  name: 'CarrierSummarizing',
  components: {},
  data() {
    // 这里存放数据
    return {
      searchValue: '',
      columns: columns(this),
      options,
      tableData: [],
      tableRequset: {
        total: 0,
        pageIndex: 1,
        pageSize: 10,
        searchValue: ''
      }
    }
  },
  mounted() {
    this.fetchTableData()
  },
  methods: {
    async fetchTableData(search) {
      let postData = {
        pageSize: this.tableRequset.pageSize,
        pageIndex: search ? 1 : this.tableRequset.pageIndex,
        taskId: this.$route.params.id,
        queryParam: this.searchValue,
        avmatType: 1
      }
      const { code, data } = await queryCarryingMainteOrgan(postData)
      if (code == 200) {
        this.tableData = data.list
        this.tableRequset.total = data.totalCount
      }
    }
  }
}
</script>

<style lang="scss">
@import './index.scss';
</style>
