文件名从 src/views/dnc/common/modules/ProductStructureTree/ProductStructureTreeContextMenu.vue 修改 |
| | |
| | | <template #overlay> |
| | | <a-menu @click="({ key: menuKey }) => onContextMenuClick(treeParams.treeKey, menuKey)" |
| | | @contextmenu="event=>event.preventDefault()"> |
| | | <template v-for="item in defaultContextMenuList[getCurrentMenuLevel]"> |
| | | <a-menu-item :key="item.code" v-if="item.show"> |
| | | <a-icon :type="item.icon"/> |
| | | {{item.label}} |
| | | </a-menu-item> |
| | | </template> |
| | | <a-menu-item v-for="item in defaultContextMenuList[getCurrentMenuLevel]" :key="item.code" v-has="item.code"> |
| | | <a-icon :type="item.icon"/> |
| | | {{item.label}} |
| | | </a-menu-item> |
| | | </a-menu> |
| | | </template> |
| | | </a-dropdown> |
| | |
| | | //宸ュ簭 |
| | | 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 } |
| | | ], |
| | | //宸ユ |
| | | 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 } |
| | | ] |
| | | } |
| | | } |
| | |
| | | return 'component' |
| | | case 3: |
| | | return 'part' |
| | | case 4: |
| | | return 'process' |
| | | case 5: |
| | | return 'process' |
| | | case 6: |
| | | return 'processStep' |
| | | } |
| | | } |
| | |
| | | methods: { |
| | | onContextMenuClick(treeKey, menuKey) { |
| | | const level = this.getCurrentMenuLevel |
| | | console.log('level---------------------', level) |
| | | const menuKeyArray = menuKey.split('_') |
| | | const isCommonMethod = this.defaultContextMenuList[level].find(item => item.code === menuKey).isCommonMethod |
| | | // product_add => handleAdd 瑙﹀彂瀵瑰簲缁勪欢浜嬩欢 |
| | |
| | | methodName = 'handle' + menuKeyArray.map(item => item[0].toUpperCase() + item.slice(1)).join('') |
| | | } |
| | | console.log('methodName------------------------------------', methodName) |
| | | console.log('treeParams------------------------------------', this.treeParams) |
| | | const modalTitle = this.defaultContextMenuList[level].find(item => item.code === menuKey).label |
| | | this.$bus.$emit('treeMenuItemMethodTrigger', { methodName, modalTitle }) |
| | | this.$bus.$emit('treeMenuItemMethodTrigger', { methodName, modalTitle, treeNodeInfo: this.treeParams }) |
| | | } |
| | | } |
| | | } |