|
@@ -9,49 +9,21 @@ import { OperationTabMenu } from '@/services/go/commonService/interface';
|
|
|
import { onUnmounted, ref } from "vue";
|
|
import { onUnmounted, ref } from "vue";
|
|
|
import { BuyAndSellMarket } from './interface';
|
|
import { BuyAndSellMarket } from './interface';
|
|
|
|
|
|
|
|
-// 报价大厅操作按钮列表
|
|
|
|
|
-const priceBtnList = ref<BtnList[]>([])
|
|
|
|
|
|
|
+const buyAndSellEunm = 'buyAndSell'
|
|
|
|
|
|
|
|
-// 买大厅数据
|
|
|
|
|
-const buyMarket: BuyAndSellMarket = {
|
|
|
|
|
- isMarket: true,
|
|
|
|
|
- btnList: []
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-// 卖大厅数据
|
|
|
|
|
-const sellMarket: BuyAndSellMarket = {
|
|
|
|
|
- isMarket: true,
|
|
|
|
|
- btnList: []
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-// 表格 + 表头 + 右键 + 单击表格 + 按钮列表 通用处理逻辑
|
|
|
|
|
-export function handleComposeTable<T>({ queryFn, menuType, isDetail, tableName, tableFilterKey }: ComposeTableParam) {
|
|
|
|
|
- // 右键逻辑
|
|
|
|
|
- const { contextMenu, openContext, closeContext: closeContextAction } = handleContextMenu();
|
|
|
|
|
- // 表头数据
|
|
|
|
|
- const { columns, registerColumn, updateColumn } = getTableColumns();
|
|
|
|
|
- // 控制异步组件
|
|
|
|
|
- const componentId = ref<string>('');
|
|
|
|
|
- // 关闭组件
|
|
|
|
|
- function closeComponent(isRefresh: boolean) {
|
|
|
|
|
- componentId.value = '';
|
|
|
|
|
- if (isRefresh) {
|
|
|
|
|
- queryFn()
|
|
|
|
|
- }
|
|
|
|
|
|
|
+export function handleSpotBtnList(menuType: EnumRouterName) {
|
|
|
|
|
+ let firstBtn: BtnList[] = []
|
|
|
|
|
+ // 买大厅数据
|
|
|
|
|
+ const buyMarket: BuyAndSellMarket = {
|
|
|
|
|
+ isMarket: true,
|
|
|
|
|
+ btnList: []
|
|
|
}
|
|
}
|
|
|
- // 右键回调函数
|
|
|
|
|
- const eventsCB: TableEventCB = {
|
|
|
|
|
- contextmenuCB: (record: T, value: ContextMenuTemp) => {
|
|
|
|
|
- // 控制打开右键
|
|
|
|
|
- contextMenu.value = value
|
|
|
|
|
- },
|
|
|
|
|
- clickCB: (record: T) => {
|
|
|
|
|
- componentId.value = 'warehouse_receipt_trade_floating_price_delisting'
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 卖大厅数据
|
|
|
|
|
+ const sellMarket: BuyAndSellMarket = {
|
|
|
|
|
+ isMarket: true,
|
|
|
|
|
+ btnList: []
|
|
|
}
|
|
}
|
|
|
- // 表格事件
|
|
|
|
|
- const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<T>(eventsCB);
|
|
|
|
|
// 表格操作按钮列表
|
|
// 表格操作按钮列表
|
|
|
const list = findChildList(menuType);
|
|
const list = findChildList(menuType);
|
|
|
if (list) {
|
|
if (list) {
|
|
@@ -63,8 +35,7 @@ export function handleComposeTable<T>({ queryFn, menuType, isDetail, tableName,
|
|
|
}
|
|
}
|
|
|
// 过滤报价大厅按钮列表
|
|
// 过滤报价大厅按钮列表
|
|
|
const temp = list.children.filter(e => e.type === 2)
|
|
const temp = list.children.filter(e => e.type === 2)
|
|
|
- priceBtnList.value = fnMap(temp)
|
|
|
|
|
- priceBtnList.value.push({ lable: '买卖大厅', code: 'buyAndSell', className: 'btnPrimary' })
|
|
|
|
|
|
|
+ firstBtn = fnMap(temp)
|
|
|
|
|
|
|
|
const fn = (code: EnumRouterName) => {
|
|
const fn = (code: EnumRouterName) => {
|
|
|
const findResult = list.children.find(e => e.code === code)
|
|
const findResult = list.children.find(e => e.code === code)
|
|
@@ -82,6 +53,39 @@ export function handleComposeTable<T>({ queryFn, menuType, isDetail, tableName,
|
|
|
// 处理卖大厅
|
|
// 处理卖大厅
|
|
|
Object.assign(sellMarket, fn(EnumRouterName.spot_trade_warehouse_sell_hall))
|
|
Object.assign(sellMarket, fn(EnumRouterName.spot_trade_warehouse_sell_hall))
|
|
|
}
|
|
}
|
|
|
|
|
+ return { firstBtn, buyMarket, sellMarket }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 表格 + 表头 + 右键 + 单击表格 + 按钮列表 通用处理逻辑
|
|
|
|
|
+export function handleComposeTable<T>({ queryFn, menuType, isDetail, tableName, tableFilterKey }: ComposeTableParam) {
|
|
|
|
|
+ // 右键逻辑
|
|
|
|
|
+ const { contextMenu, openContext, closeContext: closeContextAction } = handleContextMenu();
|
|
|
|
|
+ // 表头数据
|
|
|
|
|
+ const { columns, registerColumn, updateColumn } = getTableColumns();
|
|
|
|
|
+ // 控制异步组件
|
|
|
|
|
+ const componentId = ref<string>('');
|
|
|
|
|
+ // 关闭组件
|
|
|
|
|
+ function closeComponent(isRefresh: boolean) {
|
|
|
|
|
+ componentId.value = '';
|
|
|
|
|
+ if (isRefresh) {
|
|
|
|
|
+ queryFn()
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 右键回调函数
|
|
|
|
|
+ const eventsCB: TableEventCB = {
|
|
|
|
|
+ contextmenuCB: (record: T, value: ContextMenuTemp) => {
|
|
|
|
|
+ // 控制打开右键
|
|
|
|
|
+ contextMenu.value = value
|
|
|
|
|
+ },
|
|
|
|
|
+ clickCB: (record: T) => {
|
|
|
|
|
+ componentId.value = buyAndSellEunm
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 表格事件
|
|
|
|
|
+ const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<T>(eventsCB);
|
|
|
|
|
+ // 表格操作按钮列表
|
|
|
|
|
+ const { firstBtn } = handleSpotBtnList(menuType)
|
|
|
|
|
+ firstBtn.push({ lable: '买卖大厅', code: buyAndSellEunm, className: 'btnPrimary' })
|
|
|
|
|
|
|
|
// 关闭右键
|
|
// 关闭右键
|
|
|
function closeContext(value: BtnList | null) {
|
|
function closeContext(value: BtnList | null) {
|
|
@@ -104,10 +108,6 @@ export function handleComposeTable<T>({ queryFn, menuType, isDetail, tableName,
|
|
|
columns, registerColumn, updateColumn, // 表头
|
|
columns, registerColumn, updateColumn, // 表头
|
|
|
expandedRowKeys, selectedRow, Rowclick, // 表格折腾面板数据与单击、双击事件
|
|
expandedRowKeys, selectedRow, Rowclick, // 表格折腾面板数据与单击、双击事件
|
|
|
componentId, closeComponent, // 控制异步组件
|
|
componentId, closeComponent, // 控制异步组件
|
|
|
- firstBtn: priceBtnList, // 表格按钮
|
|
|
|
|
|
|
+ firstBtn, // 表格按钮
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-export function getBuyAndSellMarketData() {
|
|
|
|
|
- return { buyMarket, sellMarket }
|
|
|
|
|
-}
|
|
|