<template>
  <div class='dfmea-page-tabs-content'>
    <a-tabs style="background-color:#fff;" :activeKey="tabKey" @change="tabChange">
      <!-- 统计分析 -->
      <a-tab-pane :tab="$t('functional-analysis.top-btn.statistical-analysis')" key="statisticalAnalysis">
        <StatisticalAnalysis ref="statisticalAnalysis"></StatisticalAnalysis>
      </a-tab-pane>
      <!-- 帕累托分析 -->
      <a-tab-pane :tab="$t('functional-analysis.top-btn.pareto-analysis')" key="paretoAnalysis">
        <ParetoAnalysis ref="paretoAnalysis" />
      </a-tab-pane>
      <!-- 区间统计 -->
      <a-tab-pane :tab="$t('functional-analysis.top-btn.interval-statistics')" key="intervalStatistics">
        <IntervalStatistics ref="intervalStatistics"></IntervalStatistics>
      </a-tab-pane>
      <!-- 风险矩阵 -->
      <a-tab-pane :tab="$t('functional-analysis.top-btn.risk-matrix')" key="riskMatrix">
        <RiskMatrix ref="riskMatrix"></RiskMatrix>
      </a-tab-pane>
      <!-- 特性清单 -->
      <a-tab-pane :tab="$t('summary-archive.feature-list')" key="featureList">
        <FeatureList ref="featureList" />
      </a-tab-pane>
      <!-- 功能清单 -->
      <a-tab-pane :tab="$t('summary-archive.function-list')" key="functionList">
        <FunctionList ref="functionList" />
      </a-tab-pane>
      <!-- 失效清单 -->
      <a-tab-pane :tab="$t('summary-archive.invalid-list')" key="invalidList">
        <InvalidList ref="invalidList" />
      </a-tab-pane>
      <!-- DVP -->
      <!-- <a-tab-pane :tab="$t('measure-track.dvp-table')" key="DVP">
        <DVP ref="DVP" />
      </a-tab-pane> -->
      <!-- DAP -->
      <!-- <a-tab-pane :tab="$t('measure-track.dap-table')" key="DAP">
        <DAP ref="DAP" />
      </a-tab-pane> -->
      <!-- DRBFM -->
      <!-- <a-tab-pane :tab="$t('summary-archive.drbfm')" key="DRBFM">
        <DRBFM ref="DRBFM" />
      </a-tab-pane> -->
      <!-- FMEA表格 -->
      <a-tab-pane :tab="$t('summary-archive.fmea-table')" key="fmeaTable">
        <FmeaTable ref="fmeaTable" />
      </a-tab-pane>
      <!-- 设备点检表 -->
      <a-tab-pane :tab="$t('summary-archive.inspection-table')" key="inspectionTable">
        <InspectionTable ref="inspectionTable" />
      </a-tab-pane>
      <!-- <a-tab-pane :tab="$t('summary-archive.maturity-evaluation')" key="MaturityTable">
        <MaturityEvaluation ref="maturity" />
      </a-tab-pane> -->
    </a-tabs>
  </div>
</template>

<script>

import StatisticalAnalysis from "./components/StatisticalAnalysis";
import ParetoAnalysis from "./components/ParetoAnalysis";
import IntervalStatistics from "./components/IntervalStatistics";
import RiskMatrix from "./components/RiskMatrix";
import FeatureList from "./components/FeatureList";
import DRBFM from "./components/DRBFM";
import FmeaTable from "./components/FmeaTable";
import InspectionTable from "./components/InspectionTable";
import FunctionList from "./components/FunctionList";
import InvalidList from "./components/InvalidList"
import MaturityEvaluation from "./components/MaturityEvaluation";
import DVP from "./components/DVP";
import DAP from "./components/DAP";

export default {
  components: {
    StatisticalAnalysis,
    ParetoAnalysis,
    IntervalStatistics,
    RiskMatrix,
    FeatureList,
    FunctionList,
    InvalidList,
    DRBFM,
    FmeaTable,
    InspectionTable,
    MaturityEvaluation,
    DVP,
    DAP
  },
  data() {
    return {
      /** 默认选项卡 */
      tabKey: "statisticalAnalysis",
    };
  },
  created() {
    // 储存fmeaId
    this.$store.dispatch("fmeaTree/set", {
      key: "fmeaId",
      value: this.$route.query.fmeaId
    });
    // 储存rfmeaId
    this.$store.dispatch("fmeaTree/set", {
      key: "rfmeaId",
      value: this.$route.query.rfmeaId
    });
    this.$com.setCookie("from", this.$route.query.from);
  },
  mounted() {
    // 统计帕累托分析、区间统计的数据
    this.faultStatisticalAnalysis();
  },
  computed: {},
  methods: {
    /**
     * 选项卡切换事件
     * @param activeKey 选项卡Key
     */
    tabChange(activeKey) {
      this.tabKey = activeKey;
    },
    // 统计帕累托分析和区间统计数据
    faultStatisticalAnalysis() {
      let _that = this;
      _that.$api.faultStatisticalAnalysis({
        fmeaId: _that.$store.getters.rfmeaId,
      }).then(res => {
      }).catch(error => {
        _that.$message.error(error.response.data.message, 1);
      });
    },
  }
};
</script>

<style lang="less" scoped>
.ant-pro-basicLayout-content {
  margin: 10px;
}

/deep/ .ant-tabs-bar {
  margin: 0 0 0px 0;
}

/deep/ .ant-card {
  border-radius: 10px;
}
</style>
