Browse Source

修改敞口

huangbin 4 năm trước cách đây
mục cha
commit
55cd79ffce

+ 6 - 0
src/layout/components/header.vue

@@ -48,6 +48,8 @@
 import { defineComponent, ref, provide } from 'vue';
 import APP from '@/services';
 import { openModal } from '@/common/setup/modal/index';
+import { UserOutlined } from '@ant-design/icons-vue';
+import Setting from '@/views/setting/index.vue';
 
 // 设置
 const setFn = () => {
@@ -81,6 +83,10 @@ const onSearch = () => {
     return { search };
 };
 export default defineComponent({
+    components: {
+        UserOutlined,
+        Setting,
+    },
     props: {
         collapsed: {
             default: true,

+ 1 - 1
src/layout/components/main.vue

@@ -25,7 +25,7 @@ import { useRouter } from 'vue-router';
 import { OperationTabMenu } from '@/services/go/commonService/interface';
 
 export default defineComponent({
-    name: 'main',
+    name: 'MAIN',
     components: {},
     setup() {
         const router = useRouter();

+ 1 - 0
src/layout/components/menu.vue

@@ -107,6 +107,7 @@ export default defineComponent({
                 }
                 const temp = list[firstIndex].children[secondeIndex];
                 const code = temp.code;
+                // warn: Set operation on key "default" failed: target is readonly
                 selectedKeys.value = [code];
                 openKeys.value = [list[firstIndex].code];
                 context.emit('chooseMenu', temp);

+ 1 - 2
src/layout/components/top.vue

@@ -23,7 +23,7 @@
 </template>
 <script lang="ts">
 import { defineComponent, ref, provide } from 'vue';
-import Setting from '@/views/setting/index.vue';
+
 import CapitalInfo from '@/common/components/capitalInfo/index.vue';
 import SecondMenu from '@/common/components/secondeMenu/index.vue';
 import { useRouter } from 'vue-router';
@@ -36,7 +36,6 @@ import { OperationTabMenu } from '@/services/go/commonService/interface';
 export default defineComponent({
     name: 'layout-top',
     components: {
-        Setting,
         CapitalInfo,
         SecondMenu,
         Drawer,

+ 1 - 1
src/services/go/ermcp/exposure/index.ts

@@ -66,7 +66,7 @@ export function QuerySpotPositionDetail(req: Ermcp3AreaSpotDetailReq): Promise<E
  * 查询敞口期货头寸(菜单:敞口-> 期货头寸) /Ermcp/QueryExposureHedgePosition
  * @constructor
  */
-export function QueryExposureHedgePosition(): Promise<ErmcpHedgePosition> {
+export function QueryExposureHedgePosition(): Promise<ErmcpHedgePosition[]> {
     const areaUserId = APP.get('userAccount').memberuserid; // 所属机构id
     return commonSearch_go('/Ermcp/QueryExposureHedgePosition', { areaUserId }).catch((err) => {
         throw new Error(`查询敞口 -> 期货头寸: ${err.message}`);

+ 5 - 5
src/services/request/serviceURL.ts

@@ -75,9 +75,9 @@ export const setServiceURL = (config: URL): void => {
     serviceURL = config;
 
     // 外网环境(175),外包同事使用
-    if (process.env.NODE_ENV === 'development') {
-        serviceURL.goCommonSearchUrl = 'http://218.17.158.45:21001/api';
-        serviceURL.quoteUrl = 'ws://218.17.158.45:21004';
-        serviceURL.tradeUrl = 'ws://218.17.158.45:21005';
-    }
+    // if (process.env.NODE_ENV === 'development') {
+    //     serviceURL.goCommonSearchUrl = 'http://218.17.158.45:21001/api';
+    //     serviceURL.quoteUrl = 'ws://218.17.158.45:21004';
+    //     serviceURL.tradeUrl = 'ws://218.17.158.45:21005';
+    // }
 };

+ 38 - 22
src/views/business/exposure/list/futures/index.vue

@@ -1,6 +1,6 @@
 <template>
-  <!-- 采购: 现货头寸-->
-  <div class="spot-contract-peddding table-height"
+  <!-- 敞口: 期货头寸-->
+  <div class="exposure-futures  table-height"
        :loading="loading">
     <filterCustomTable @search="search">
       <BtnList :btnList="commonBtn" />
@@ -42,21 +42,20 @@ import filterCustomTable from '../../components/filterTable/index.vue';
 import { getBtnList } from '@/common/setup/contextMenu/index';
 import contextMenu from '@/common/components/contextMenu/index.vue';
 import { getColumsAndSearch } from '../setup';
-import { QuerySpotPosition, QuerySpotPositionDetail } from '@/services/go/ermcp/exposure/index';
-import { Ermcp3AreaSpot, Ermcp3AreaSpotDetail } from '@/services/go/ermcp/exposure/interface';
+import { QueryExposureHedgePositionDetail, QueryExposureHedgePosition } from '@/services/go/ermcp/exposure/index';
+import { ErmcpHedgePosition, ErmcpHedgePositionDetail } from '@/services/go/ermcp/exposure/interface';
 import { message } from 'ant-design-vue';
 import { handleTableEvent } from '@/common/setup/event/index';
 import BtnList from '@/common/components/buttonList/index.vue';
 import ThridMenu from '@/common/components/thirdMenu/index.vue';
 import { ColumnType } from '@/common/methods/table';
-import { TableKey } from '@/common/methods/table/interface';
 
 // 获取表格数据
 function getExposure() {
     const loading = ref<boolean>(false);
-    const tableList = ref<Ermcp3AreaSpot[]>([]);
+    const tableList = ref<ErmcpHedgePosition[]>([]);
     function queryList() {
-        QuerySpotPosition()
+        QueryExposureHedgePosition()
             .then((res) => {
                 tableList.value = res.map((e, i) => {
                     return { ...e, key: String(i) };
@@ -73,11 +72,20 @@ function getExposure() {
     return { loading, tableList, queryList };
 }
 
+// 控制是否打开明细
+function handleDrawer() {
+    const visible = ref<boolean>(false);
+    function closeDrawer() {
+        visible.value = !visible.value;
+    }
+    return { visible, closeDrawer };
+}
+
 // 明细
-function handleDrawer(loading: Ref<boolean>, selectedRow: Ermcp3AreaSpot) {
+function handleDeatil(loading: Ref<boolean>, selectedRow: ErmcpHedgePosition) {
     const visible = ref<boolean>(true);
     const tabList = [{ lable: '期货明细' }];
-    const detailTableList = ref<Ermcp3AreaSpotDetail[]>([]);
+    const detailTableList = ref<ErmcpHedgePositionDetail[]>([]);
     const detailColumns = ref<ColumnType[]>([]);
     function closeDrawer() {
         visible.value = false;
@@ -85,49 +93,57 @@ function handleDrawer(loading: Ref<boolean>, selectedRow: Ermcp3AreaSpot) {
     // 切换明细
     function selectMenu(index: number) {
         ActualExposureDetail();
-        const { columns, getColumns } = getColumsAndSearch('table_pcweb_exposure_spotposition', false);
+        const { columns, getColumns } = getColumsAndSearch('table_pcweb_exposure_futuresposition', false);
         getColumns();
         detailColumns.value = columns.value;
     }
-
-    // 现货明细信息
+    selectMenu(0);
+    // 期货明细
     function ActualExposureDetail() {
         loading.value = true;
-        const param = { deliverygoodsid: selectedRow.deliverygoodsid };
-        QuerySpotPositionDetail(param)
+        const param = { goodsId: selectedRow.goodsid };
+        QueryExposureHedgePositionDetail(param)
             .then((res) => {
                 detailTableList.value = res.map((e, i) => {
                     return { ...e, key: String(i) };
                 });
                 loading.value = false;
-                console.log('现货明细信息', detailTableList);
+                console.log('期货明细', detailTableList);
             })
             .catch((err) => {
                 message.error(err);
                 loading.value = false;
             });
     }
-    return { visible, closeDrawer, tabList, selectMenu, detailTableList, detailColumns };
+    return { tabList, selectMenu, detailTableList, detailColumns };
 }
 
 export default defineComponent({
-    name: 'spot-contract-peddding',
-    components: {},
+    name: 'exposure-futures',
+    components: {
+        contextMenu,
+        filterCustomTable,
+        ThridMenu,
+        BtnList,
+    },
     setup() {
-        const { columns, search, getColumns } = getColumsAndSearch('table_pcweb_exposure_spotposition', true);
-        const { expandedRowKeys, selectedRow, Rowclick } = handleTableEvent<Ermcp3AreaSpot>();
+        const { visible, closeDrawer } = handleDrawer();
+        const { columns, search, getColumns } = getColumsAndSearch('table_pcweb_exposure_futuresposition', true);
+        const { expandedRowKeys, selectedRow, Rowclick } = handleTableEvent<ErmcpHedgePosition>(closeDrawer);
         const { loading, tableList, queryList } = getExposure();
         initData(() => {
             queryList();
             getColumns();
         });
-        return { columns, search, expandedRowKeys, selectedRow, Rowclick, ...getBtnList('exposure_spot', false), loading, tableList };
+        return { columns, search, expandedRowKeys, selectedRow, Rowclick, visible, closeDrawer, ...getBtnList('exposure_futures', false), loading, tableList, ...handleDeatil(loading, (selectedRow as unknown) as ErmcpHedgePosition) };
     },
 });
 </script>
 
 <style lang="less">
-.spot-contract-peddding {
+.exposure-futures {
+    position: relative;
+    overflow: hidden;
 }
 </style
 >;

+ 4 - 4
src/views/business/exposure/list/realTime/index.vue

@@ -1,6 +1,6 @@
 <template>
   <!-- 实时敞口-->
-  <div class="purchase-real-time table-height"
+  <div class="exposure-real-time table-height"
        :loading="loading">
     <filterCustomTable @search="search">
       <BtnList :btnList="commonBtn" />
@@ -100,7 +100,7 @@ function handleDeatil(loading: Ref<boolean>, selectedRow: ErmcpRealExposureModel
         getColumns();
         detailColumns.value = columns.value;
     }
-
+    selectMenu(0);
     // 现货明细信息
     function ActualExposureDetail() {
         loading.value = true;
@@ -139,7 +139,7 @@ function handleDeatil(loading: Ref<boolean>, selectedRow: ErmcpRealExposureModel
 }
 
 export default defineComponent({
-    name: 'purchase-real-time',
+    name: 'exposure-real-time',
     components: {
         contextMenu,
         filterCustomTable,
@@ -164,7 +164,7 @@ export default defineComponent({
 </script>
 
 <style lang="less">
-.purchase-real-time {
+.exposure-real-time {
     position: relative;
     overflow: hidden;
 }

+ 132 - 70
src/views/business/exposure/list/spot/index.vue

@@ -1,83 +1,145 @@
 <template>
-    <!-- 采购: 实时敞口-->
-    <div class="purchase-real-time">
-        采购: 实时敞口
-    </div>
+  <!-- 采敞口: 现货头寸-->
+  <div class="exposure-spot table-height"
+       :loading="loading">
+    <filterCustomTable @search="search">
+      <BtnList :btnList="commonBtn" />
+    </filterCustomTable>
+    <contextMenu :contextMenuList="forDataBtn">
+      <a-table :columns="columns"
+               class="topTable"
+               :expandedRowKeys="expandedRowKeys"
+               :customRow="Rowclick"
+               :pagination="false"
+               rowKey="key"
+               :data-source="tableList">
+      </a-table>
+    </contextMenu>
+    <a-drawer placement="bottom"
+              :closable="false"
+              :visible="visible"
+              :get-container="false"
+              :wrap-style="{ position: 'absolute' }"
+              @close="closeDrawer">
+      <div>
+        <a-table :columns="detailColumns"
+                 class="topTable"
+                 :pagination="false"
+                 rowKey="key"
+                 :data-source="detailTableList">
+        </a-table>
+        <ThridMenu :list="tabList"
+                   @selectMenu="selectMenu" />
+      </div>
+    </a-drawer>
+  </div>
 </template>
 
 <script lang="ts">
-    import { defineComponent, ref } from 'vue';
-    import { QueryCustomInfo } from '@/services/go/ermcp/customInfo/index';
-    import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
-    import { message } from 'ant-design-vue';
-    import { initData } from '@/common/methods';
+import { defineComponent, Ref, ref } from 'vue';
+import { initData } from '@/common/methods';
+import filterCustomTable from '../../components/filterTable/index.vue';
+import { getBtnList } from '@/common/setup/contextMenu/index';
+import contextMenu from '@/common/components/contextMenu/index.vue';
+import { getColumsAndSearch } from '../setup';
+import { QuerySpotPosition, QuerySpotPositionDetail } from '@/services/go/ermcp/exposure/index';
+import { Ermcp3AreaSpot, Ermcp3AreaSpotDetail } from '@/services/go/ermcp/exposure/interface';
+import { message } from 'ant-design-vue';
+import { handleTableEvent } from '@/common/setup/event/index';
+import BtnList from '@/common/components/buttonList/index.vue';
+import ThridMenu from '@/common/components/thirdMenu/index.vue';
+import { ColumnType } from '@/common/methods/table';
 
-    // 查询客户资料列表
-    function getCustomList() {
-        // const filteredInfo = ref();
-        // const sortedInfo = ref();
-        // const columns = computed(() => {
-        //     const filtered = filteredInfo.value || {};
-        //     const sorted = sortedInfo.value || {};
-        //     return [
-        //         {
-        //             title: '序号',
-        //             dataIndex: 'index',
-        //             key: 'index',
-        //             align: 'center',
-        //             width: 50,
-        //             customRender: (param: any) => `${param.index + 1}`,
-        //         },
-        //         {
-        //             title: 'Age',
-        //             dataIndex: 'age',
-        //             key: 'age',
-        //             sorter: (a: DataItem, b: DataItem) => a.age - b.age,
-        //             sortOrder: sorted.columnKey === 'age' && sorted.order,
-        //         },
-        //         {
-        //             title: 'Address',
-        //             dataIndex: 'address',
-        //             key: 'address',
-        //             filters: [
-        //                 { text: 'London', value: 'London' },
-        //                 { text: 'New York', value: 'New York' },
-        //             ],
-        //             filteredValue: filtered.address || null,
-        //             onFilter: (value: string, record: DataItem) => record.address.includes(value),
-        //             sorter: (a: DataItem, b: DataItem) => a.address.length - b.address.length,
-        //             sortOrder: sorted.columnKey === 'address' && sorted.order,
-        //             ellipsis: true,
-        //         },
-        //     ];
-        // });
-        const customList = ref<QueryCustomInfoType[]>([]);
-        function actionQuery() {
-            QueryCustomInfo(4)
-                .then((res) => {
-                    console.log('L', res);
-                })
-                .catch((err) => message.error(err));
-        }
+// 获取表格数据
+function getExposure() {
+    const loading = ref<boolean>(false);
+    const tableList = ref<Ermcp3AreaSpot[]>([]);
+    function queryList() {
+        QuerySpotPosition()
+            .then((res) => {
+                tableList.value = res.map((e, i) => {
+                    return { ...e, key: String(i) };
+                });
+                loading.value = false;
+                console.log('获取表格数据', tableList);
+            })
+            .catch((err) => {
+                message.error(err);
+                loading.value = false;
+            });
+    }
+
+    return { loading, tableList, queryList };
+}
 
-        return { customList, actionQuery };
+// 控制是否打开明细
+function handleDrawer() {
+    const visible = ref<boolean>(false);
+    function closeDrawer() {
+        visible.value = !visible.value;
     }
+    return { visible, closeDrawer };
+}
 
-    export default defineComponent({
-        name: 'purchase-real-time',
-        components: {},
-        setup() {
-            const { customList, actionQuery } = getCustomList();
-            initData(() => {
-                actionQuery();
-                // 加载数据在这里
+// 明细
+function handleDeatil(loading: Ref<boolean>, selectedRow: Ermcp3AreaSpot) {
+    const tabList = [{ lable: '现货明细' }];
+    const detailTableList = ref<Ermcp3AreaSpotDetail[]>([]);
+    const detailColumns = ref<ColumnType[]>([]);
+    // 切换明细
+    function selectMenu(index: number) {
+        ActualExposureDetail();
+        const { columns, getColumns } = getColumsAndSearch('table_pcweb_exposure_detail', false);
+        getColumns();
+        detailColumns.value = columns.value;
+    }
+    selectMenu(0);
+    // 现货头寸明细
+    function ActualExposureDetail() {
+        loading.value = true;
+        const param = { deliverygoodsid: selectedRow.deliverygoodsid };
+        QuerySpotPositionDetail(param)
+            .then((res) => {
+                detailTableList.value = res.map((e, i) => {
+                    return { ...e, key: String(i) };
+                });
+                loading.value = false;
+                console.log('现货头寸明细', detailTableList);
+            })
+            .catch((err) => {
+                message.error(err);
+                loading.value = false;
             });
-            return { customList };
-        },
-    });
+    }
+    return { tabList, selectMenu, detailTableList, detailColumns };
+}
+
+export default defineComponent({
+    name: 'exposure-spot',
+    components: {
+        contextMenu,
+        filterCustomTable,
+        ThridMenu,
+        BtnList,
+    },
+    setup() {
+        const { visible, closeDrawer } = handleDrawer();
+        const { columns, search, getColumns } = getColumsAndSearch('table_pcweb_exposure_detail', true);
+        const { expandedRowKeys, selectedRow, Rowclick } = handleTableEvent<Ermcp3AreaSpot>(closeDrawer);
+        const { loading, tableList, queryList } = getExposure();
+        initData(() => {
+            queryList();
+            getColumns();
+        });
+        return { columns, search, expandedRowKeys, selectedRow, Rowclick, visible, closeDrawer, ...getBtnList('exposure_history', false), loading, tableList, ...handleDeatil(loading, (selectedRow as unknown) as Ermcp3AreaSpot) };
+    },
+});
 </script>
 
 <style lang="less">
-    .purchase-real-time {
-    }</style
+.exposure-spot {
+    position: relative;
+    overflow: hidden;
+}
+</style
 >;