ソースを参照

修改账户管理

huangbin 4 年 前
コミット
8402db0a6c

+ 5 - 0
src/common/setup/table/interface.ts

@@ -50,6 +50,11 @@ export interface ButtonListKey {
     business_review_someprice: string; // 业务审核 点价
     business_review_settlement: string; // 业务审核 交收
 
+    account_info_business: string; // 业务账户
+    account_info_trade: string; // 交易账户
+    account_info_manager: string; // 管理账户
+    account_info_futures: string; // 期货账户
+
     finance_review_funds: string; // 财务审核 款项
     finance_review_invoice: string; // 财务审核 发票
 

+ 101 - 39
src/views/information/account_info/list/account_info_business/index.vue

@@ -2,60 +2,122 @@
   <!-- 业务账户 -->
   <div class="account_info_business"
        :loading="loading">
-    业务账户
+    <filterCustomTable @search="search"></filterCustomTable>
+    <div class="tltLeft">
+      <span class="blue">
+        <svg class="icon svg-icon"
+             aria-hidden="true">
+          <use xlink:href="#icon-shuzhuangtu"></use>
+        </svg>
+        多元世纪信息技术有限公司(6)
+      </span>
+    </div>
+    <a-collapse class="spotCollapse"
+                :bordered="false">
+      <template #expandIcon="props">
+        <svg class="icon svg-icon"
+             aria-hidden="true"
+             v-if="props.isActive == 0">
+          <use xlink:href="#icon-shouqi1"></use>
+        </svg>
+        <svg class="icon svg-icon"
+             aria-hidden="true"
+             v-else>
+          <use xlink:href="#icon-shouqi2"></use>
+        </svg>
+      </template>
+      <a-collapse-panel>
+        <template #header>
+          <a-row class="headRow">
+            <a-col :span="12">业务员(2)</a-col>
+            <a-col :span="12">
+              <BtnList :btnList="commonBtn" />
+            </a-col>
+          </a-row>
+        </template>
+        <a-row class="contRow"
+               v-for="(item, i) in businesserList"
+               :key="i + '11'">
+          <a-col :span="12">{{item.accountname}}-{{item.logincode}}</a-col>
+          <a-col :span="12">{{getLoginStatus(item.loginstatus)}}</a-col>
+        </a-row>
+      </a-collapse-panel>
+    </a-collapse>
+    <a-collapse class="spotCollapse"
+                :bordered="false">
+      <template #expandIcon="props">
+        <svg class="icon svg-icon"
+             aria-hidden="true"
+             v-if="props.isActive == 0">
+          <use xlink:href="#icon-shouqi1"></use>
+        </svg>
+        <svg class="icon svg-icon"
+             aria-hidden="true"
+             v-else>
+          <use xlink:href="#icon-shouqi2"></use>
+        </svg>
+      </template>
+      <a-collapse-panel>
+        <template #header>
+          <a-row class="headRow">
+            <a-col :span="12">跟单员(3)</a-col>
+            <a-col :span="12">
+              <BtnList :btnList="commonBtn" />
+            </a-col>
+          </a-row>
+        </template>
+        <a-collapse class="spotCollapse"
+                    v-for="(item, i) in merchandiserList"
+                    :key="i + '11'"
+                    :bordered="false">
+          <a-collapse-panel :show-arrow="false">
+            <template #header>
+              <a-row class="headRow">
+                <a-col :span="12">{{item.accountname}}-{{item.logincode}}</a-col>
+                <a-col :span="12">{{getLoginStatus(item.loginstatus)}}</a-col>
+              </a-row>
+            </template>
+            <BtnList :btnList="forDataBtn" />
+          </a-collapse-panel>
+        </a-collapse>
+      </a-collapse-panel>
+    </a-collapse>
   </div>
 </template>
 
 <script lang="ts">
-import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
-
-// import {filterCustomTable, CustomDetail, ModifyCustom, DisableCustom, AddCustom} from '../../compoments';
-// import {queryTableList, getFilterTableCB, QueryCustomInfoType} from '../index';
-import { getCardTypeName, getStatusName } from '@/views/information/custom/setup';
+import { defineComponent, initData, getBtnList, contextMenu, BtnList } from '@/common/export/table';
+import filterCustomTable from '@/views/information/goods/components/filterTable/index.vue';
+import { ref } from 'vue';
+import { handleAccountManager, getLoginStatus } from '../setup';
 
 export default defineComponent({
     name: 'account_info_business',
     components: {
         contextMenu,
         BtnList,
+        filterCustomTable,
     },
     setup() {
-        // // 表头数据
-        // const {columns, registerColumn, updateColumn, filteredInfo} = getTableColumns();
-        // // 表格事件
-        // const {expandedRowKeys, selectedRow, Rowclick} = getTableEvent<QueryCustomInfoType>({});
-        // // 表格操作按钮列表
-        // const {commonBtn, forDataBtn} = getBtnList('custom_info_normal', true);
-        // // 表格列表数据
-        // const {loading, tableList, queryTable} = queryTableList(3);
-        // initData(() => {
-        //     // 获取列表数据
-        //     queryTable();
-        //     // 注册表头信息 过滤
-        //     registerColumn('table_pcweb_userinfo', getFilterTableCB);
-        // });
+        const { businesserList, merchandiserList, getBusinesserList } = handleAccountManager();
+
+        const { commonBtn, forDataBtn } = getBtnList('account_info_business', true);
+        const loading = ref<boolean>(false);
+        initData(() => {
+            getBusinesserList();
+        });
 
-        // // 查询
-        // function search(value: any) {
-        //     filteredInfo.value = value;
-        //     // 更新表信息
-        //     updateColumn();
-        // }
+        // 查询
+        function search(value: any) {}
 
         return {
-            // columns,
-            // filteredInfo,
-            // expandedRowKeys,
-            // selectedRow,
-            // Rowclick,
-            // commonBtn,
-            // forDataBtn,
-            // loading,
-            // tableList,
-            // search,
-            // getStatusName,
-            // getCardTypeName,
-            // queryTable,
+            commonBtn,
+            forDataBtn,
+            loading,
+            search,
+            businesserList,
+            merchandiserList,
+            getLoginStatus,
         };
     },
 });

+ 4 - 0
src/views/information/account_info/list/interface.ts

@@ -0,0 +1,4 @@
+export interface Value {
+    id: number,
+    name: string,
+}

+ 85 - 23
src/views/information/account_info/list/setup.ts

@@ -1,36 +1,76 @@
 import { Column, ColumnType } from '@/common/setup/table/index';
-import { QueryCustomInfo } from '@/services/go/ermcp/customInfo';
+import { getItemEnum } from '@/services/bus/allEnum';
+import { QueryAccMgrLoginUser } from '@/services/go/ermcp/account';
+import { ErmcpLoginUser } from '@/services/go/ermcp/account/interface';
 import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
-import { QueryCustomInfoEnum } from '@/services/go/ermcp/customInfo/type';
 import { message } from 'ant-design-vue';
 import { ref } from 'vue';
-import {getStatusName} from "@/views/information/custom/setup";
+import { Value } from './interface';
 
 /**
- * 获取表格列表数据
- * @param type 
+ * 处理 /账号列表: 交易用户 业务员 跟单员
  * @returns 
  */
-export function queryTableList(type: QueryCustomInfoEnum) {
-    // 加载状态
-    const loading = ref<boolean>(false);
-    // 表格数据
-    const tableList = ref<QueryCustomInfoType[]>([]);
-    function queryTable() {
-        QueryCustomInfo(type)
-            .then((res) => {
-                tableList.value = res.map((e, i) => {
-                    return { ...e, key: String(i) };
-                });
-                loading.value = false;
-                console.log('查询列表', tableList);
+export function handleAccountManager() {
+    // 交易用户
+    const traderList = ref<Value[]>([])
+    function getRoleList() {
+        QueryAccMgrLoginUser(2).then(res => {
+            const set = new Set<number>([])
+            traderList.value.length = 0;
+            res.forEach(e => {
+                const { roleid, rolename, accountstatus } = e;
+                if (accountstatus === 4) {  // 账户的状态 - 4 正常
+                    if (!set.has(roleid)) { // 去重
+                        set.add(roleid)
+                        traderList.value.push({ id: roleid, name: rolename })
+                    }
+                }
             })
-            .catch((err) => {
-                message.error(err);
-                loading.value = false;
-            });
+        }).catch(err => message.error(err))
     }
-    return { loading, tableList, queryTable }
+    // 处理 跟单员 /  业务员 列表
+    function handleList(el: ErmcpLoginUser, type: string, set: Set<number>): ErmcpLoginUser | null {
+        const { loginstatus, userid, accountname, logincode, roletype } = el;
+        let result = null
+        // if (loginstatus === 1) {// 登录账户状态 - 1:正常 
+        if (roletype.includes(type)) {  // 过滤角色类型
+            if (!set.has(userid)) { // 去重
+                set.add(userid)
+                result = el
+            }
+        }
+        // }
+        return result
+    }
+    // 业务员
+    const businesserList = ref<ErmcpLoginUser[]>([])
+    // 跟单员
+    const merchandiserList = ref<ErmcpLoginUser[]>([])
+    function getBusinesserList() {
+        QueryAccMgrLoginUser(1).then(res => {
+            const bSet = new Set<number>([]);
+            const mSet = new Set<number>([]);
+            const list: ErmcpLoginUser[] = []
+            res.forEach(e => {
+                // eslint-disable-next-line prefer-spread
+                list.push.apply(list, e.userlist)
+            })
+            list.forEach(el => {
+                // 业务员
+                const b = handleList(el, '22', bSet)
+                if (b) {
+                    businesserList.value.push(b)
+                }
+                // 跟单员
+                const m = handleList(el, '23', mSet)
+                if (m) {
+                    merchandiserList.value.push(m)
+                }
+            })
+        }).catch(err => message.error(err))
+    }
+    return { traderList, businesserList, merchandiserList, getRoleList, getBusinesserList }
 }
 
 /**
@@ -59,3 +99,25 @@ export function getFilterTableCB(e: Column, item: ColumnType, filtered: any) {
     }
 }
 
+/**
+ *获取仓登录状态
+ */
+export function getLoginStatus(type: number) {
+    const temp = getItemEnum('loginstatus').find(e => e.enumitemname === type)
+    return temp ? temp.enumdicname : '--'
+}
+// export function getLoginStatus(type: number) {
+//     let result = '--'
+//     switch(type) {
+//         case 1:
+//         result = '正常'
+//         break;
+//         case 2:
+//         result = '冻结'
+//         break;
+//         case 3:
+//         result = '无效'
+//         break;
+//     }
+//     return result
+// }