src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue
@@ -10,7 +10,8 @@
            ref="deviceCustomTypeTableList" :currentTreeNodeInfo="currentTreeNodeInfo"
            @handleTableContextMenuOpen="handleTableContextMenuOpen" :size="tableContainerSize"/>
          <NcDocumentTableList ref="ncDocumentTableListRef" :currentTreeNodeInfo="currentTreeNodeInfo"
          <NcDocumentTableList ref="ncDocumentTableListRef"
                               :currentNCDocumentAttributionInfo="currentNCDocumentAttributionInfo"
                               @handleTableContextMenuOpen="handleTableContextMenuOpen" :size="tableContainerSize"/>
        </div>
      </a-tab-pane>
@@ -55,11 +56,14 @@
      isProcessStepHasDeviceTypeList: false,
      currentRightClickedTableRowInfo: {},
      currentTreeNodeInfo: {},
      currentClickedTypeInfo: {},
      currentNCDocumentAttributionInfo: {},//当前NC文档的所属级即父级的详细信息(引入设备类后NC挂载至设备类下反之则挂载在工序和工步下)
      hasLoadedDataTabKeyArray: []
    }
  },
  created() {
    this.$bus.$on('sendCurrentTreeNodeInfo', this.receiveCurrentTreeNodeInfo)
    this.$bus.$on('sendCurrentClickedTypeInfo', this.receiveCurrentClickedTypeInfo)
    this.$bus.$on('reloadDocumentListData', this.reloadDocumentListData)
    this.$bus.$on('tableMenuItemMethodTrigger', this.triggerCorrespondingMethod)
    this.getDeviceTypeListDisplayPermission('dnc_device_type_process', 'isProcessHasDeviceTypeList')
@@ -104,6 +108,19 @@
      this.hasLoadedDataTabKeyArray.push(this.activeTabKey)
    },
    receiveCurrentClickedTypeInfo(record) {
      const { id, attributionType } = record
      this.currentClickedTypeInfo = Object.assign({}, record)
      this.currentNCDocumentAttributionInfo = Object.assign({}, {
        attributionId: id,
        attributionType,
        docClassCode: 'NC'
      })
      this.$nextTick(() => {
        if (this.$refs.ncDocumentTableListRef) this.$refs.ncDocumentTableListRef.loadData(1)
      })
    },
    /**
     * 控制右键菜单开启
     * @param record 当前表格行信息
@@ -134,13 +151,23 @@
    /**
     * 文档以及NC程序导入/出库/入库成功后触发重新加载文档列表
     * @param docClassCode 文档类别
     * @param attributionId 节点Id
     * @param attributionType 文档父级type类型
     * @param attributionId 文档父级Id
     */
    reloadDocumentListData({ docClassCode, attributionId }) {
      // 如果上传的文档不是所属于当前所展示节点的文档则不重新获取文档列表
      if (this.currentTreeNodeInfo.id !== attributionId) return
    reloadDocumentListData({ docClassCode, attributionType, attributionId }) {
      console.log('docClassCode, attributionType, attributionId', docClassCode, attributionType, attributionId)
      // 在此处设备NC文档父级参数是可此方法是结构树以及设备类两种不同导入方式的共同出口
      this.currentNCDocumentAttributionInfo = Object.assign({}, { docClassCode, attributionId, attributionType })
      // 若引入设备类则只需要判断当前出现的文档所属是否是当前左键选中的文档,若不是当前选中的文档则不刷新文档列表(避免无效刷新)
      if (this.currentRightClickedTableRowInfo.hasOwnProperty('deviceManagementId')) {
        if (this.currentClickedTypeInfo.id !== attributionId) return
      } else {
        if (this.currentTreeNodeInfo.id !== attributionId) return
      }
      if (docClassCode === 'NC') {
        if (this.$refs.ncDocumentTableListRef) this.$refs.ncDocumentTableListRef.loadData(1)
        this.$nextTick(() => {
          if (this.$refs.ncDocumentTableListRef) this.$refs.ncDocumentTableListRef.loadData(1)
        })
      } else {
        if (this.$refs.otherDocumentTableListRef) this.$refs.otherDocumentTableListRef.loadData(1)
      }
@@ -169,7 +196,7 @@
    // 删除当前右键选中文档
    handleDelete() {
      const { docId, param, attributionId } = this.currentRightClickedTableRowInfo
      const { docId, param, attributionId, attributionType } = this.currentRightClickedTableRowInfo
      const that = this
      that.$confirm({
        title: '提示',
@@ -184,7 +211,7 @@
                  message: '消息',
                  description: res.message
                })
                that.reloadDocumentListData({ docClassCode: param, attributionId })
                that.reloadDocumentListData({ docClassCode: param, attributionId, attributionType })
              } else {
                that.$notification.warning({
                  message: '消息',
@@ -218,7 +245,7 @@
     */
    handlePull(menuLabel) {
      const that = this
      const { docId, docName, param, attributionId } = this.currentRightClickedTableRowInfo
      const { docId, docName, param, attributionId, attributionType } = this.currentRightClickedTableRowInfo
      that.$confirm({
        title: '提示',
        content: `确认${menuLabel}吗?`,
@@ -229,7 +256,7 @@
            .then(res => {
              console.log('res------------------', res)
              if (res.success) {
                that.reloadDocumentListData({ docClassCode: param, attributionId })
                that.reloadDocumentListData({ docClassCode: param, attributionId, attributionType })
                that.$notification.success({
                  message: '消息',
                  description: `${menuLabel}成功`
@@ -263,7 +290,7 @@
     */
    handleCancelPull(menuLabel) {
      const that = this
      const { docId, param, attributionId } = this.currentRightClickedTableRowInfo
      const { docId, param, attributionId, attributionType } = this.currentRightClickedTableRowInfo
      that.$confirm({
        title: '提示',
        content: `确认${menuLabel}吗?`,
@@ -273,7 +300,7 @@
          dncApi.documentCancelOutboundApi(docId)
            .then(res => {
              if (res.success) {
                this.reloadDocumentListData({ docClassCode: param, attributionId })
                this.reloadDocumentListData({ docClassCode: param, attributionId, attributionType })
                that.$notification.success({
                  message: '消息',
                  description: res.message
@@ -307,7 +334,7 @@
     */
    handlePublish(menuLabel) {
      const that = this
      const { docId, param, attributionId } = this.currentRightClickedTableRowInfo
      const { docId, param, attributionId, attributionType } = this.currentRightClickedTableRowInfo
      that.$confirm({
        title: '提示',
        content: `确认${menuLabel}吗?`,
@@ -317,7 +344,7 @@
          dncApi.documentPublishApi(docId)
            .then(res => {
              if (res.success) {
                this.reloadDocumentListData({ docClassCode: param, attributionId })
                this.reloadDocumentListData({ docClassCode: param, attributionId, attributionType })
                this.$bus.$emit('reloadMainBottomTableData', 'documentVersion')
                that.$notification.success({
                  message: '消息',
@@ -352,7 +379,7 @@
     */
    handleRepublish(menuLabel) {
      const that = this
      const { docId, param, attributionId } = this.currentRightClickedTableRowInfo
      const { docId, param, attributionId, attributionType } = this.currentRightClickedTableRowInfo
      that.$confirm({
        title: '提示',
        content: `确认${menuLabel}吗?`,
@@ -362,7 +389,7 @@
          dncApi.documentRepublishApi(docId)
            .then(res => {
              if (res.success) {
                this.reloadDocumentListData({ docClassCode: param, attributionId })
                this.reloadDocumentListData({ docClassCode: param, attributionId, attributionType })
                that.$notification.success({
                  message: '消息',
                  description: res.message
@@ -396,7 +423,7 @@
     */
    handlePigeonhole(menuLabel) {
      const that = this
      const { docId, param, attributionId } = this.currentRightClickedTableRowInfo
      const { docId, param, attributionId, attributionType } = this.currentRightClickedTableRowInfo
      that.$confirm({
        title: '提示',
        content: `${menuLabel}后不可取消,确认${menuLabel}吗?`,
@@ -406,7 +433,7 @@
          dncApi.documentPigeonholeApi(docId)
            .then(res => {
              if (res.success) {
                this.reloadDocumentListData({ docClassCode: param, attributionId })
                this.reloadDocumentListData({ docClassCode: param, attributionId, attributionType })
                that.$notification.success({
                  message: '消息',
                  description: res.message