1、产品结构树页面完成文档生命周期相关功能,待后续开发至文档版本列表时继续完善与生命周期功能的关联
2、删除导出文档或NC程序功能
| | |
| | | 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}`) |
| | | } |
| | |
| | | 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({ |
| | |
| | | } |
| | | |
| | | //deleteAction |
| | | export function deleteAction(url,parameter) { |
| | | export function deleteAction(url, parameter) { |
| | | return axios({ |
| | | url: url, |
| | | method: 'delete', |
| | |
| | | // url = url + '?' + query; |
| | | return axios({ |
| | | url: url, |
| | | method:'put', |
| | | method: 'put', |
| | | data: parameter, |
| | | params:params |
| | | params: params |
| | | }) |
| | | } |
| | | |
| | |
| | | * @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, |
| | |
| | | } |
| | | |
| | | /** |
| | | * 下载文件 |
| | | * @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' // 文件上传 |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | * @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 |
| | | } |
| | | } |
| | |
| | | <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> |
| | |
| | | ], |
| | | }, |
| | | url: { |
| | | add: '/mdc/mdcPartProcessInfo/add', |
| | | edit: '/mdc/mdcPartProcessInfo/edit' |
| | | } |
| | | } |
| | |
| | | }, |
| | | { 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' } |
| | | ], |
| | |
| | | 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 |
| | | } |
| | |
| | | on: { |
| | | contextmenu: event => { |
| | | event.preventDefault() |
| | | this.$emit('handleTableContextMenuOpen', { ...record, param: 'document' }) |
| | | this.$emit('handleTableContextMenuOpen', { ...record, param: 'NC' }) |
| | | }, |
| | | click: () => { |
| | | this.$bus.$emit('sendCurrentLevelInfo', record) |
| | |
| | | }, |
| | | { 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' } |
| | | ], |
| | |
| | | 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 |
| | | } |
| | |
| | | on: { |
| | | contextmenu: event => { |
| | | event.preventDefault() |
| | | this.$emit('handleTableContextMenuOpen', { ...record, param: 'document' }) |
| | | this.$emit('handleTableContextMenuOpen', { ...record, param: 'OTHER' }) |
| | | }, |
| | | click: () => { |
| | | this.$bus.$emit('sendCurrentLevelInfo', record) |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import dncApi from '@/api/dnc' |
| | | import NcDocumentTableList from './Document/NcDocumentTableList' |
| | | import OtherDocumentTableList from './Document/OtherDocumentTableList' |
| | | import TableContextMenu from '../../../common/TableContextMenu' |
| | |
| | | created() { |
| | | this.$bus.$on('sendCurrentTreeNodeInfo', this.receiveCurrentTreeNodeInfo) |
| | | this.$bus.$on('importFileSuccess', this.reloadDocumentListData) |
| | | this.$bus.$on('tableMenuItemMethodTrigger', this.triggerCorrespondingMethod) |
| | | }, |
| | | methods: { |
| | | /** |
| | |
| | | */ |
| | | 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' |
| | |
| | | }, |
| | | |
| | | /** |
| | | * 上传文件成功后触发 |
| | | * 文档以及NC程序导入/出库/入库成功后触发重新加载文档列表 |
| | | * @param docClassCode 文档类别 |
| | | * @param attributionId 节点Id |
| | | */ |
| | |
| | | }, |
| | | |
| | | /** |
| | | * 点击下载时触发下载当前文档 |
| | | */ |
| | | 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) |
| | | } |
| | | } |
| | | } |
| | |
| | | <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> |
| | | 产品 |
| | |
| | | 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 } |
| | | ] |
| | | } |
| | | } |
| | |
| | | title: '', |
| | | fileList: [], |
| | | uploadParams: {}, |
| | | uploading: false |
| | | uploading: false, |
| | | isUploadMultiple: true |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | * @param tableRowInfo 点击表格行右键菜单导入程序时传入行信息 |
| | | */ |
| | | handleImport(treeNodeInfo, tableRowInfo) { |
| | | this.isUploadMultiple = true |
| | | let attributionId // 文档所属层级Id |
| | | let attributionType // 文档所属层级类型 |
| | | let docClassCode // 文档类型 |
| | |
| | | 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() |
| | |
| | | }, |
| | | |
| | | 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 |
| | |
| | | .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 |
| | | } |
| | | }) |
| | |
| | | if (this[methodName]) { |
| | | this[methodName](treeNodeInfo, tableRowInfo) |
| | | this.title = modalTitle |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | <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> |
| | |
| | | <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}} |
| | |
| | | }, |
| | | 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 }, |
| | |
| | | { |
| | | 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' |
| | | } |
| | |
| | | } |
| | | } |
| | | }, |
| | | 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) { |
| | |
| | | // 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, |