huangbin hace 4 años
padre
commit
a2d5e420ed

+ 4 - 1
src/common/components/contextMenu/index.vue

@@ -11,6 +11,7 @@
 </template>
 
 <script lang="ts">
+import { watchEffect } from '@vue/runtime-core';
 import { defineComponent, PropType, reactive } from 'vue';
 import contextMenu from './contextMenu.vue';
 import { ContextMenu, MenuItem } from './interface';
@@ -37,7 +38,9 @@ export default defineComponent({
             menuList: props.contextMenuList,
             selectedData: props.selectedRow,
         });
-        function open() {}
+        watchEffect(() => {
+            menuContext.menuList = props.contextMenuList
+        })
         function onContextMenu(value: MouseEvent) {
             if (value.type === 'contextmenu') {
                 // 过滤右键表头

+ 1 - 1
src/common/setup/table/event.ts

@@ -29,7 +29,7 @@ export function getTableEvent<T>(param: TableEventCB) {
             // },
             onContextmenu: () => {  // 表格右键
                 selectedRow.value = record
-                param.contextmenuCB && param.contextmenuCB()
+                param.contextmenuCB && param.contextmenuCB(record)
             },
         };
     }

+ 16 - 6
src/views/platinum/platinum_pick_query/list/tab/index.vue

@@ -2,7 +2,7 @@
   <!-- 提货查询 -->
   <div class="platinum_pick_query_tab">
     <Filter @search="updateColumn" />
-    <contextMenu :contextMenuList="firstBtn">
+    <contextMenu :contextMenuList="btnList">
       <a-table :columns="columns"
                class="topTable hiddenFirstCol"
                :pagination="false"
@@ -24,9 +24,9 @@
           <a>{{ getTakeStateName(record.takemode)}}</a>
         </template>
 
-          <template #userinfotype="{ record }">
-              <a>{{ record.userinfotype === 1 ? '个人' : '企业' }}</a>
-          </template>
+        <template #userinfotype="{ record }">
+          <a>{{ record.userinfotype === 1 ? '个人' : '企业' }}</a>
+        </template>
       </a-table>
     </contextMenu>
     <ControlModal :selectedRow="selectedRow"
@@ -41,6 +41,8 @@ import { queryTableList, handleTableList } from './setup';
 import ControlModal from './compoments/controlModal/index.vue';
 import { QhjTradeGoodsPickup } from '@/services/go/ermcp/qhj/interface';
 import { getPickUpStateName, getTakeStateName } from '@/common/constants/enumsName';
+import { TableEventCB, BtnList as BtnListType } from '@/common/setup/table/interface';
+import { ref } from 'vue';
 
 export default defineComponent({
     name: 'platinum_pick_query_tab',
@@ -48,10 +50,17 @@ export default defineComponent({
     setup() {
         // 表头数据
         const { columns, registerColumn, updateColumn } = getTableColumns();
-        // 表格事件
-        const { expandedRowKeys, selectedRow, Rowclick, btnClick } = getTableEvent<QhjTradeGoodsPickup>({});
         // 表格操作按钮列表
         const [firstBtn] = _getBtnList('platinum_pick_query_tab', true).value;
+        const btnList = ref<BtnListType[]>([]);
+        const event: TableEventCB = {
+            contextmenuCB: (record: QhjTradeGoodsPickup) => {
+                btnList.value = handleTableList(firstBtn, record);
+            },
+        };
+        // 表格事件
+        const { expandedRowKeys, selectedRow, Rowclick, btnClick } = getTableEvent<QhjTradeGoodsPickup>(event);
+
         // 表格列表数据
         const { loading, tableList, queryTable } = queryTableList();
         // 1:备货中  完成备货
@@ -65,6 +74,7 @@ export default defineComponent({
         });
 
         return {
+            btnList,
             columns,
             updateColumn,
             expandedRowKeys,