src/views/dnc/base/modules/DeviceStructure/DeviceStructureMainTop.vue
@@ -1,29 +1,36 @@
<template>
  <a-tabs v-model="activeTabKey" @contextmenu.native="e=>e.preventDefault()"
          v-if="Object.keys(currentTreeNodeInfo).length!==0">
    <a-tab-pane :key="1" tab="发送">
      <!--<NcDocumentTableList ref="ncDocumentTableListRef" />-->
      <HasSentDocumentTableList ref="hasSentDocumentTableListRef" :currentTreeNodeInfo="currentTreeNodeInfo"
                                @handleTableContextMenuOpen="handleTableContextMenuOpen" :size="tableContainerSize"/>
    </a-tab-pane>
  <div>
    <a-tabs v-model="activeTabKey" @change="handleTabChange" @contextmenu.native="e=>e.preventDefault()"
            v-if="Object.keys(currentTreeNodeInfo).length!==0">
      <a-tab-pane :key="1" tab="发送">
        <HasSentDocumentTableList ref="hasSentDocumentTableListRef" :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-tab-pane :key="2" tab="接收">
        <HasReceivedDocumentTableList ref="hasReceivedDocumentTableListRef" :currentTreeNodeInfo="currentTreeNodeInfo"
                                      @handleTableContextMenuOpen="handleTableContextMenuOpen"
                                      :size="tableContainerSize"/>
      </a-tab-pane>
    </a-tabs>
    <TableContextMenu :tableRowInfo="currentRightClickedTableRowInfo" ref="tableContextMenuRef"/>
  </a-tabs>
    <DocumentBatchDeleteModal :currentDocumentInfo="currentRightClickedTableRowInfo" :size="tableContainerSize"
                              @reloadDocumentListData="reloadDocumentListData" ref="documentBatchDeleteModalRef"/>
  </div>
</template>
<script>
  import dncApi from '@/api/dnc'
  import TableContextMenu from '../../../common/TableContextMenu'
  import HasSentDocumentTableList from './HasSentDocumentTableList'
  import HasSentDocumentTableList from './Document/HasSentDocumentTableList'
  import HasReceivedDocumentTableList from './Document/HasReceivedDocumentTableList'
  import DocumentBatchDeleteModal from '../../../common/DocumentBatchDeleteModal'
  export default {
    name: 'DeviceStructureMainTop',
    components: { HasSentDocumentTableList, TableContextMenu },
    components: { DocumentBatchDeleteModal, HasReceivedDocumentTableList, HasSentDocumentTableList, TableContextMenu },
    props: {
      currentTreeNodeInfo: {
        type: Object
@@ -33,7 +40,8 @@
      return {
        activeTabKey: 1,
        tableContainerSize: 'small',
        currentRightClickedTableRowInfo: {}
        currentRightClickedTableRowInfo: {},
        hasLoadedDataTabKeyArray: []
      }
    },
    created() {
@@ -47,7 +55,6 @@
       */
      handleTableContextMenuOpen(record) {
        this.currentRightClickedTableRowInfo = Object.assign({}, record)
        console.log('currentRightClickedTableRowInfo', this.currentRightClickedTableRowInfo)
        this.$refs.tableContextMenuRef.currentMenuLevel = record.param
        this.$refs.tableContextMenuRef.menuStyle.top = event.clientY + 'px'
        this.$refs.tableContextMenuRef.menuStyle.left = event.clientX + 'px'
@@ -61,8 +68,31 @@
       */
      loadHasSentDocumentListData(treeNodeInfo) {
        this.$nextTick(() => {
          if (this.$refs.hasSentDocumentTableListRef) this.$refs.hasSentDocumentTableListRef.loadData(1)
          if (this.$refs.hasSentDocumentTableListRef) {
            this.$refs.hasSentDocumentTableListRef.loadData(1)
            this.hasLoadedDataTabKeyArray.push(this.activeTabKey)
          }
        })
      },
      /**
       * tab标签切换时触发
       * @param activeTabKey 当前已激活tab的key
       */
      handleTabChange(activeTabKey) {
        this.$bus.$emit('handleSwitchDeviceDocClassCode', activeTabKey)
        if (activeTabKey && !this.hasLoadedDataTabKeyArray.includes(activeTabKey)) {
          if (activeTabKey === 1) {
            this.$nextTick(() => {
              if (this.$refs.hasSentDocumentTableListRef) this.$refs.hasSentDocumentTableListRef.loadData(1)
            })
          } else {
            this.$nextTick(() => {
              if (this.$refs.hasReceivedDocumentTableListRef) this.$refs.hasReceivedDocumentTableListRef.loadData(1)
            })
          }
          this.hasLoadedDataTabKeyArray.push(activeTabKey)
        }
      },
      /**
@@ -75,6 +105,8 @@
        if (this.currentTreeNodeInfo.key !== attributionId) return
        if (docClassCode === 'SEND') {
          if (this.$refs.hasSentDocumentTableListRef) this.$refs.hasSentDocumentTableListRef.loadData(1)
        } else {
          if (this.$refs.hasReceivedDocumentTableListRef) this.$refs.hasReceivedDocumentTableListRef.loadData(1)
        }
      },
@@ -132,6 +164,16 @@
            that.$destroyAll()
          }
        })
      },
      /**
       * 点击批量删除后出现弹窗
       * @param modalTitle 弹窗标题
       */
      handleBatchRemove(modalTitle) {
        if (!this.$refs.documentBatchDeleteModalRef) return
        this.$refs.documentBatchDeleteModalRef.title = modalTitle
        this.$refs.documentBatchDeleteModalRef.visible = true
      },
      /**
@@ -222,7 +264,6 @@
          }
        })
      },
      /**
       * 点击发布时触发当前文档发布
@@ -357,6 +398,12 @@
        })
      },
      // 重置tabKey并且释放加载文档列表的接口
      releaseLoadDocumentListApi() {
        this.hasLoadedDataTabKeyArray = []
        this.handleTabChange(this.activeTabKey)
      },
      // 控制右键菜单关闭
      handleMenuClose() {
        this.$refs.tableContextMenuRef.menuVisible = false