<template>
  <!-- 修试入库 -->
  <div class="app-container">
    <PageHeaderApply
      v-if="isShowComponent != 'Home'"
      :pageContent="pageContent"
      @goBack="goBack"
    />
    <component
      :is="isShowComponent"
      :isEdit="isEdit" 
      :isView="isView"
      :queryId="queryId"
      :param="param"
      @editApply="editApply" 
      @queryApply="queryApply"
    />
  </div>
</template>

<script>
import PageHeaderApply from "@/components/pageHeaderApply";
import Home from "./component/home.vue"; // 主列表
import EditApply from "./component/editApply.vue"; // 新增 和 修改
import QueryApply from "./component/queryApply.vue"; // 查看
export default {
  components: {
    Home,
    PageHeaderApply,
    EditApply,
    QueryApply,
  },
  data() {
    return {
      isShowComponent: "Home",
      pageContent: "",
      isEdit: false, 
      editId: "",
      queryId: "", 
      param: {},
      isView: false, 
    };
  },

  methods: {
    /* 编辑 */
    editApply(id,row) {
      this.isEdit = true;
      this.pageContent = "入库明细";
      this.queryId = id;
      this.param = row;
      this.isShowComponent = "EditApply";
    },
    /* 查询 */
    queryApply(id, row) {
      this.isView = true;
      this.pageContent = "详情信息";
      this.queryId = id;
      this.param = row;
      this.isShowComponent = "QueryApply";
    },
    /* 返回按钮 */
    goBack() {
      this.isShowComponent = "Home";
    },
  },
};
</script>
