huangbin 4 år sedan
förälder
incheckning
dcc0e5e794

+ 18 - 1
src/common/setup/table/compose.ts

@@ -171,6 +171,19 @@ export function handleTableEventAndData<T>({ queryFn, columnsList, clickName }:
             queryFn()
         }
     }
+    /**
+ * 打开组件
+ * @param item
+ * @param record
+ */
+    function openComponent(item: BtnListType, record: T) {
+        console.log('打开组件: ', item.code)
+        // 更新点击的数据,处理例如,修改之后,再次打开页面是之前的数据的问题
+        if (record && selectedRow) {
+            selectedRow.value = record
+        }
+        componentId.value = item.code;
+    }
     // 右键回调函数
     const eventsCB: TableEventCB = {
         contextmenuCB: (record: T, value: ContextMenuTemp) => {
@@ -181,6 +194,10 @@ export function handleTableEventAndData<T>({ queryFn, columnsList, clickName }:
             clickName && (componentId.value = clickName)
         }
     }
+    initData(() => {
+        // 获取列表数据
+        queryFn();
+    })
     // 表格事件
     const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<T>(eventsCB);
     // 关闭右键
@@ -194,6 +211,6 @@ export function handleTableEventAndData<T>({ queryFn, columnsList, clickName }:
         contextMenu, openContext, closeContext, // 右键
         columns, updateColumn,  // 表头
         expandedRowKeys, selectedRow, Rowclick, // 表格折腾面板数据与单击、双击事件
-        componentId, closeComponent,  // 控制异步组件
+        componentId, closeComponent, openComponent,  // 控制异步组件
     }
 }

+ 20 - 13
src/views/market/spot_trade/spot_trade_order_transaction/components/buy-market/index.vue

@@ -19,6 +19,9 @@
                class="btn-list-sticky"
                @click="openComponent" />
     </template>
+    <template #fixedprice="{record }">
+      <span>{{record.useorderpricerid }}</span>
+    </template>
     <template #username="{text, record }">
       <span>{{record.userid + " "}}{{text}}</span>
     </template>
@@ -32,19 +35,19 @@
 </template>
 
 <script lang="ts">
-import { EnumRouterName } from '@/common/constants/enumRouterName';
-import { ComposeTableParam, BtnList, defineComponent, handleComposeTable, queryTableList, ModalEnum } from '@/common/export/commonTable';
+import { BtnList, defineComponent, queryTableList } from '@/common/export/commonTable';
 import { _closeModal } from '@/common/setup/modal/modal';
-import { queryOrderQuoteDetail, queryWrTradeOrderDetail } from '@/services/go/wrtrade';
-import { QueryOrderQuoteDetailReq, WrOrderQuote, WrOrderQuoteDetail, WrTradeOrderDetailReq } from '@/services/go/wrtrade/interface';
+import { queryWrTradeOrderDetail } from '@/services/go/wrtrade';
+import { WrOrderQuote, WrOrderQuoteDetail, WrTradeOrderDetailReq } from '@/services/go/wrtrade/interface';
 import { defineAsyncComponent, PropType } from 'vue';
 import { BtnListType } from '@/common/components/btnList/interface';
 import { BuyOrSell } from '@/common/constants/enumCommon';
 import { expandIcon } from '@/common/setup/table/clolumn';
 import { ColumnType } from '@/common/methods/table/interface';
-import { Moment } from 'moment';
-import moment from 'moment';
+
 import { getShowBottomValue } from '@/common/config/constrolBottom';
+import { TableParam } from '@/common/setup/table/interface';
+import { handleTableEventAndData } from '@/common/setup/table/compose';
 
 export default defineComponent({
     emits: ['cancel', 'openComponent'],
@@ -63,7 +66,14 @@ export default defineComponent({
         const isBottom = getShowBottomValue();
         // 表格列表数据
         const { loading, tableList, queryTable } = queryTableList<WrOrderQuoteDetail>();
+        const columnsList = [
+            { title: '序号', key: 'index' },
+            { title: '买价', key: 'orderprice' },
+            { title: '买量', key: 'orderqty' },
+            { title: '购买方', key: 'username' },
+        ];
         const btnListData: BtnListType[] = [{ lable: '摘牌', code: 'Delisting', className: 'operBtn' }];
+
         // 获取列表数据
         const queryTableAction = () => {
             const param: WrTradeOrderDetailReq = {
@@ -72,13 +82,9 @@ export default defineComponent({
             };
             queryTable(queryWrTradeOrderDetail, param);
         };
-        // 表格通用逻辑
-        const param: ComposeTableParam = {
+        const param: TableParam = {
+            columnsList,
             queryFn: queryTableAction,
-            menuType: EnumRouterName.warehouse_receipt_trade_price,
-            tableName: 'table_pcweb_spot_trade_warehouse_price_trading_hall_buy',
-            tableFilterKey: [],
-            isDetail: false,
         };
         function handleColumn(columns: ColumnType[]) {
             columns.forEach((item) => {
@@ -90,7 +96,7 @@ export default defineComponent({
         }
         return {
             isBottom,
-            ...handleComposeTable<WrOrderQuoteDetail>(param),
+            ...handleTableEventAndData(param),
             queryTableAction,
             BuyOrSell,
             loading,
@@ -98,6 +104,7 @@ export default defineComponent({
             expandIcon,
             handleColumn,
             btnListData,
+            columnsList,
         };
     },
 });

+ 18 - 12
src/views/market/spot_trade/spot_trade_order_transaction/components/sell-market/index.vue

@@ -20,6 +20,9 @@
     <template #username="{text, record }">
       <span>{{record.userid + " " }}{{text}}</span>
     </template>
+    <template #fixedprice="{record }">
+      <span>{{record.useorderpricerid }}</span>
+    </template>
   </a-table>
   <component :is="componentId"
              v-if="componentId"
@@ -30,19 +33,18 @@
 </template>
 
 <script lang="ts">
-import { EnumRouterName } from '@/common/constants/enumRouterName';
-import { ComposeTableParam, BtnList, defineComponent, handleComposeTable, queryTableList, ModalEnum } from '@/common/export/commonTable';
+import { BtnList, defineComponent, queryTableList } from '@/common/export/commonTable';
 import { _closeModal } from '@/common/setup/modal/modal';
-import { queryOrderQuoteDetail, queryWrTradeOrderDetail } from '@/services/go/wrtrade';
-import { QueryOrderQuoteDetailReq, WrOrderQuote, WrOrderQuoteDetail, WrTradeOrderDetailReq } from '@/services/go/wrtrade/interface';
+import { queryWrTradeOrderDetail } from '@/services/go/wrtrade';
+import { WrOrderQuote, WrOrderQuoteDetail, WrTradeOrderDetailReq } from '@/services/go/wrtrade/interface';
 import { defineAsyncComponent, PropType } from 'vue';
 import { BtnListType } from '@/common/components/btnList/interface';
 import { BuyOrSell } from '@/common/constants/enumCommon';
 import { expandIcon } from '@/common/setup/table/clolumn';
 import { ColumnType } from '@/common/methods/table/interface';
-import { Moment } from 'moment';
-import moment from 'moment';
 import { getShowBottomValue } from '@/common/config/constrolBottom';
+import { TableParam } from '@/common/setup/table/interface';
+import { handleTableEventAndData } from '@/common/setup/table/compose';
 
 export default defineComponent({
     emits: ['cancel', 'openComponent'],
@@ -62,6 +64,13 @@ export default defineComponent({
         console.log(isBottom.value, 'isBottom');
         // 表格列表数据
         const { loading, tableList, queryTable } = queryTableList<WrOrderQuoteDetail>();
+        const columnsList = [
+            { title: '序号', key: 'index' },
+            { title: '销售方', key: 'username' },
+            { title: '买量', key: 'orderqty' },
+
+            { title: '买价', key: 'orderprice' },
+        ];
         const btnListData: BtnListType[] = [{ lable: '摘牌', code: 'Delisting', className: 'operBtn' }];
         // 获取列表数据
         const queryTableAction = () => {
@@ -72,12 +81,9 @@ export default defineComponent({
             queryTable(queryWrTradeOrderDetail, param);
         };
         // 表格通用逻辑
-        const param: ComposeTableParam = {
+        const param: TableParam = {
+            columnsList,
             queryFn: queryTableAction,
-            menuType: EnumRouterName.warehouse_receipt_trade_floating_price,
-            tableName: 'table_pcweb_spot_trade_warehouse_price_trading_hall_sale',
-            tableFilterKey: [],
-            isDetail: false,
         };
         function handleColumn(columns: ColumnType[]) {
             columns.forEach((item) => {
@@ -91,7 +97,7 @@ export default defineComponent({
         }
         return {
             isBottom,
-            ...handleComposeTable<WrOrderQuoteDetail>(param),
+            ...handleTableEventAndData(param),
             queryTableAction,
             loading,
             tableList,

+ 1 - 1
src/views/market/spot_trade/spot_trade_order_transaction/setup.ts

@@ -55,4 +55,4 @@ export const columnsList = [
     { title: '昨收价', key: 'preclose' },
     { title: '最低价', key: 'lowest' },
     { title: '最高价', key: 'highest' },
-];
+];

+ 1 - 2
src/views/market/spot_trade/spot_trade_order_transaction/spot_trade_order_transaction_basis_difference/index.vue

@@ -5,7 +5,6 @@
              class="srcollYTable"
              :scroll="{ x: '100%', y: 'calc(100vh - 479px)' }"
              :pagination="false"
-             :loading="loading"
              :expandedRowKeys="expandedRowKeys"
              :customRow="Rowclick"
              rowKey="key"
@@ -13,7 +12,7 @@
     <!-- 右键 -->
     <contextMenu :contextMenu="contextMenu"
                  @cancel="closeContext"
-                 :list="firstBtn"></contextMenu>
+                 :list="btnList"></contextMenu>
     <component :is="componentId"
                v-if="componentId"
                :selectedRow="selectedRow"