<template>
  <div class="view-CarrierListMachineryPreparation">
    <div class="view-AerospaceCompileLineList-right-carrierAllAuditLook">
      <MissionDetail :detail="detail" />
      <div class="view-AerospaceCompileLineList-right-carrierAllAuditLook-btn">
        <div class="view-AerospaceCompileLineList-right-carrierAllAuditLook-btn-right">
          <el-input placeholder="请输入内容" @keyup.enter.native="getqueryCarryingMainteOrgan('searchValue')" v-model="searchValue" class="input-with-select">
            <el-button @click="getqueryCarryingMainteOrgan('searchValue')" slot="append" icon="el-icon-search"></el-button>
          </el-input>
        </div>
      </div>

      <div class="view-AerospaceCompileLineList-right-carrierAllAuditLook-table">
        <el-table :data="tableData" border style="width: 100%">
          <el-table-column prop="avmatCatalogCode" label="航材编码"> </el-table-column>
          <el-table-column prop="avmatCatalogName" label="航材名称" align="center"> </el-table-column>
          <el-table-column prop="specification" label="航材型号" align="center"> </el-table-column>
          <el-table-column prop="avmatCategoriesName" label="航材分类" align="center"> </el-table-column>
          <el-table-column prop="unit" label="计量单位" align="center"> </el-table-column>
          <el-table-column prop="carryQuantity" label="携总带数量" align="center"> </el-table-column>
          <el-table-column prop="purchasePrice" label="单价/元" align="center"> </el-table-column>
          <el-table-column prop="createBy" label="创建人" align="center"> </el-table-column>
          <el-table-column prop="updateTime" label="更新时间" align="center"> </el-table-column>
        </el-table>
      </div>
      <el-pagination
        background
        :total="pagination.total"
        :page-size="pagination.pageSize"
        :page-sizes="[10, 20, 30, 40, 50]"
        layout="sizes,total, prev, pager, next, jumper"
        @size-change="handleSizeChange"
        @current-change="handleIndexChange"
        style="padding: 20px; text-align: center"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>
import { fjList, tableData } from './index'
import { queryFlyTaskAircraft, queryCarryingMainteOrgan } from '@/api/carrierStandard/carrierListMachineryPreparation'
export default {
  name: 'carrierAllAuditLook',
  components: {},
  data() {
    // 这里存放数据
    return {
      fjdialogVisible: false,
      detail: null,
      taskId: this.$route.params.id,
      fjValue: '',
      fjList: fjList,
      searchValue: '',
      modelValue: '战斗机',
      tableData: tableData,
      pagination: {
        total: 100,
        pageSize: 10,
        pageIndex: 1
      }
    }
  },
  mounted() {
    this.initData()
  },
  methods: {
    async initData() {
      let postData = {
        taskId: this.taskId
      }
      const { code, data } = await queryFlyTaskAircraft(postData)
      if (code == 200) {
        this.detail = data
        this.getqueryCarryingMainteOrgan()
        this.$store.commit('app/updataTagsItemMetaTitle', { id: this.$route.params.id, otherTitle: '机务清单总体审核-查看详情', newTitle: `机务清单总体审核-查看详情-${this.detail.taskName}` })
      }
    },
    async getqueryCarryingMainteOrgan(searchValue) {
      searchValue ? (this.pagination.pageIndex = 1) : (this.pagination.pageIndex = this.pagination.pageIndex)
      let postData = {
        pageIndex: this.pagination.pageIndex,
        pageSize: this.pagination.pageSize,
        queryParam: this.searchValue,
        taskId: this.taskId,
        avmatType: '0'
      }
      const { code, data } = await queryCarryingMainteOrgan(postData)
      if (code == 200) {
        this.tableData = data.list
        this.pagination.total = data.totalCount
      }
    },
    handleIndexChange(val) {
      this.pagination.pageIndex = val
      this.getqueryCarryingMainteOrgan()
    },
    handleSizeChange(val) {
      this.pagination.pageSize = val
      this.getqueryCarryingMainteOrgan()
    }
  }
}
</script>

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