huangbin 4 years ago
parent
commit
0ea436da65

+ 11 - 11
src/common/setup/table/button.ts

@@ -176,17 +176,17 @@ export function getBtnList_(menuType: EnumRouterName, hasDetail: boolean) {
     const data = getThirdMenuData()
     let list: OperationTabMenu | undefined = undefined
     // 这里处理有两层路由菜单
-    data.map(el => {
-        if (el.code === menuType) {
-            list = el
-            return;
-        }
-        el.children.map(e => {
-            if (e.code === menuType) {
-                list = e
-                return;
+    function findFn(arr: OperationTabMenu[]) {
+        for (let item of arr) {
+            if (item.code === menuType) {
+                list = item
+                return
+            } else {
+                findFn(item.children)
             }
-        })
-    })
+        }
+        return null
+    }
+    findFn(data)
     return _handleBtnList_(list, hasDetail)
 }

+ 66 - 0
src/views/market/spot_trade/components/buy-sell-market/components/buy/index.vue

@@ -0,0 +1,66 @@
+<template>
+  <!-- 买大厅 -->
+  <a-table :columns="columns"
+           class="srcollYTable"
+           :scroll="{ x: '100%', y: 'calc(100vh - 163px)' }"
+           :pagination="false"
+           :loading="loading"
+           :expandedRowKeys="expandedRowKeys"
+           :customRow="Rowclick"
+           rowKey="key"
+           :data-source="tableList"></a-table>
+
+</template>
+
+<script lang="ts">
+import { EnumRouterName } from '@/common/constants/enumRouterName';
+import { ComposeTableParam, defineComponent, handleComposeTable, ModalEnum, queryTableList } from '@/common/export/commonTable';
+import { _closeModal } from '@/common/setup/modal/modal';
+import { queryAgreementConfig } from '@/services/go/ermcp/qhj';
+import { queryOrderQuoteDetail } from '@/services/go/wrtrade';
+import { QueryOrderQuoteDetailReq, WrOrderQuoteDetail } from '@/services/go/wrtrade/interface';
+
+export default defineComponent({
+    emits: ['cancel'],
+    name: 'warehouse_receipt_trade_price_delisting_buy',
+    props: {},
+    setup(props, context) {
+        // 表格列表数据
+        const { loading, tableList, queryTable } = queryTableList<WrOrderQuoteDetail>();
+        // 获取列表数据
+        const queryTableAction = () => {
+            // const param: QueryOrderQuoteReq = {
+            //     wrpricetype: 2,
+            //     haswr: 1,
+            // };
+            // queryTable(queryOrderQuote, param);
+            queryTable(queryAgreementConfig);
+        };
+        // 表格通用逻辑
+        const param: ComposeTableParam = {
+            queryFn: queryTableAction,
+            menuType: EnumRouterName.warehouse_receipt_trade_floating_price,
+            tableName: 'table_pcweb_agreement',
+            tableFilterKey: [],
+            isDetail: false,
+        };
+        return {
+            ...handleComposeTable<WrOrderQuoteDetail>(param),
+            loading,
+            tableList,
+        };
+    },
+});
+</script>
+<style lang="less">
+.buy-sell-market {
+    position: absolute;
+    z-index: 99;
+    top: 0;
+    height: 100%;
+    width: 100%;
+    bottom: 30px;
+    background: #fff;
+    left: 0;
+}
+</style>

+ 66 - 0
src/views/market/spot_trade/components/buy-sell-market/components/sell/index.vue

@@ -0,0 +1,66 @@
+<template>
+  <!-- 卖大厅 -->
+  <a-table :columns="columns"
+           class="srcollYTable"
+           :scroll="{ x: '100%', y: 'calc(100vh - 163px)' }"
+           :pagination="false"
+           :loading="loading"
+           :expandedRowKeys="expandedRowKeys"
+           :customRow="Rowclick"
+           rowKey="key"
+           :data-source="tableList"></a-table>
+
+</template>
+
+<script lang="ts">
+import { EnumRouterName } from '@/common/constants/enumRouterName';
+import { ComposeTableParam, defineComponent, handleComposeTable, ModalEnum, queryTableList } from '@/common/export/commonTable';
+import { _closeModal } from '@/common/setup/modal/modal';
+import { queryAgreementConfig } from '@/services/go/ermcp/qhj';
+import { queryOrderQuoteDetail } from '@/services/go/wrtrade';
+import { QueryOrderQuoteDetailReq, WrOrderQuoteDetail } from '@/services/go/wrtrade/interface';
+
+export default defineComponent({
+    emits: ['cancel'],
+    name: 'warehouse_receipt_trade_price_delisting_sell',
+    props: {},
+    setup(props, context) {
+        // 表格列表数据
+        const { loading, tableList, queryTable } = queryTableList<WrOrderQuoteDetail>();
+        // 获取列表数据
+        const queryTableAction = () => {
+            // const param: QueryOrderQuoteReq = {
+            //     wrpricetype: 2,
+            //     haswr: 1,
+            // };
+            // queryTable(queryOrderQuote, param);
+            queryTable(queryAgreementConfig);
+        };
+        // 表格通用逻辑
+        const param: ComposeTableParam = {
+            queryFn: queryTableAction,
+            menuType: EnumRouterName.warehouse_receipt_trade_floating_price,
+            tableName: 'table_pcweb_agreement',
+            tableFilterKey: [],
+            isDetail: false,
+        };
+        return {
+            ...handleComposeTable<WrOrderQuoteDetail>(param),
+            loading,
+            tableList,
+        };
+    },
+});
+</script>
+<style lang="less">
+.buy-sell-market {
+    position: absolute;
+    z-index: 99;
+    top: 0;
+    height: 100%;
+    width: 100%;
+    bottom: 30px;
+    background: #fff;
+    left: 0;
+}
+</style>

+ 35 - 3
src/views/market/spot_trade/components/buy-sell-market/index.vue

@@ -1,19 +1,51 @@
 <template>
   <!-- 买卖大厅 -->
-  <div class="buy-sell-market">买卖大厅
-    <button @click="cancel">关闭</button>
+  <div class="buy-sell-market">
+    <div>
+      <button @click="cancel">关闭</button>
+    </div>
+    <a-row>
+      <a-col :span="12">
+        <Buy />
+      </a-col>
+      <a-col :span="12">
+        <Sell />
+      </a-col>
+    </a-row>
   </div>
 </template>
 
 <script lang="ts">
-import { defineComponent, ModalEnum } from '@/common/export/commonTable';
+import { EnumRouterName } from '@/common/constants/enumRouterName';
+import { ComposeTableParam, defineComponent, handleComposeTable, ModalEnum, queryTableList } from '@/common/export/commonTable';
 import { _closeModal } from '@/common/setup/modal/modal';
+import { queryOrderQuoteDetail } from '@/services/go/wrtrade';
+import { QueryOrderQuoteDetailReq, WrOrderQuoteDetail } from '@/services/go/wrtrade/interface';
+import { handleBuyAndSellList } from './setup';
+import Buy from './components/buy/index.vue';
+import Sell from './components/sell/index.vue';
 
 export default defineComponent({
     emits: ['cancel'],
     name: ModalEnum.warehouse_receipt_trade_price_delisting,
+    props: {
+        wrpricetype: {
+            // 价格方式 - 1:固定价 2-浮动价
+            default: 1,
+            type: Number,
+        },
+        haswr: {
+            default: 0, // 是否有仓单 0-没有 1-有(仓单贸易填1,仓单预售填0)
+            type: Number,
+        },
+    },
+    components: {
+        Buy,
+        Sell,
+    },
     setup(props, context) {
         const { visible, cancel } = _closeModal(context);
+
         return {
             cancel,
             visible,

+ 22 - 0
src/views/market/spot_trade/components/buy-sell-market/setup.ts

@@ -0,0 +1,22 @@
+import { EnumRouterName } from '@/common/constants/enumRouterName';
+import { TableKey } from '@/common/methods/table/interface';
+import { getTableColumns, getTableEvent, queryTableList } from "@/common/setup/table";
+import { getBtnList_ } from '@/common/setup/table/button';
+import { WrOrderQuoteDetail } from "@/services/go/wrtrade/interface";
+
+
+export function handleBuyAndSellList<T>(menuType: EnumRouterName, isDetail: boolean, tableName: keyof TableKey) {
+    // 表格列表数据
+    const { loading, tableList, queryTable } = queryTableList<WrOrderQuoteDetail>();
+    // 表头数据
+    const { columns, registerColumn } = getTableColumns();
+    // 表格事件
+    const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<T>({});
+    // 表格操作按钮列表
+    const [firstBtn, secondBtn] = getBtnList_(menuType, isDetail).value;
+    // 注册表头信息 过滤
+    registerColumn(tableName, []);
+    return {
+        loading, tableList, columns, expandedRowKeys, selectedRow, Rowclick, firstBtn, secondBtn, queryTable
+    }
+}