<template>
  <div>
    <el-dialog class="structureEquipping-modal" title="航材" :visible="structureEquippingVisible" width="600px" :before-close="closeStructureEquipping">
      <div class="structureEquipping-list">
        <label>飞机编号</label>
        <el-input v-model="activeRow.aircraftNumber" placeholder="请选择编号" disabled></el-input>
        <el-button type="primary" @click="openFittingsModal">选择编号</el-button>
      </div>
      <div class="structureEquipping-list">
        <label>所属机型</label>
        <el-input v-model="activeRow.aircraftSpeciesName" placeholder="请输入所属机型" disabled></el-input>
      </div>
      <div class="structureEquipping-list">
        <label>飞行时长</label>
        <el-input v-model="activeRow.flyingDuration" placeholder="请输入飞行时长"></el-input>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="closeStructureEquipping">取 消</el-button>
        <el-button type="primary" @click="handleStructureEquipping">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog class="fittings-modal" title="选择航材" :visible="fittingsVisible" width="1200px" :before-close="closefittingsVisible">
      <div class="fittings-modal-box">
        <div class="fittings-modal-box-left">
          <MenuTree :currentNodeKey="currentNodeKey" :treedata="menuTreeData" @TreeNodeclick="treeNodeClick" v-bind="treeObj"> </MenuTree>
        </div>
        <div class="fittings-modal-box-right">
          <LTable ref="table" :defaultFetch="false" :columns="columns" :dataSource="tableData" :options="options" :fetch="fetchTableData" :pagination="tableRequset"></LTable>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { defaultProps, mockMenuTreeData, tableData, columns, options } from './index'
export default {
  name: 'StructureEquipping',
  props: {
    structureEquippingVisible: {},
    closeStructureEquipping: {}
  },
  components: {},
  data() {
    // 这里存放数据
    return {
      fittingsVisible: false,
      currentNodeKey: '',
      menuTreeData: mockMenuTreeData,
      treeObj: {
        title: '所属分类',
        activityheight: '500px',
        searchIcon: false,
        configure: defaultProps
      },
      tableData: tableData,
      columns: columns(this),
      options,
      tableRequset: {
        total: 0,
        pageIndex: 1,
        pageSize: 10,
        searchValue: ''
      },
      activeRow: {
        aircraftNumber: '',
        aircraftSpeciesName: '',
        flyingDuration: ''
      }
    }
  },
  mounted() {},
  methods: {
    handleClose() {},
    closefittingsVisible() {
      this.fittingsVisible = false
      this.activeRow = {
        equipmentName: '',
        serialNumber: '',
        aircraftSpeciesName: '',
        sparePartsNumber: '',
        sparePartsType: ''
      }
    },

    handleFittingsVisible() {
      this.fittingsVisible = false
    },
    handleStructureEquipping() {
      this.$emit('handleStructureEquipping', this.activeRow)
    },

    openFittingsModal() {
      this.fittingsVisible = true
    },
    treeNodeClick(data) {
      this.$refs.table.clearSelection()
      this.fetchTableData()
    },
    fetchTableData() {},
    select(row) {
      this.activeRow = row
      this.fittingsVisible = false
    }
  }
}
</script>

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