<template>
  <!-- 修试审核 -->
  <div class="app-container">
    <PageHeaderApply
      v-if="isShowComponent != 'Home'"
      :pageContent="pageContent"
      @goBack="goBack"
    />
    <keep-alive include="Home">
    <component
       ref="componentRef"
      :is="isShowComponent"
      :isEdit="isEdit"
      :editTaskId="editTaskId"
      :editId="editId"
      :queryTaskId="queryTaskId"
      :queryId="queryId"
      :param="param"
      :isView="isView"
      :codingTaskId="codingTaskId"
      @addTools="addTools" 
      @queryTools="queryTools"
    />
    </keep-alive>
  </div>
</template>

<script>
import PageHeaderApply from "@/components/pageHeaderApply";
import Home from "./component/homeApply.vue"; // 主列表
import AddTools from "./component/addToolsApply.vue"; // 新增机具 和 修改机具
import QueryTools from "./component/queryToolsApply.vue"; // 查询机具 和 验收机具
export default {
  name: "TestExamine",
  components: {
    Home,
    PageHeaderApply,
    AddTools,
    QueryTools,
  },
  data() {
    return {
      isShowComponent: "Home",
      pageContent: "",
      isEdit: false,
      editTaskId: "",
      editId: "",
      queryId: "",
      queryTaskId: "",
      param: {},
      isView: false,
      codingTaskId: "",
    };
  },

  methods: {
    /* 编辑工机具 */
    addTools(taskId, id,row) {
      this.isEdit = true;
      this.pageContent = "审核";
      this.queryTaskId = taskId;
      this.queryId = id;
      this.param = row;
      this.isShowComponent = "AddTools";
    },
    /* 查询工机具 */
    queryTools(taskId, id, row) {
      this.isView = true;
      this.pageContent = "详情信息";
      this.queryTaskId = taskId;
      this.queryId = id;
      this.param = row;
      this.isShowComponent = "QueryTools";
    },
    /* 返回按钮 */
    goBack() {
      this.isShowComponent = "Home";
    },
  },
};
</script>
