Bladeren bron

修改account-status

huangbin 4 jaren geleden
bovenliggende
commit
7cea728c17

+ 1 - 1
public/config/app.config.json

@@ -1,3 +1,3 @@
 {
-    "apiUrl": "http://192.168.31.114:8080/cfg?key=test_114"
+    "apiUrl": "http://192.168.31.175:8080/cfg?key=test_175"
 }

+ 18 - 0
public/config/readMe.txt

@@ -6,3 +6,21 @@ http://192.168.31.114:8080/cfg?key=test_114
 李倩:http://192.168.31.220:8080/cfg?key=test_220
 
 http://192.168.30.211:8080/cfg?key=test_211
+
+透传  "apiUrl": "http://192.168.31.175:8080/cfg?key=test_175"
+账号 110000000001
+    199990000012
+    199990000013
+    188880000001
+    199990000002
+    199990000003
+    199990000004
+    199990000005
+    199990000006
+    199990000007
+    199990000008
+    199990000009
+    199990000010
+    199990000011
+    199990000001
+    188880000002

+ 131 - 129
src/App.vue

@@ -1,151 +1,153 @@
 <template>
-    <a-spin :tip="tip" :spinning="spinning" size="large">
-        <router-view />
-    </a-spin>
+  <a-spin :tip="tip"
+          :spinning="spinning"
+          size="large">
+    <router-view />
+  </a-spin>
 </template>
 
 <script lang="ts">
-    import { defineComponent, ref, watchEffect, provide } from 'vue';
-    import { globalDataRefresh } from '@/services/bus/index';
-    import { notice } from '@/services/bus/system';
-    import eventBus from '@/utils/eventBus/index';
-    import TimerUtils from '@/utils/tool/timerUtil';
-    import Router from '@/router';
-    import APP from '@/services';
-    import { Modal } from 'ant-design-vue';
-    import { setLoadComplete } from '@/setup/methods/index';
-    import { isLogin, logout } from '@/services/bus/login';
-    let lastTime = new Date().getTime();
+import { defineComponent, ref, watchEffect, provide } from 'vue';
+import { globalDataRefresh } from '@/services/bus/index';
+import { notice } from '@/services/bus/system';
+import eventBus from '@/utils/eventBus/index';
+import TimerUtils from '@/utils/tool/timerUtil';
+import Router from '@/router';
+import APP from '@/services';
+import { Modal } from 'ant-design-vue';
+import { setLoadComplete } from '@/setup/methods/index';
+import { isLogin, logout } from '@/services/bus/login';
+let lastTime = new Date().getTime();
 
-    // 设置太久没有操作界面,自动退出界面功能
-    function setOvertime() {
-        window.addEventListener('mousemove', () => {
-            lastTime = new Date().getTime(); //更新当前时间
-        });
-        const mimut = 30;
-        const timeOut = mimut * 60 * 1000; //设置超时时间: 5分钟
-        TimerUtils.setInterval(
-            () => {
-                const currentTime = new Date().getTime();
-                if (currentTime - lastTime > timeOut) {
-                    //判断是否超时
-                    if (isLogin()) {
-                        Modal.info({
-                            title: '系统提示:',
-                            content: `您已超过${mimut}分钟没有进行任何操作,已自动退出登录!`,
-                            okType: 'primary',
-                            okText: '确定',
-                            keyboard: false,
-                        });
-                        logout();
-                        APP.closeServer();
-                        Router.replace('/login');
-                    }
+// 设置太久没有操作界面,自动退出界面功能
+function setOvertime() {
+    window.addEventListener('mousemove', () => {
+        lastTime = new Date().getTime(); //更新当前时间
+    });
+    const mimut = 30;
+    const timeOut = mimut * 60 * 1000; //设置超时时间: 5分钟
+    TimerUtils.setInterval(
+        () => {
+            const currentTime = new Date().getTime();
+            if (currentTime - lastTime > timeOut) {
+                //判断是否超时
+                if (isLogin()) {
+                    Modal.info({
+                        title: '系统提示:',
+                        content: `您已超过${mimut}分钟没有进行任何操作,已自动退出登录!`,
+                        okType: 'primary',
+                        okText: '确定',
+                        keyboard: false,
+                    });
+                    logout();
+                    APP.closeServer();
+                    Router.replace('/login');
                 }
-            },
-            timeOut,
-            'overtimeInterval'
-        );
-    }
-
-    export default defineComponent({
-        name: 'app',
-        components: {},
-        setup() {
-            let spinning = ref<boolean>(false);
-            const tip = ref<string>('');
+            }
+        },
+        timeOut,
+        'overtimeInterval'
+    );
+}
 
-            // 登出状态展示
-            eventBus.$onOnly('logout', () => {
-                tip.value = '跳转中...';
-                spinning.value = true;
-                TimerUtils.setTimeout(
-                    () => {
-                        spinning.value = false;
-                        APP.closeServer();
-                    },
-                    1000,
-                    'logoutTimer'
-                );
-            });
-            // 登录成功
-            eventBus.$onOnly('loginSuccess', setOvertime);
-            // 监听路由的变化
-            watchEffect(() => Router.currentRoute && provide('current-route', Router.currentRoute));
+export default defineComponent({
+    name: 'app',
+    components: {},
+    setup() {
+        let spinning = ref<boolean>(false);
+        const tip = ref<string>('');
 
-            // 监听刷新事件
-            window.addEventListener(
-                'load',
+        // 登出状态展示
+        eventBus.$onOnly('logout', () => {
+            tip.value = '跳转中...';
+            spinning.value = true;
+            TimerUtils.setTimeout(
                 () => {
-                    tip.value = '数据初始化...';
-                    lastTime = new Date().getTime(); //更新当前时间
-                    spinning.value = true;
-                    // 注册全局loadComplete事件 保证loadComplete变量及时更新
-                    setLoadComplete(false);
-                    globalDataRefresh()
-                        .then((res) => {
-                            setLoadComplete(true);
-                            eventBus.$emit('loadComplete');
-                            spinning.value = false;
-                        })
-                        .catch((err) => {
-                            console.error(err);
-                            spinning.value = false;
-                        });
+                    spinning.value = false;
+                    APP.closeServer();
                 },
-                true
+                1000,
+                'logoutTimer'
             );
+        });
+        // 登录成功
+        // eventBus.$onOnly('loginSuccess', setOvertime);
+        // 监听路由的变化
+        watchEffect(() => Router.currentRoute && provide('current-route', Router.currentRoute));
+
+        // 监听刷新事件
+        window.addEventListener(
+            'load',
+            () => {
+                tip.value = '数据初始化...';
+                lastTime = new Date().getTime(); //更新当前时间
+                spinning.value = true;
+                // 注册全局loadComplete事件 保证loadComplete变量及时更新
+                setLoadComplete(false);
+                globalDataRefresh()
+                    .then((res) => {
+                        setLoadComplete(true);
+                        eventBus.$emit('loadComplete');
+                        spinning.value = false;
+                    })
+                    .catch((err) => {
+                        console.error(err);
+                        spinning.value = false;
+                    });
+            },
+            true
+        );
 
-            setOvertime();
-            // 订阅交易通知
-            notice((msg: string) => {
-                Modal.info({
-                    title: '系统提示:',
-                    content: `${msg},请重新登录。`,
-                    okType: 'primary',
-                    okText: '确定',
-                    keyboard: false,
-                    onOk() {
-                        Router.replace('/login');
-                    },
-                });
+        // setOvertime();
+        // 订阅交易通知
+        notice((msg: string) => {
+            Modal.info({
+                title: '系统提示:',
+                content: `${msg},请重新登录。`,
+                okType: 'primary',
+                okText: '确定',
+                keyboard: false,
+                onOk() {
+                    Router.replace('/login');
+                },
             });
+        });
 
-            return {
-                tip,
-                spinning,
-            };
-        },
-    });
+        return {
+            tip,
+            spinning,
+        };
+    },
+});
 </script>
 
 <style lang="less">
-    #app {
-        width: 100%;
-        height: auto;
-        min-height: 100%;
-        font-family: Avenir, Helvetica, Arial, sans-serif;
-        -webkit-font-smoothing: antialiased;
-        -moz-osx-font-smoothing: grayscale;
-        text-align: center;
-        color: #2c3e50;
-        background-color: #fffefe;
-        display: flex;
-        justify-content: center;
-        overflow-y: hidden;
-        img {
-            cursor: pointer;
-        }
+#app {
+    width: 100%;
+    height: auto;
+    min-height: 100%;
+    font-family: Avenir, Helvetica, Arial, sans-serif;
+    -webkit-font-smoothing: antialiased;
+    -moz-osx-font-smoothing: grayscale;
+    text-align: center;
+    color: #2c3e50;
+    background-color: #fffefe;
+    display: flex;
+    justify-content: center;
+    overflow-y: hidden;
+    img {
+        cursor: pointer;
     }
+}
 
-    #nav {
-        padding: 30px;
-        a {
-            font-weight: bold;
-            color: #2c3e50;
-            &.router-link-exact-active {
-                color: #42b983;
-            }
+#nav {
+    padding: 30px;
+    a {
+        font-weight: bold;
+        color: #2c3e50;
+        &.router-link-exact-active {
+            color: #42b983;
         }
     }
+}
 </style>

+ 12 - 0
src/goServiceAPI/ermcp/index.ts

@@ -0,0 +1,12 @@
+import { getLongTypeLoginID } from '@/services/bus/login';
+import { commonSearch_go } from '../index';
+import * as type from './interface';
+
+/**
+ * 获取目标登录账号当前对冲账号在线状态
+ * @returns GetErmcpOutAccountStatus[]
+ */
+export function GetErmcpOutAccountStatus(): Promise<type.GetErmcpOutAccountStatus[]> {
+    const id = getLongTypeLoginID();
+    return commonSearch_go('/Ermcp/GetErmcpOutAccountStatus', { loginID: Number(id) })
+}

+ 21 - 0
src/goServiceAPI/ermcp/interface.ts

@@ -0,0 +1,21 @@
+export interface GetErmcpOutAccountStatus {
+    accountcurrecnygroup: string;
+    accountcurrency: string;
+    accountid: number;
+    appid: string;
+    authcode: string;
+    brokerid: string;
+    channeladdress: string;
+    channelid: number;
+    connectflag: number;
+    exchangeratecurrencygroup: string;
+    fcid: number;
+    fcname: string;
+    hedgeaccountcode: string;
+    hedgeaccountpwd: string;
+    hedgeaccounttype: number;
+    limit: number;
+    marketid: number;
+    status: number;
+    userproductinfo: string;
+}

+ 16 - 2
src/layout/top.vue

@@ -93,11 +93,13 @@
 </template>
 <script lang="ts">
 import { UserOutlined } from '@ant-design/icons-vue';
-import { defineComponent, ref, provide } from 'vue';
+import { defineComponent, ref, provide, unref } from 'vue';
 import Setting from '@/views/setting/index.vue';
 import CapitalInfo from '@/components/capitalInfo/index.vue';
 import SecondMenu from '@/components/secondeMenu/index.vue';
 import APP from '@/services';
+import { initData } from '@/setup/methods/index';
+import { useRouter } from 'vue-router';
 
 // 菜单栏
 const handleMenu = () => {
@@ -106,6 +108,7 @@ const handleMenu = () => {
     const openKeys = ref<string[]>(['1']);
     const preOpenKeys = ref<string[]>(['1']);
     const menuList = APP.getRef('menus');
+    const router = useRouter();
     // 控制菜单是否隐藏
     function collapse(collapsed: boolean) {
         if (collapsed) {
@@ -117,7 +120,7 @@ const handleMenu = () => {
     }
 
     function menuClick(value: any) {
-        console.log(value);
+        router.push(value.key);
     }
     // 一级菜单图标
     function fontIcon(code: string): string {
@@ -185,7 +188,18 @@ export default defineComponent({
     },
     setup() {
         const { collapsed, selectedKeys, openKeys, menuList, collapse, menuClick, fontIcon } = handleMenu();
+        const router = useRouter();
 
+        initData(() => {
+            // 处理路由跳转到菜单栏里第一个队员的页面
+            const list = unref(menuList);
+            if (list.length && list[0].children && list[0].children.length) {
+                const code = list[0].children[0].code;
+                selectedKeys.value = [code];
+                openKeys.value = [list[0].code];
+                router.push(code);
+            }
+        });
         const { visible, setMenu, chooseSetMenu } = setFn();
         const username = APP.get('username');
         const { search } = onSearch();

+ 1 - 1
src/router/index.ts

@@ -40,7 +40,7 @@ const routes: Array<RouteRecordRaw> = [
                 component: () => import('@/views/market/warehouseTrade/index.vue'),
             },
             {
-                path: '/account-status',
+                path: '/outaccount_status',
                 name: 'accountStatus',
                 component: () => import('@/views/account/accountStatus.vue'),
             },

+ 1 - 0
src/utils/tool/timerUtil.ts

@@ -5,6 +5,7 @@ export interface IntervalTimerNames {
     quoteDay: string; // 定时轮休盘面
     pollingNotice: string; //通知公告轮询
     overtimeInterval: string; // 超时,如果太久没有操作界面,则退出登录
+    accountStauts: string; // 账号状态
 }
 export interface TimeoutTimerNames {
     logoutTimer: string; //登出1s延时器

+ 78 - 37
src/views/account/accountStatus.vue

@@ -3,64 +3,89 @@
     <firstMenu :list="menulist"
                :value="'value'"
                @selectMenu="selectMenu" />
+    <div class="tip">最新更新时间:{{updatedTime}}</div>
     <a-table :columns="columns"
              :data-source="list"
              :pagination="false"
              bordered>
+      <template #status="{ text }">
+        <span :class="[text ? 'success-satus' : 'error-status']">{{ text ? '正常' : '断开' }}</span>
+      </template>
     </a-table>
   </div>
 </template>
 
 <script lang="ts">
-import { defineComponent } from 'vue';
+import { defineComponent, ref, onUnmounted } from 'vue';
 import { initData } from '@/setup/methods/index';
+import { message } from 'ant-design-vue';
 import firstMenu from '@/components/firstMenu/index.vue';
+import { GetErmcpOutAccountStatus } from '@/goServiceAPI/ermcp/index';
+import { GetErmcpOutAccountStatus as GetErmcpOutAccountStatusType } from '@/goServiceAPI/ermcp/interface';
+import TimerUtils from '@/utils/tool/timerUtil';
+import moment from 'moment';
 
 function getAccountList() {
+    interface ListType extends GetErmcpOutAccountStatusType {
+        index: number;
+        key: string;
+    }
     const columns = [
         {
-            title: 'Name',
-            dataIndex: 'name',
-            slots: { customRender: 'name' },
-        },
-        {
-            title: 'Cash Assets',
-            className: 'column-money',
-            dataIndex: 'money',
-        },
-        {
-            title: 'Address',
-            dataIndex: 'address',
+            title: '序号',
+            dataIndex: 'index',
+            align: 'center',
+            width: 200,
         },
-    ];
-    const list = [
         {
-            key: '1',
-            name: 'John Brown',
-            money: '¥300,000.00',
-            address: 'New York No. 1 Lake Park',
+            title: '资金账号',
+            align: 'center',
+            dataIndex: 'accountid',
+            width: 400,
         },
         {
-            key: '2',
-            name: 'Jim Green',
-            money: '¥1,256,000.00',
-            address: 'London No. 1 Lake Park',
+            title: '期货公司',
+            align: 'center',
+            dataIndex: 'fcname',
+            width: 500,
         },
         {
-            key: '3',
-            name: 'Joe Black',
-            money: '¥120,000.00',
-            address: 'Sidney No. 1 Lake Park',
+            title: '连接状态',
+            align: 'center',
+            dataIndex: 'status',
+            width: 340,
+            slots: { customRender: 'status' },
         },
     ];
-    return { columns, list };
+    const list = ref<ListType[]>([]);
+    // 更新时间
+    function getTime(): string {
+        return moment().format('YYYY-MM-DD HH:mm:ss');
+    }
+    const updatedTime = ref<string>(getTime());
+    // 获取列表
+    function getAccountStatusList() {
+        return GetErmcpOutAccountStatus()
+            .then((res) => {
+                list.value = res.map((e: GetErmcpOutAccountStatusType, index: number) => {
+                    return { ...e, index: index + 1, key: String(index) };
+                });
+                updatedTime.value = getTime();
+                return 'ok';
+            })
+            .catch((e) => {
+                message.error(e.message);
+            });
+    }
+    // 定时轮询
+    function setLoop() {
+        TimerUtils.setInterval(getAccountStatusList, 10000, 'accountStauts');
+    }
+    return { columns, list, getAccountStatusList, setLoop, updatedTime };
 }
 
 function handleMenu() {
-    const menulist = [
-        { key: '1', value: '仓单贸易' },
-        { key: '2', value: '拍卖' },
-    ];
+    const menulist = [{ key: '1', value: '账号状态' }];
     function selectMenu(item: any) {
         console.log(item);
     }
@@ -73,13 +98,16 @@ export default defineComponent({
         firstMenu,
     },
     setup() {
-        const { columns, list } = getAccountList();
+        const { columns, list, getAccountStatusList, setLoop, updatedTime } = getAccountList();
         const { menulist, selectMenu } = handleMenu();
-        initData(() => {
-            // 加载数据在这里
+        initData(async () => {
+            await getAccountStatusList();
+            setLoop();
         });
-
-        return { columns, list, menulist, selectMenu };
+        onUnmounted(() => {
+            TimerUtils.clearInterval('accountStauts');
+        });
+        return { columns, list, menulist, selectMenu, updatedTime };
     },
 });
 </script>
@@ -91,6 +119,19 @@ export default defineComponent({
         .ant-table-body > table {
             border: none;
         }
+        .ant-table {
+            width: 100%;
+        }
+    }
+    .success-satus {
+        color: #1ff195;
+    }
+    .error-status {
+        color: #ff2b2b;
+    }
+    .tip {
+        padding: 10px 0;
+        color: #364048;
     }
 }
 </style>;

+ 38 - 7
swagger-to-ts/swagger.ts

@@ -1,10 +1,41 @@
 interface HttpRespone {code: number;msg: string;page: number;pagesize: number;total: number;}export interface Enum// 已签约信息
 message BankAccountSign {
-code	:string;//ID
-isshow	:boolean;//是否显示
-rulekey	:string;//对应权限主键,对应FUNCMENULIST表RESOURCECODE
-sort	:number;//排序
-title	:string;//标题
-type	:number;//类型,1:菜单 2:按钮
-}
+ accountcurrecnygroup: :string;
+//,
+  accountcurrency: :string;
+//,
+  accountid: number;
+//,
+  appid: :string;
+//,
+  authcode: :string;
+//,
+  brokerid: :string;
+//,
+  channeladdress: :string;
+//,
+  channelid: number;
+//,
+  connectflag: number;
+//,
+  exchangeratecurrencygroup: :string;
+//,
+  fcid: number;
+//,
+  fcname: :string;
+//,
+  hedgeaccountcode: :string;
+//,
+  hedgeaccountpwd: :string;
+//,
+  hedgeaccounttype: number;
+//,
+  limit:number;
+//: number;
+//,
+  marketid: number;
+//,
+  status: number;
+//,
+  userproductinfo: :string;//}
 export interface QueryMarketGoodsRespone extends HttpRespone{data: Enum[];}

+ 19 - 17
swagger-to-ts/swagger.txt

@@ -1,20 +1,22 @@
 // 已签约信息
 message BankAccountSign {
-code	string
-ID
-
-isshow	boolean
-是否显示
-
-rulekey	string
-对应权限主键,对应FUNCMENULIST表RESOURCECODE
-
-sort	integer
-排序
-
-title	string
-标题
-
-type	integer
-类型,1:菜单 2:按钮
+ "accountcurrecnygroup": "string",
+  "accountcurrency": "string",
+  "accountid": 0,
+  "appid": "string",
+  "authcode": "string",
+  "brokerid": "string",
+  "channeladdress": "string",
+  "channelid": 0,
+  "connectflag": 0,
+  "exchangeratecurrencygroup": "string",
+  "fcid": 0,
+  "fcname": "string",
+  "hedgeaccountcode": "string",
+  "hedgeaccountpwd": "string",
+  "hedgeaccounttype": 0,
+  "limitnumber": 0,
+  "marketid": 0,
+  "status": 0,
+  "userproductinfo": "string"
 }