src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue
@@ -1,21 +1,23 @@
<template>
  <a-tabs v-model="activeTabKey" @contextmenu.native="e=>e.preventDefault()"
          v-if="Object.keys(currentTreeNodeInfo).length!==0">
    <a-tab-pane :key="1" tab="NC文档" v-if="currentTreeNodeInfo.type===5||currentTreeNodeInfo.type===6">
      <NcDocumentTableList ref="ncDocumentTableListRef" :currentTreeNodeInfo="currentTreeNodeInfo"
                           @handleTableContextMenuOpen="handleTableContextMenuOpen" :size="tableContainerSize"/>
    </a-tab-pane>
  <div v-if="currentTreeNodeInfo.type!==4">
    <a-tabs v-model="activeTabKey" @contextmenu.native="e=>e.preventDefault()" @change="handleTabChange"
            v-if="Object.keys(currentTreeNodeInfo).length!==0">
      <a-tab-pane :key="1" tab="NC文档" v-if="currentTreeNodeInfo.type===5||currentTreeNodeInfo.type===6">
        <NcDocumentTableList ref="ncDocumentTableListRef" :currentTreeNodeInfo="currentTreeNodeInfo"
                             @handleTableContextMenuOpen="handleTableContextMenuOpen" :size="tableContainerSize"/>
      </a-tab-pane>
    <a-tab-pane :key="1" tab="其他文档" v-else>
      <OtherDocumentTableList ref="otherDocumentTableListRef" :currentTreeNodeInfo="currentTreeNodeInfo"
                              @handleTableContextMenuOpen="handleTableContextMenuOpen" :size="tableContainerSize"/>
    </a-tab-pane>
      <a-tab-pane :key="2" tab="其他文档">
        <OtherDocumentTableList ref="otherDocumentTableListRef" :currentTreeNodeInfo="currentTreeNodeInfo"
                                @handleTableContextMenuOpen="handleTableContextMenuOpen" :size="tableContainerSize"/>
      </a-tab-pane>
    </a-tabs>
    <TableContextMenu :tableRowInfo="currentRightClickedTableRowInfo" ref="tableContextMenuRef"/>
    <DocumentBatchDeleteModal :currentDocumentInfo="currentRightClickedTableRowInfo" :size="tableContainerSize"
                              @reloadDocumentListData="reloadDocumentListData" ref="documentBatchDeleteModalRef"/>
  </a-tabs>
  </div>
</template>
<script>
@@ -30,10 +32,11 @@
    components: { DocumentBatchDeleteModal, TableContextMenu, OtherDocumentTableList, NcDocumentTableList },
    data() {
      return {
        activeTabKey: 1,
        activeTabKey: 2,
        tableContainerSize: 'small',
        currentRightClickedTableRowInfo: {},
        currentTreeNodeInfo: {}
        currentTreeNodeInfo: {},
        hasLoadedDataTabKeyArray: []
      }
    },
    created() {
@@ -64,18 +67,35 @@
        // 从树组件接受树节点信息后从父组件流入子组件
        this.currentTreeNodeInfo = treeNodeInfo
        // 清空上一节点已经加载过得文档列表tabKey
        this.hasLoadedDataTabKeyArray = []
        if (treeNodeInfo.type === 5 || treeNodeInfo.type === 6) {
          this.activeTabKey = 1
          this.$nextTick(() => {
            if (this.$refs.ncDocumentTableListRef) this.$refs.ncDocumentTableListRef.loadData(1)
          })
        } else {
          this.activeTabKey = 2
          this.$nextTick(() => {
            if (this.$refs.otherDocumentTableListRef) this.$refs.otherDocumentTableListRef.loadData(1)
          })
        }
        this.hasLoadedDataTabKeyArray.push(this.activeTabKey)
      },
      /**
       * tab栏切换时触发
       * @param activeTabKey 切换后的tabKey
       */
      handleTabChange(activeTabKey) {
        if (!this.hasLoadedDataTabKeyArray.includes(activeTabKey)) {
          this.$nextTick(() => {
            if (this.$refs.otherDocumentTableListRef) this.$refs.otherDocumentTableListRef.loadData(1)
          })
          // 阻止接口在同一文档一次点击内多次触发
          this.hasLoadedDataTabKeyArray.push(activeTabKey)
        }
      },
      /**
       * 文档以及NC程序导入/出库/入库成功后触发重新加载文档列表
       * @param docClassCode 文档类别
       * @param attributionId 节点Id