From 84275ee8a44b1813585651230cfcb9fff0db1074 Mon Sep 17 00:00:00 2001
From: cuilei <ray_tsu1@163.com>
Date: 星期三, 28 五月 2025 00:07:03 +0800
Subject: [PATCH] 工具管理-工具出库:新增方式出库页面
---
src/views/dnc/common/TableContextMenu.vue | 143 +++++++++++++++++++++++++++++++++++++++--------
1 files changed, 117 insertions(+), 26 deletions(-)
diff --git a/src/views/dnc/common/TableContextMenu.vue b/src/views/dnc/common/TableContextMenu.vue
index dd10da2..ba41200 100644
--- a/src/views/dnc/common/TableContextMenu.vue
+++ b/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}}
@@ -24,7 +24,7 @@
name: 'TableContextMenu',
components: {},
props: {
- currentTableRowInfo: {
+ tableRowInfo: {
type: Object
}
},
@@ -41,39 +41,130 @@
},
currentMenuLevel: '',
defaultContextMenuList: {
- //鏂囨。
- document: [
- { show: true, label: '缂栬緫鏂囨。淇℃伅', code: 'document_edit', subMenu: [], icon: 'edit' },
- { show: true, label: '鎸囨淳鍒拌澶�', code: 'document_assign', subMenu: [], icon: 'cluster' },
- { show: false, label: '瀵煎嚭NC绋嬪簭', code: 'document_export', subMenu: [], icon: 'export' },
- { show: true, label: '瀵煎叆NC绋嬪簭', code: 'document_import', subMenu: [], icon: 'import' },
- { show: true, label: '涓嬭浇', code: 'document_download', subMenu: [], icon: 'download' },
- { show: true, label: '鍒犻櫎', code: 'document_delete', subMenu: [], icon: 'delete' },
- { show: true, label: '鎵归噺鍒犻櫎', code: 'document_batch_remove', subMenu: [], icon: 'delete' },
+ //璁惧绫�
+ deviceCustomType:[
+ { label: '缂栬緫璁惧绫讳俊鎭�', code: 'type_edit', subMenu: [], icon: 'edit', isCommonMethod: false },
+ { label: '鍒犻櫎', code: 'type_delete', subMenu: [], icon: 'delete', isCommonMethod: false },
+ { label: '瀵煎叆NC绋嬪簭', code: 'type_nc_import', subMenu: [], icon: 'import', isCommonMethod: true },
+ ],
+ //NC鏂囨。
+ NC: [
+ { label: '缂栬緫鏂囨。淇℃伅', code: 'document_edit', subMenu: [], icon: 'edit', isCommonMethod: false },
+ { label: '鎸囨淳鍒拌澶�', code: 'document_assign', subMenu: [], icon: 'cluster', isCommonMethod: false },
+ { label: '瀵煎叆NC绋嬪簭', code: 'document_nc_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: true },
{
- show: true,
label: '鐢熷懡鍛ㄦ湡',
subMenu: [
- { show: true, label: '鍑哄簱', code: 'document_pull', icon: 'export' },
- { show: true, label: '鍙栨秷鍑哄簱', code: 'document_cancel_pull', icon: 'stop' },
- { show: true, label: '鍏ュ簱', code: 'document_push', icon: 'import' },
- { show: true, label: '鍙戝竷', code: 'document_publish', icon: 'flag' },
- { show: true, label: '閲嶆柊鍙戝竷', code: 'document_republish', icon: 'reload' },
- { show: true, label: '褰掓。', code: 'document_pigeonhole', icon: 'database' }
+ { 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: 'delete'
+ icon: 'hourglass'
}
+ ],
+ //鍏跺畠鏂囨。
+ OTHER: [
+ { label: '缂栬緫鏂囨。淇℃伅', code: 'document_edit', subMenu: [], icon: 'edit', isCommonMethod: false },
+ { label: '瀵煎叆鏂囨。', code: 'document_other_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: true },
+ {
+ 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'
+ }
+ ],
+ //宸插彂閫佹枃妗�
+ SEND: [
+ { label: '缂栬緫鏂囨。淇℃伅', code: 'document_edit', subMenu: [], icon: 'edit', isCommonMethod: false },
+ { label: '瀵煎叆NC绋嬪簭', code: 'document_nc_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: true },
+ {
+ 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'
+ }
+ ],
+ //宸叉帴鏀舵枃妗�
+ REC: [
+ { label: '缂栬緫鏂囨。淇℃伅', code: 'document_edit', subMenu: [], icon: 'edit', isCommonMethod: false },
+ { label: '瀵煎叆NC绋嬪簭', code: 'document_nc_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: true },
+ {
+ 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'
+ }
+ ],
+ //鏂囦欢
+ file: [
+ { label: '鎸囧畾褰撳墠鐗堟湰', code: 'file_assign', subMenu: [], icon: 'highlight', isCommonMethod: false },//鏂囦欢-鎸囧畾褰撳墠鐗堟湰
+ { label: '姣斿', code: 'file_add_relative', subMenu: [], icon: 'interaction', isCommonMethod: false }//姣斿
]
}
}
},
methods: {
menuItemClick({ item, key }) {
- // process_add => handleProcessAdd 瑙﹀彂瀵瑰簲缁勪欢浜嬩欢
- const methodName = 'handle' + key.split('_').map(item => item[0].toUpperCase() + item.slice(1)).join('')
- const modalTitle = this.defaultContextMenuList[this.currentMenuLevel].find(item => item.code === key).label
- console.log('key', key)
- this.$bus.$emit('menuItemMethodTrigger', { level: this.currentMenuLevel, methodName, modalTitle })
+ const menuKeyArray = key.split('_')
+ const menuArrayItem = this.defaultContextMenuList[this.tableRowInfo.param].find(item => item.code === key)
+ let isCommonMethod, modalTitle
+ if (menuArrayItem) {
+ isCommonMethod = menuArrayItem.isCommonMethod
+ modalTitle = menuArrayItem.label
+ } else {
+ const subMenuArrayItem = this.defaultContextMenuList[this.tableRowInfo.param].find(item => item.subMenu.length > 0).subMenu.find(item => item.code === key)
+ isCommonMethod = subMenuArrayItem.isCommonMethod
+ modalTitle = subMenuArrayItem.label
+ }
+ let methodName
+ // 鍒ゆ柇鏄惁涓哄叕鍏辨柟娉曪紝濡傛灉涓哄叕鍏辨柟娉曞垯鎴彇涓撴湁灞炴�roduct/component/part/process绛夊瓧娈�
+ if (isCommonMethod) {
+ // product_add => handleAdd 瑙﹀彂鍏叡鐖剁骇缁勪欢浜嬩欢
+ methodName = 'handle' + menuKeyArray.map(item => item[0].toUpperCase() + item.slice(1)).slice(1).join('')
+ } else {
+ // product_add => handleProcessAdd 瑙﹀彂瀵瑰簲缁勪欢浜嬩欢
+ methodName = 'handle' + menuKeyArray.map(item => item[0].toUpperCase() + item.slice(1)).join('')
+ }
+ console.log('tableRowInfo---------------------------------------', this.tableRowInfo)
+ console.log('methodName---------------------------------------', methodName)
+ this.$bus.$emit('tableMenuItemMethodTrigger', {
+ methodName,
+ modalTitle,
+ tableRowInfo: this.tableRowInfo
+ })
}
}
}
--
Gitblit v1.9.3