1、产品结构树页面完成文档生命周期相关功能,待后续开发至文档版本列表时继续完善与生命周期功能的关联
2、删除导出文档或NC程序功能
已修改11个文件
564 ■■■■ 文件已修改
src/api/dnc.js 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/manage.js 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/base/modules/ProductStructure/Document/DocumentInfo.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/base/modules/ProductStructure/Document/DocumentModalForm.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/base/modules/ProductStructure/Document/NcDocumentTableList.vue 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/base/modules/ProductStructure/Document/OtherDocumentTableList.vue 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue 224 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/base/modules/ProductStructure/ProductStructureTreeContextMenu.vue 66 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/common/ImportFileModal.vue 45 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dnc/common/TableContextMenu.vue 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/dnc.js
@@ -1,13 +1,37 @@
import { getAction, deleteAction, putAction, postAction, httpAction, uploadAction } from '@/api/manage'
import {
  getAction,
  deleteAction,
  putAction,
  postAction,
  httpAction,
  uploadAction,
  requestGetDownLoad,
  downloadFile
} from '@/api/manage'
import querystring from 'querystring'
export default {
  //-------------------------产品结构树------------------------------------------------
  getProductStructureTreeApi: () => getAction('/nc/product/load/tree'),
  // 导入文档
  importDocumentFromLocalApi: (params, formData) => {
  // 导入NC程序/文档
  importDocumentFromLocalApi: ({ params, formData }) => {
    const paramsStringify = querystring.stringify(params)
    return uploadAction(`/nc/doc/add?${paramsStringify}`, formData)
  }
  },
  // 下载文档
  downloadDocumentApi: ({ id, docName }) => downloadFile(`/nc/doc/download/${id}`, docName),
  // 文档出库
  documentOutboundApi: ({ id, docName }) => requestGetDownLoad(`/nc/doc/pull/${id}`, docName),
  // 文档取消出库
  documentCancelOutboundApi: id => putAction(`/nc/doc/cancel/pull/${id}`),
  // 文档入库
  documentVersionUpdateApi: ({ id, formData }) => uploadAction(`/nc/doc/push/${id}`, formData),
  // 文档发布
  documentPublishApi: id => putAction(`/nc/doc/publish/${id}`),
  // 文档重新发布
  documentRepublishApi: id => putAction(`/nc/doc/republish/${id}`),
  // 文档归档
  documentPigeonholeApi: id => putAction(`/nc/doc/pigeonhole/${id}`)
}
src/api/manage.js
@@ -13,52 +13,52 @@
export default api
//post
export function postAction(url,parameter) {
  let sign = signMd5Utils.getSign(url, parameter);
export function postAction(url, parameter) {
  let sign = signMd5Utils.getSign(url, parameter)
  //将签名和时间戳,添加在请求接口 Header
  // update-begin--author:taoyan---date:20220421--for: VUEN-410【签名改造】 X-TIMESTAMP牵扯
  let signHeader = {"X-Sign": sign,"X-TIMESTAMP": signMd5Utils.getTimestamp()};
  let signHeader = { 'X-Sign': sign, 'X-TIMESTAMP': signMd5Utils.getTimestamp() }
  // update-end--author:taoyan---date:20220421--for: VUEN-410【签名改造】 X-TIMESTAMP牵扯
  return axios({
    url: url,
    method:'post' ,
    method: 'post',
    data: parameter,
    headers: signHeader
  })
}
//post method= {post | put}
export function httpAction(url,parameter,method) {
  let sign = signMd5Utils.getSign(url, parameter);
export function httpAction(url, parameter, method) {
  let sign = signMd5Utils.getSign(url, parameter)
  //将签名和时间戳,添加在请求接口 Header
  // update-begin--author:taoyan---date:20220421--for: VUEN-410【签名改造】 X-TIMESTAMP牵扯
  let signHeader = {"X-Sign": sign,"X-TIMESTAMP": signMd5Utils.getTimestamp()};
  let signHeader = { 'X-Sign': sign, 'X-TIMESTAMP': signMd5Utils.getTimestamp() }
  // update-end--author:taoyan---date:20220421--for: VUEN-410【签名改造】 X-TIMESTAMP牵扯
  return axios({
    url: url,
    method:method ,
    method: method,
    data: parameter,
    headers: signHeader
  })
}
//put
export function putAction(url,parameter) {
export function putAction(url, parameter) {
  return axios({
    url: url,
    method:'put',
    method: 'put',
    data: parameter
  })
}
//get
export function getAction(url,parameter) {
  let sign = signMd5Utils.getSign(url, parameter);
export function getAction(url, parameter) {
  let sign = signMd5Utils.getSign(url, parameter)
  //将签名和时间戳,添加在请求接口 Header
  // update-begin--author:taoyan---date:20220421--for: VUEN-410【签名改造】 X-TIMESTAMP牵扯
  let signHeader = {"X-Sign": sign,"X-TIMESTAMP": signMd5Utils.getTimestamp()};
  let signHeader = { 'X-Sign': sign, 'X-TIMESTAMP': signMd5Utils.getTimestamp() }
  // update-end--author:taoyan---date:20220421--for: VUEN-410【签名改造】 X-TIMESTAMP牵扯
  return axios({
@@ -70,7 +70,7 @@
}
//deleteAction
export function deleteAction(url,parameter) {
export function deleteAction(url, parameter) {
  return axios({
    url: url,
    method: 'delete',
@@ -113,9 +113,9 @@
  // url = url + '?' + query;
  return axios({
    url: url,
    method:'put',
    method: 'put',
    data: parameter,
    params:params
    params: params
  })
}
@@ -143,15 +143,15 @@
 * @param parameter
 * @returns {*}
 */
export function downFile(url,parameter, method='get'){
  if(method=='get'){
export function downFile(url, parameter, method = 'get') {
  if (method == 'get') {
    return axios({
      url: url,
      params: parameter,
      method: method ,
      method: method,
      responseType: 'blob'
    })
  }else{
  } else {
    return axios({
      url: url,
      method: method,
@@ -192,19 +192,60 @@
}
/**
 * 下载文件
 * @param url 文件路径
 * @param fileName 文件名
 * @returns {*}
 */
export function requestGetDownLoad(url, fileName) {
  return new Promise((resolve, reject) => {
    axios({
      method: 'GET',
      url: url,
      headers: {
        'Access-Control-Expose-Headers': 'content-disposition'
      },
      responseType: 'blob' //二进制流
    }).then(data => {
      if (data.type === 'application/json') {
        let reader = new FileReader()
        reader.readAsText(data, 'utf-8')
        reader.onload = (e) => {
          JSON.parse(reader.result)
          resolve(JSON.parse(reader.result))
        }
      } else {
        let blob = new Blob([data])
        if (window.navigator.msSaveOrOpenBlob) {
          navigator.msSaveBlob(blob, fileName)
        } else {
          let a = document.createElement('a')
          a.download = fileName
          a.href = window.URL.createObjectURL(blob)
          a.click()
          resolve({ success: true })
        }
      }
    }).catch(error => {
      reject(error)
    })
  })
}
/**
 * 文件上传 用于富文本上传图片
 * @param url
 * @param parameter
 * @returns {*}
 */
export function uploadAction(url,parameter){
export function uploadAction(url, parameter) {
  return axios({
    url: url,
    data: parameter,
    method:'post' ,
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data',  // 文件上传
    },
      'Content-Type': 'multipart/form-data'  // 文件上传
    }
  })
}
@@ -214,17 +255,17 @@
 * @param subStr
 * @returns {*}
 */
export function getFileAccessHttpUrl(avatar,subStr) {
  if(!subStr) subStr = 'http'
export function getFileAccessHttpUrl(avatar, subStr) {
  if (!subStr) subStr = 'http'
  try {
    if(avatar && avatar.startsWith(subStr)){
      return avatar;
    }else{
      if(avatar && avatar.length>0 && avatar.indexOf('[')==-1){
        return window._CONFIG['staticDomainURL'] + "/" + avatar;
    if (avatar && avatar.startsWith(subStr)) {
      return avatar
    } else {
      if (avatar && avatar.length > 0 && avatar.indexOf('[') == -1) {
        return window._CONFIG['staticDomainURL'] + '/' + avatar
      }
    }
  }catch(err){
   return;
  } catch (err) {
    return
  }
}
src/views/dnc/base/modules/ProductStructure/Document/DocumentInfo.vue
@@ -4,9 +4,9 @@
    <a-descriptions-item label="代码版本">{{currentLevelDetails.docAlias}}</a-descriptions-item>
    <a-descriptions-item label="设备编号    ">{{currentLevelDetails.docCode}}</a-descriptions-item>
    <a-descriptions-item label="文档后缀">{{currentLevelDetails.docSuffix}}</a-descriptions-item>
    <a-descriptions-item label="文档状态">{{currentLevelDetails.docStatus}}</a-descriptions-item>
    <a-descriptions-item label="文档状态">{{currentLevelDetails.docStatus_dictText}}</a-descriptions-item>
    <a-descriptions-item label="系统指定版本">{{currentLevelDetails.publishVersion}}</a-descriptions-item>
    <a-descriptions-item label="出库状态">{{currentLevelDetails.pullStatus}}</a-descriptions-item>
    <a-descriptions-item label="出库状态">{{currentLevelDetails.pullStatus_dictText}}</a-descriptions-item>
    <a-descriptions-item label="出库人" :span="2">{{currentLevelDetails.pullUser}}</a-descriptions-item>
    <a-descriptions-item label="描述" :span="3">{{currentLevelDetails.description}}</a-descriptions-item>
  </a-descriptions>
src/views/dnc/base/modules/ProductStructure/Document/DocumentModalForm.vue
@@ -61,7 +61,6 @@
          ],
        },
        url: {
          add: '/mdc/mdcPartProcessInfo/add',
          edit: '/mdc/mdcPartProcessInfo/edit'
        }
      }
src/views/dnc/base/modules/ProductStructure/Document/NcDocumentTableList.vue
@@ -45,8 +45,8 @@
          },
          { title: '文件名称', dataIndex: 'docName', align: 'center' },
          { title: '代码版本', dataIndex: 'docAlias', align: 'center' },
          { title: '出库状态', dataIndex: 'pullStatus', align: 'center' },
          { title: '状  态', dataIndex: 'docStatus', align: 'center' },
          { title: '出库状态', dataIndex: 'pullStatus_dictText', align: 'center' },
          { title: '状  态', dataIndex: 'docStatus_dictText', align: 'center' },
          { title: '系统指定版本', dataIndex: 'publishVersion', align: 'center' },
          { title: '上传时间', dataIndex: 'createTime', align: 'center' }
        ],
@@ -77,9 +77,9 @@
        this.loading = true
        getAction(this.url.list + `/${this.ipagination.current}/${this.ipagination.pageSize}`, params).then((res) => {
          if (res.success) {
            this.dataSource = res.page.records
            if (res.page.total) {
              this.ipagination.total = res.page.total
            this.dataSource = res.result.records
            if (res.result.total) {
              this.ipagination.total = res.result.total
            } else {
              this.ipagination.total = 0
            }
@@ -96,7 +96,7 @@
          on: {
            contextmenu: event => {
              event.preventDefault()
              this.$emit('handleTableContextMenuOpen', { ...record, param: 'document' })
              this.$emit('handleTableContextMenuOpen', { ...record, param: 'NC' })
            },
            click: () => {
              this.$bus.$emit('sendCurrentLevelInfo', record)
src/views/dnc/base/modules/ProductStructure/Document/OtherDocumentTableList.vue
@@ -42,8 +42,8 @@
          },
          { title: '文件名称', dataIndex: 'docName', align: 'center' },
          { title: '设备编号', dataIndex: 'docCode', align: 'center' },
          { title: '出库状态', dataIndex: 'pullStatus', align: 'center' },
          { title: '状  态', dataIndex: 'docStatus', align: 'center' },
          { title: '出库状态', dataIndex: 'pullStatus_dictText', align: 'center' },
          { title: '状  态', dataIndex: 'docStatus_dictText', align: 'center' },
          { title: '系统指定版本', dataIndex: 'publishVersion', align: 'center' },
          { title: '上传时间', dataIndex: 'createTime', align: 'center' }
        ],
@@ -74,9 +74,9 @@
        this.loading = true
        getAction(this.url.list + `/${this.ipagination.current}/${this.ipagination.pageSize}`, params).then((res) => {
          if (res.success) {
            this.dataSource = res.page.records
            if (res.page.total) {
              this.ipagination.total = res.page.total
            this.dataSource = res.result.records
            if (res.result.total) {
              this.ipagination.total = res.result.total
            } else {
              this.ipagination.total = 0
            }
@@ -93,7 +93,7 @@
          on: {
            contextmenu: event => {
              event.preventDefault()
              this.$emit('handleTableContextMenuOpen', { ...record, param: 'document' })
              this.$emit('handleTableContextMenuOpen', { ...record, param: 'OTHER' })
            },
            click: () => {
              this.$bus.$emit('sendCurrentLevelInfo', record)
src/views/dnc/base/modules/ProductStructure/ProductStructureMainTop.vue
@@ -16,6 +16,7 @@
</template>
<script>
  import dncApi from '@/api/dnc'
  import NcDocumentTableList from './Document/NcDocumentTableList'
  import OtherDocumentTableList from './Document/OtherDocumentTableList'
  import TableContextMenu from '../../../common/TableContextMenu'
@@ -34,6 +35,7 @@
    created() {
      this.$bus.$on('sendCurrentTreeNodeInfo', this.receiveCurrentTreeNodeInfo)
      this.$bus.$on('importFileSuccess', this.reloadDocumentListData)
      this.$bus.$on('tableMenuItemMethodTrigger', this.triggerCorrespondingMethod)
    },
    methods: {
      /**
@@ -42,6 +44,7 @@
       */
      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'
@@ -69,7 +72,7 @@
      },
      /**
       * 上传文件成功后触发
       * 文档以及NC程序导入/出库/入库成功后触发重新加载文档列表
       * @param docClassCode 文档类别
       * @param attributionId 节点Id
       */
@@ -84,11 +87,230 @@
      },
      /**
       * 点击下载时触发下载当前文档
       */
      handleDownload() {
        const that = this
        const { docId, docName } = this.currentRightClickedTableRowInfo
        dncApi.downloadDocumentApi({ id: docId, docName })
          .then(res => {
            if (res && !res.success) {
              that.$notification.error({
                message: '消息',
                description: res.message
              })
            }
          })
          .catch(err => {
            that.$notification.error({
              message: '消息',
              description: err.message
            })
          })
      },
      /**
       * 点击出库时触发当前文档出库
       * @param menuLabel
       */
      handlePull(menuLabel) {
        const that = this
        const { docId, docName, param, attributionId } = this.currentRightClickedTableRowInfo
        this.$confirm({
          title: '提示',
          content: `确认${menuLabel}吗?`,
          okText: '确认',
          cancelText: '取消',
          onOk: () => {
            dncApi.documentOutboundApi({ id: docId, docName })
              .then(res => {
                console.log('res------------------', res)
                if (res.success) {
                  this.reloadDocumentListData({ docClassCode: param, attributionId })
                  that.$notification.success({
                    message: '消息',
                    description: `${menuLabel}成功`
                  })
                } else {
                  that.$notification.error({
                    message: '消息',
                    description: res.message
                  })
                }
              })
              .catch(err => {
                that.$notification.error({
                  message: '消息',
                  description: err.message
                })
              })
          }
        })
      },
      /**
       * 点击取消出库时触发当前文档取消出库
       * @param menuLabel
       */
      handleCancelPull(menuLabel) {
        const that = this
        const { docId, param, attributionId } = this.currentRightClickedTableRowInfo
        this.$confirm({
          title: '提示',
          content: `确认${menuLabel}吗?`,
          okText: '确认',
          cancelText: '取消',
          onOk: () => {
            dncApi.documentCancelOutboundApi(docId)
              .then(res => {
                if (res.success) {
                  this.reloadDocumentListData({ docClassCode: param, attributionId })
                  that.$notification.success({
                    message: '消息',
                    description: res.message
                  })
                } else {
                  that.$notification.error({
                    message: '消息',
                    description: res.message
                  })
                }
              })
              .catch(err => {
                that.$notification.error({
                  message: '消息',
                  description: err.message
                })
              })
          }
        })
      },
      /**
       * 点击发布时触发当前文档发布
       * @param menuLabel
       */
      handlePublish(menuLabel) {
        const that = this
        const { docId, param, attributionId } = this.currentRightClickedTableRowInfo
        this.$confirm({
          title: '提示',
          content: `确认${menuLabel}吗?`,
          okText: '确认',
          cancelText: '取消',
          onOk: () => {
            dncApi.documentPublishApi(docId)
              .then(res => {
                if (res.success) {
                  this.reloadDocumentListData({ docClassCode: param, attributionId })
                  that.$notification.success({
                    message: '消息',
                    description: res.message
                  })
                } else {
                  that.$notification.error({
                    message: '消息',
                    description: res.message
                  })
                }
              })
              .catch(err => {
                that.$notification.error({
                  message: '消息',
                  description: err.message
                })
              })
          }
        })
      },
      /**
       * 点击重新发布时触发当前文档重新发布退回上一版本
       * @param menuLabel
       */
      handleRepublish(menuLabel) {
        const that = this
        const { docId, param, attributionId } = this.currentRightClickedTableRowInfo
        this.$confirm({
          title: '提示',
          content: `确认${menuLabel}吗?`,
          okText: '确认',
          cancelText: '取消',
          onOk: () => {
            dncApi.documentRepublishApi(docId)
              .then(res => {
                if (res.success) {
                  this.reloadDocumentListData({ docClassCode: param, attributionId })
                  that.$notification.success({
                    message: '消息',
                    description: res.message
                  })
                } else {
                  that.$notification.error({
                    message: '消息',
                    description: res.message
                  })
                }
              })
              .catch(err => {
                that.$notification.error({
                  message: '消息',
                  description: err.message
                })
              })
          }
        })
      },
      /**
       * 点击归档时触发当前文档归档且后续无法继续发布或归档
       * @param menuLabel
       */
      handlePigeonhole(menuLabel) {
        const that = this
        const { docId, param, attributionId } = this.currentRightClickedTableRowInfo
        this.$confirm({
          title: '提示',
          content: `${menuLabel}后不可取消,确认${menuLabel}吗?`,
          okText: '确认',
          cancelText: '取消',
          onOk: () => {
            dncApi.documentPigeonholeApi(docId)
              .then(res => {
                if (res.success) {
                  this.reloadDocumentListData({ docClassCode: param, attributionId })
                  that.$notification.success({
                    message: '消息',
                    description: res.message
                  })
                } else {
                  that.$notification.error({
                    message: '消息',
                    description: res.message
                  })
                }
              })
              .catch(err => {
                that.$notification.error({
                  message: '消息',
                  description: err.message
                })
              })
          }
        })
      },
      /**
       * 控制右键菜单点击关闭
       */
      handleMenuClose() {
        this.$refs.tableContextMenuRef.menuVisible = false
        document.body.removeEventListener('click', this.handleMenuClose)
      },
      triggerCorrespondingMethod({ methodName, modalTitle }) {
        if (this[methodName]) this[methodName](modalTitle)
      }
    }
  }
src/views/dnc/base/modules/ProductStructure/ProductStructureTree.vue
@@ -15,7 +15,7 @@
              <a-icon type="bars"/>
            </a-button>
          </a-dropdown>
          <a-button type="primary"
          <a-button type="primary" v-has="'product_add'"
                    @click="$refs.productModalFormRef.triggerCorrespondingMethod({modalTitle:'添加产品',methodName:'handleProductAdd'})">
            <a-icon type="plus"></a-icon>
            产品
src/views/dnc/base/modules/ProductStructure/ProductStructureTreeContextMenu.vue
@@ -29,51 +29,51 @@
        defaultContextMenuList: {
          //产品
          product: [
            { show: true, label: '添加产品', code: 'product_add', icon: 'plus', isCommonMethod: false },
            { show: true, label: '添加部件', code: 'product_add_child', icon: 'plus', isCommonMethod: false },
            { show: true, label: '编辑产品信息', code: 'product_edit', icon: 'edit', isCommonMethod: false },
            { show: false, label: '导出文档', code: 'product_export', icon: 'export', isCommonMethod: true },
            { show: true, label: '导入其他文档', code: 'product_import', icon: 'import', isCommonMethod: true },
            { show: true, label: '删除', code: 'product_delete', icon: 'delete', isCommonMethod: true },
            { show: true, label: '权限配置', code: 'public_assign_permission', icon: 'idcard', isCommonMethod: true }
            { label: '添加产品', code: 'product_add', icon: 'plus', isCommonMethod: false },
            { label: '添加部件', code: 'product_add_child', icon: 'plus', isCommonMethod: false },
            { label: '编辑产品信息', code: 'product_edit', icon: 'edit', isCommonMethod: false },
            // {  label: '导出文档', code: 'product_export', icon: 'export', isCommonMethod: true },
            { label: '导入其他文档', code: 'product_import', icon: 'import', isCommonMethod: true },
            { label: '删除', code: 'product_delete', icon: 'delete', isCommonMethod: true },
            { label: '权限配置', code: 'public_assign_permission', icon: 'idcard', isCommonMethod: true }
          ],
          //部件
          component: [
            { show: true, label: '添加子部件', code: 'component_add', icon: 'plus', isCommonMethod: false },
            { show: true, label: '添加零件', code: 'component_add_child', icon: 'plus', isCommonMethod: false },
            { show: true, label: '创建工序', code: 'component_add_relative', icon: 'plus', isCommonMethod: false },
            { show: true, label: '编辑部件信息', code: 'component_edit', icon: 'edit', isCommonMethod: false },
            { show: false, label: '导出文档', code: 'component_export', icon: 'export', isCommonMethod: true },
            { show: true, label: '导入其他文档', code: 'component_import', icon: 'import', isCommonMethod: true },
            { show: true, label: '删除', code: 'component_delete', icon: 'delete', isCommonMethod: true },
            { show: true, label: '权限配置', code: 'public_assign_permission', icon: 'idcard', isCommonMethod: true }
            { label: '添加子部件', code: 'component_add', icon: 'plus', isCommonMethod: false },
            { label: '添加零件', code: 'component_add_child', icon: 'plus', isCommonMethod: false },
            { label: '创建工序', code: 'component_add_relative', icon: 'plus', isCommonMethod: false },
            { label: '编辑部件信息', code: 'component_edit', icon: 'edit', isCommonMethod: false },
            // {  label: '导出文档', code: 'component_export', icon: 'export', isCommonMethod: true },
            { label: '导入其他文档', code: 'component_import', icon: 'import', isCommonMethod: true },
            { label: '删除', code: 'component_delete', icon: 'delete', isCommonMethod: true },
            { label: '权限配置', code: 'public_assign_permission', icon: 'idcard', isCommonMethod: true }
          ],
          //零件
          part: [
            { show: true, label: '添加零件', code: 'parts_add', icon: 'plus', isCommonMethod: false },
            { show: true, label: '创建工序', code: 'parts_add_relative', icon: 'plus', isCommonMethod: false },
            { show: true, label: '编辑零件信息', code: 'parts_edit', icon: 'edit', isCommonMethod: false },
            { show: false, label: '导出文档', code: 'parts_export', icon: 'export', isCommonMethod: true },
            { show: true, label: '导入其他文档', code: 'parts_import', icon: 'import', isCommonMethod: true },
            { show: true, label: '删除', code: 'parts_delete', icon: 'delete', isCommonMethod: true },
            { show: true, label: '权限配置', code: 'public_assign_permission', icon: 'idcard', isCommonMethod: true }
            { label: '添加零件', code: 'parts_add', icon: 'plus', isCommonMethod: false },
            { label: '创建工序', code: 'parts_add_relative', icon: 'plus', isCommonMethod: false },
            { label: '编辑零件信息', code: 'parts_edit', icon: 'edit', isCommonMethod: false },
            // {  label: '导出文档', code: 'parts_export', icon: 'export', isCommonMethod: true },
            { label: '导入其他文档', code: 'parts_import', icon: 'import', isCommonMethod: true },
            { label: '删除', code: 'parts_delete', icon: 'delete', isCommonMethod: true },
            { label: '权限配置', code: 'public_assign_permission', icon: 'idcard', isCommonMethod: true }
          ],
          //工序
          process: [
            { show: true, label: '创建工序', code: 'process_add', icon: 'plus', isCommonMethod: false },
            { show: true, label: '创建工步', code: 'process_add_child', icon: 'plus', isCommonMethod: false },
            { show: true, label: '编辑工序信息', code: 'process_edit', icon: 'edit', isCommonMethod: false },
            { show: true, label: '删除', code: 'process_delete', icon: 'delete', isCommonMethod: true },
            { show: false, label: '导出NC程序', code: 'process_export', icon: 'import', isCommonMethod: true },
            { show: true, label: '导入NC程序', code: 'process_import', icon: 'export', isCommonMethod: true }
            { label: '创建工序', code: 'process_add', icon: 'plus', isCommonMethod: false },
            { label: '创建工步', code: 'process_add_child', icon: 'plus', isCommonMethod: false },
            { label: '编辑工序信息', code: 'process_edit', icon: 'edit', isCommonMethod: false },
            { label: '删除', code: 'process_delete', icon: 'delete', isCommonMethod: true },
            // {  label: '导出NC程序', code: 'process_export', icon: 'import', isCommonMethod: true },
            { label: '导入NC程序', code: 'process_import', icon: 'export', isCommonMethod: true }
          ],
          //工步
          processStep: [
            { show: true, label: '创建工步', code: 'processStep_add', icon: 'plus', isCommonMethod: false },
            { show: true, label: '编辑工步信息', code: 'processStep_edit', icon: 'edit', isCommonMethod: false },
            { show: true, label: '删除', code: 'processStep_delete', icon: 'delete', isCommonMethod: true },
            { show: false, label: '导出NC程序', code: 'processStep_export', icon: 'import', isCommonMethod: true },
            { show: true, label: '导入NC程序', code: 'processStep_import', icon: 'export', isCommonMethod: true }
            { label: '创建工步', code: 'processStep_add', icon: 'plus', isCommonMethod: false },
            { label: '编辑工步信息', code: 'processStep_edit', icon: 'edit', isCommonMethod: false },
            { label: '删除', code: 'processStep_delete', icon: 'delete', isCommonMethod: true },
            // {  label: '导出NC程序', code: 'processStep_export', icon: 'import', isCommonMethod: true },
            { label: '导入NC程序', code: 'processStep_import', icon: 'export', isCommonMethod: true }
          ]
        }
      }
src/views/dnc/common/ImportFileModal.vue
@@ -37,7 +37,8 @@
        title: '',
        fileList: [],
        uploadParams: {},
        uploading: false
        uploading: false,
        isUploadMultiple: true
      }
    },
    created() {
@@ -51,6 +52,7 @@
       * @param tableRowInfo 点击表格行右键菜单导入程序时传入行信息
       */
      handleImport(treeNodeInfo, tableRowInfo) {
        this.isUploadMultiple = true
        let attributionId // 文档所属层级Id
        let attributionType  // 文档所属层级类型
        let docClassCode // 文档类型
@@ -67,6 +69,17 @@
        this.visible = true
      },
      handlePush(_, tableRowInfo) {
        this.isUploadMultiple = false
        console.log('tableRowInfo', tableRowInfo)
        this.uploadParams = Object.assign({}, {
          id: tableRowInfo.docId,
          attributionId: tableRowInfo.attributionId,
          docClassCode: tableRowInfo.param
        })
        this.visible = true
      },
      handleRemove(file) {
        const index = this.fileList.indexOf(file)
        const newFileList = this.fileList.slice()
@@ -75,24 +88,40 @@
      },
      beforeUpload(file) {
        if (!this.fileList.find(item => item.name === file.name)) this.fileList = [...this.fileList, file]
        if (this.isUploadMultiple) {
          if (!this.fileList.find(item => item.name === file.name)) this.fileList = [...this.fileList, file]
        } else {
          this.fileList.splice(0, 1, file)
        }
        return false
      },
      handleUpload() {
        const { fileList, $notification } = this
        const { fileList, $notification, isUploadMultiple, uploadParams, $bus } = this
        this.uploading = true
        let uploadedFileCount = 0
        let uploadSuccessFileCount = 0
        let apiMethod
        let params
        fileList.forEach((file, index) => {
          const formData = new FormData()
          formData.append('file', file)
          file.status = 'uploading'
          dncApi.importDocumentFromLocalApi(this.uploadParams, formData)
          // 目前根据是否上传多个文件判断两个功能,若后续增加功能或调整需求则调整判断条件
          if (isUploadMultiple) {
            apiMethod = dncApi.importDocumentFromLocalApi
            params = Object.assign({}, { params: uploadParams, formData })
          } else {
            apiMethod = dncApi.documentVersionUpdateApi
            params = Object.assign({}, { id: uploadParams.id, formData })
          }
          apiMethod(params)
            .then(res => {
              if (res.success) {
                file.status = 'done'
                uploadSuccessFileCount++
                console.log('uploadSuccessFileCount++', uploadSuccessFileCount)
                $notification.success({
                  message: '消息',
                  description: res.message
@@ -111,8 +140,13 @@
            .finally(() => {
              uploadedFileCount++
              fileList.splice(index, 1, file)
              // 当文件全部上传完成后
              if (uploadedFileCount === fileList.length) {
                if (uploadSuccessFileCount > 0) this.$bus.$emit('importFileSuccess', this.uploadParams)
                // 至少有一个文件上传成功后就需要重新加载文档列表
                if (uploadSuccessFileCount > 0) {
                  $bus.$emit('importFileSuccess', uploadParams)
                  if (!isUploadMultiple) this.visible = false //无法连续入库多个版本因此入库成功后即可退出窗口
                }
                this.uploading = false
              }
            })
@@ -131,7 +165,6 @@
        if (this[methodName]) {
          this[methodName](treeNodeInfo, tableRowInfo)
          this.title = modalTitle
        }
      }
    }
src/views/dnc/common/TableContextMenu.vue
@@ -1,7 +1,7 @@
<template>
  <a-menu :style="menuStyle" @click="menuItemClick" v-if="menuVisible" mode="vertical">
    <template v-for="menuItem in defaultContextMenuList[currentMenuLevel]">
      <a-menu-item :key="menuItem.code" v-if="menuItem.show&&menuItem.subMenu.length===0">
    <template v-for="menuItem in defaultContextMenuList[tableRowInfo.param]">
      <a-menu-item :key="menuItem.code" v-has="menuItem.code" v-if="menuItem.subMenu.length===0">
        <a-icon :type="menuItem.icon"/>
        {{menuItem.label}}
      </a-menu-item>
@@ -9,7 +9,7 @@
      <a-sub-menu v-if="menuItem.subMenu.length>0">
        <span slot="title"><a-icon :type="menuItem.icon"/><span>{{menuItem.label}}</span></span>
        <a-menu-item v-for="subMenuItem in menuItem.subMenu" :key="subMenuItem.code" v-if="subMenuItem.show"
        <a-menu-item v-for="subMenuItem in menuItem.subMenu" :key="subMenuItem.code" v-has="subMenuItem.code"
                     style="height: 32px;line-height: 32px">
          <a-icon :type="subMenuItem.icon"/>
          {{subMenuItem.label}}
@@ -41,11 +41,10 @@
        },
        currentMenuLevel: '',
        defaultContextMenuList: {
          //文档
          document: [
          //NC文档
          NC: [
            { label: '编辑文档信息', code: 'document_edit', subMenu: [], icon: 'edit', isCommonMethod: false },
            { label: '指派到设备', code: 'document_assign', subMenu: [], icon: 'cluster', isCommonMethod: false },
            { label: '导出NC程序', code: 'document_export', subMenu: [], icon: 'export', isCommonMethod: true },
            { label: '导入NC程序', code: 'document_import', subMenu: [], icon: 'import', isCommonMethod: true },
            { label: '下载', code: 'document_download', subMenu: [], icon: 'download', isCommonMethod: true },
            { label: '删除', code: 'document_delete', subMenu: [], icon: 'delete', isCommonMethod: true },
@@ -53,12 +52,31 @@
            {
              label: '生命周期',
              subMenu: [
                { label: '出库', code: 'document_pull', icon: 'export', isCommonMethod: false },
                { label: '取消出库', code: 'document_cancel_pull', icon: 'stop', isCommonMethod: false },
                { label: '出库', code: 'document_pull', icon: 'export', isCommonMethod: true },
                { label: '取消出库', code: 'document_cancel_pull', icon: 'stop', isCommonMethod: true },
                { label: '入库', code: 'document_push', icon: 'import', isCommonMethod: true },
                { label: '发布', code: 'document_publish', icon: 'flag', isCommonMethod: false },
                { label: '重新发布', code: 'document_republish', icon: 'reload', isCommonMethod: false },
                { label: '归档', code: 'document_pigeonhole', icon: 'database', isCommonMethod: false }
                { label: '发布', code: 'document_publish', icon: 'flag', isCommonMethod: true },
                { label: '重新发布', code: 'document_republish', icon: 'reload', isCommonMethod: true },
                { label: '归档', code: 'document_pigeonhole', icon: 'database', isCommonMethod: true }
              ],
              icon: 'hourglass'
            }
          ],
          OTHER: [
            { label: '编辑文档信息', code: 'document_edit', subMenu: [], icon: 'edit', isCommonMethod: false },
            { label: '导入文档', code: 'document_import', subMenu: [], icon: 'import', isCommonMethod: true },
            { label: '下载', code: 'document_download', subMenu: [], icon: 'download', isCommonMethod: true },
            { label: '删除', code: 'document_delete', subMenu: [], icon: 'delete', isCommonMethod: true },
            { label: '批量删除', code: 'document_batch_remove', subMenu: [], icon: 'delete', isCommonMethod: false },
            {
              label: '生命周期',
              subMenu: [
                { label: '出库', code: 'document_pull', icon: 'export', isCommonMethod: true },
                { label: '取消出库', code: 'document_cancel_pull', icon: 'stop', isCommonMethod: true },
                { label: '入库', code: 'document_push', icon: 'import', isCommonMethod: true },
                { label: '发布', code: 'document_publish', icon: 'flag', isCommonMethod: true },
                { label: '重新发布', code: 'document_republish', icon: 'reload', isCommonMethod: true },
                { label: '归档', code: 'document_pigeonhole', icon: 'database', isCommonMethod: true }
              ],
              icon: 'hourglass'
            }
@@ -71,16 +89,19 @@
        }
      }
    },
    computed: {
      getCurrentDocumentType() {
        if (this.tableRowInfo.attributionType === 5 || this.tableRowInfo.attributionType === 6) return 'NC'
        else return 'OTHER'
      }
    },
    methods: {
      menuItemClick({ item, key }) {
        const menuKeyArray = key.split('_')
        const isCommonMethod = this.defaultContextMenuList[this.currentMenuLevel].find(item => item.code === key).isCommonMethod
        const menuArrayItem = this.defaultContextMenuList[this.tableRowInfo.param].find(item => item.code === key)
        const subMenuArrayItem = this.defaultContextMenuList[this.tableRowInfo.param].find(item => item.subMenu.length > 0).subMenu.find(item => item.code === key)
        let isCommonMethod, modalTitle
        if (menuArrayItem) {
          isCommonMethod = menuArrayItem.isCommonMethod
          modalTitle = menuArrayItem.label
        } else {
          isCommonMethod = subMenuArrayItem.isCommonMethod
          modalTitle = subMenuArrayItem.label
        }
        let methodName
        // 判断是否为公共方法,如果为公共方法则截取专有属性product/component/part/process等字段
        if (isCommonMethod) {
@@ -90,8 +111,6 @@
          // product_add => handleProcessAdd 触发对应组件事件
          methodName = 'handle' + menuKeyArray.map(item => item[0].toUpperCase() + item.slice(1)).join('')
        }
        const modalTitle = this.defaultContextMenuList[this.currentMenuLevel].find(item => item.code === key).label
        console.log('methodName---------------------------------------', methodName)
        console.log('tableRowInfo---------------------------------------', this.tableRowInfo)
        this.$bus.$emit('tableMenuItemMethodTrigger', {
          methodName,