<template>
  <div>
    <List></List>
    <ControlPanel v-if="hangar && showPanel"></ControlPanel>
  </div>
</template>

<script>
import { mapState } from "vuex";
import List from "./components/list";
import ControlPanel from "./components/controlPanel";
import linkFusion from "./mixins/linkFusion";

export default {
  name: "Hangar",
  mixins: [linkFusion],
  components: {
    List,
    ControlPanel,
  },
  data() {

    return {};
  },
  computed: {
    ...mapState("MMCFlightControlCenter/hangar", ["showPanel", "hangar"]),
    ...mapState("MMCFlightControlCenter/uav", ["uavRealTimeData"]),
  },
  watch: {
    'uavRealTimeData.isFlying'(newVal, oldVal){
      // 监听飞机降落然后进行任务结束的提示
      if(oldVal === true && newVal === false){
        this.$alert('任务结束', '提示', {
          type: 'success ',
          confirmButtonText: '确定',
          callback: action => {
          }
        });
      }
    }
  },
  beforeDestroy() {
    this.$store.commit('MMCFlightControlCenter/setState', {
      key: 'listCollapse',
      value: false
    })
  },
};
</script>

<style>
</style>