huangbin пре 4 година
родитељ
комит
93fefc9ec2
23 измењених фајлова са 209 додато и 188 уклоњено
  1. 30 3
      src/common/methods/request/resultInfo.ts
  2. 7 0
      src/services/bus/user.ts
  3. 3 4
      src/services/go/ermcp/account/index.ts
  4. 5 5
      src/services/go/ermcp/customInfo/index.ts
  5. 2 2
      src/services/go/ermcp/purchase/index.ts
  6. 10 1
      src/services/proto/accountinfo/index.ts
  7. 7 7
      src/services/proto/accountinfo/interface.ts
  8. 4 7
      src/services/proto/delivery/index.ts
  9. 2 1
      src/views/business/plan/components/add/index.vue
  10. 2 1
      src/views/business/plan/components/modify/index.vue
  11. 17 4
      src/views/information/account_info/compoments/add-business/index.vue
  12. 14 3
      src/views/information/account_info/compoments/add-business/setup.ts
  13. 14 16
      src/views/information/account_info/list/account_info_business/index.vue
  14. 11 42
      src/views/information/account_info/list/account_info_business/setup.ts
  15. 5 6
      src/views/information/account_info/list/account_info_futures/index.vue
  16. 10 20
      src/views/information/account_info/list/account_info_futures/setup.ts
  17. 12 13
      src/views/information/account_info/list/account_info_manager/index.vue
  18. 10 20
      src/views/information/account_info/list/account_info_manager/setup.ts
  19. 12 12
      src/views/information/account_info/list/account_info_trade/index.vue
  20. 10 17
      src/views/information/account_info/list/account_info_trade/setup.ts
  21. 18 0
      src/views/information/account_info/list/setup.ts
  22. 2 2
      src/views/information/spot-contract/components/add/setup.ts
  23. 2 2
      src/views/information/spot-contract/components/modify/setup.ts

+ 30 - 3
src/common/methods/request/resultInfo.ts

@@ -43,10 +43,10 @@ export function commonResultInfo(fn: Promise<any>, sign: ResultInfo, loading: Re
  * @param loading 
  * @returns 
  */
-export async function controlLoading(fn: Function, param: any, loading: Ref<boolean>): Promise<any> {
+export async function controlLoading(fn: Function, loading: Ref<boolean>, param?: any,): Promise<any> {
     loading.value = true;
     try {
-        return await fn(param)
+        return await param ? fn(param) : fn()
     } catch (err) {
         Promise.resolve(err)
     } finally {
@@ -72,6 +72,22 @@ export function controlResultInfo(fn: Promise<any>, msgInfo: [string, string] =
         Promise.reject(result)
     })
 }
+
+/**
+ * 用户查询数据,成功返回数据,失败提示
+ * @param fn 
+ * @returns 
+ */
+export function controlResultErrInfo(fn: Promise<any>) {
+    return fn.then(res => {
+        console.log('查询数据', res)
+        return res
+    }).catch(err => {
+        console.error(err)
+        message.error(err)
+    })
+}
+
 /**
  * 处理服务请求时候的loading和 成功和失败提示
  * @param fn 
@@ -81,5 +97,16 @@ export function controlResultInfo(fn: Promise<any>, msgInfo: [string, string] =
  * @returns 
  */
 export function requestResultLoadingAndInfo(fn: Function, param: any, loading: Ref<boolean>, messageInfo: [string, string] = ['成功', '失败']) {
-    return controlResultInfo(controlLoading(fn, param, loading), messageInfo)
+    return controlResultInfo(controlLoading(fn, loading, param), messageInfo)
 }
+
+/**
+ * 查询数据 loading 成功和失败提示
+ * @param fn 
+ * @param loading 
+ * @param param 
+ * @returns 
+ */
+export function queryResultLoadingAndInfo(fn: Function, loading: Ref<boolean>, param?: any) {
+    return controlResultErrInfo(controlLoading(fn, loading, param))
+}

+ 7 - 0
src/services/bus/user.ts

@@ -29,4 +29,11 @@ export function getUserName() {
  */
 export function getUsrId() {
     return getUserInfo().userid
+}
+
+/**
+ * 获取所属机构id
+ */
+export function getAreaUserId(): number {
+    return APP.get('userAccount').memberuserid
 }

+ 3 - 4
src/services/go/ermcp/account/index.ts

@@ -1,6 +1,6 @@
 /** ================================= 账户管理 ================================**/
-import APP from "@/services";
 import { getUserId } from "@/services/bus/account";
+import { getAreaUserId } from "@/services/bus/user";
 import { commonSearch_go } from "@/services/go";
 import {
     ErmcpBizGroupEx,
@@ -14,7 +14,6 @@ import {
  * @constructor
  */
 export function QueryAccMgrBizGroupSet(req: ErmcpBizGroupReq): Promise<ErmcpBizGroupEx> {
-    const userid = APP.get('userAccount').memberuserid;
     return commonSearch_go('/Ermcp/QueryUserInfo', { req }).catch((err) => {
         throw new Error(`查询业务类型分组: ${err.message}`);
     });
@@ -26,7 +25,7 @@ export function QueryAccMgrBizGroupSet(req: ErmcpBizGroupReq): Promise<ErmcpBizG
  * @constructor
  */
 export function QueryAccMgrTaaccount(): Promise<ErmcpTaAccountEx[]> {
-    const userid = APP.get('userAccount').memberuserid;
+    const userid = getAreaUserId();
     return commonSearch_go('/Ermcp/QueryAccMgrTaaccount', { userid }).catch((err) => {
         throw new Error(`查询账户管理期货账号: ${err.message}`);
     });
@@ -40,7 +39,7 @@ export function QueryAccMgrTaaccount(): Promise<ErmcpTaAccountEx[]> {
  * @constructor
  */
 export function QueryAccMgrLoginUser(querytype: number): Promise<ErmcpLoginUserEx[]> {
-    const userid = APP.get('userAccount').memberuserid;
+    const userid = getAreaUserId();
     return commonSearch_go('/Ermcp/QueryAccMgrLoginUser', { userid, querytype }).catch((err) => {
         throw new Error(`查询账户管理登录账号: ${err.message}`);
     });

+ 5 - 5
src/services/go/ermcp/customInfo/index.ts

@@ -1,7 +1,7 @@
 /** ================================= 客户资料 ================================**/
 
-import APP from '@/services';
-import {BaseResponse, commonSearch_go, commonUpdate_go} from '@/services/go/index';
+import { getAreaUserId } from '@/services/bus/user';
+import { BaseResponse, commonSearch_go, commonUpdate_go } from '@/services/go/index';
 import {
     AddUserInfoApplyReq,
     DeleteUserReq,
@@ -9,7 +9,7 @@ import {
     ModifyUserInfoReq,
     QueryCustomInfoType, UpdateUserAccountReq
 } from './interface';
-import {QueryCustomInfoEnum} from './type';
+import { QueryCustomInfoEnum } from './type';
 
 /** ================================= 信息 客户资料 ================================**/
 /**
@@ -19,8 +19,8 @@ import {QueryCustomInfoEnum} from './type';
  * @returns
  */
 export function QueryCustomInfo(queryType: QueryCustomInfoEnum): Promise<QueryCustomInfoType[]> {
-    const MemberUserID = APP.get('userAccount').memberuserid;
-    return commonSearch_go('/Ermcp/QueryUserInfo', {MemberUserID, queryType}).catch((err) => {
+    const MemberUserID = getAreaUserId();
+    return commonSearch_go('/Ermcp/QueryUserInfo', { MemberUserID, queryType }).catch((err) => {
         throw new Error(`查询客户资料: ${err.message}`);
     });
 }

+ 2 - 2
src/services/go/ermcp/purchase/index.ts

@@ -1,5 +1,5 @@
-import APP from '@/services';
 import { getUserId } from '@/services/bus/account';
+import { getAreaUserId } from '@/services/bus/user';
 import { commonSearch_go } from '@/services/go';
 import { Ermcp3SellBuyContract, SellBuyContractReq } from '@/services/go/ermcp/purchase/interface';
 
@@ -14,7 +14,7 @@ import { Ermcp3SellBuyContract, SellBuyContractReq } from '@/services/go/ermcp/p
 export function QueryPurchase(req: SellBuyContractReq): Promise<Ermcp3SellBuyContract[]> {
     const param = {
         userid: getUserId(),
-        areauserid: APP.get('userAccount').memberuserid, // 所属机构id
+        areauserid: getAreaUserId(), // 所属机构id
         contracttype: 1, // 采购
     }
     Object.assign(param, req)

+ 10 - 1
src/services/proto/accountinfo/index.ts

@@ -1,3 +1,6 @@
+import { getUserId } from "@/services/bus/account";
+import { getLongTypeLoginID } from "@/services/bus/login";
+import { getAreaUserId } from "@/services/bus/user";
 import {
     ErmcpBizGroupReq, ErmcpBizGroupRsp,
     LoginaccountOperateReq, LoginaccountOperateRsp,
@@ -6,7 +9,7 @@ import {
     UserInfoCheckMangeReq,
     UserInfoCheckMangeRsp
 } from "@/services/proto/accountinfo/interface";
-import {protoMiddleware} from "@/services/socket/protobuf/buildReq";
+import { protoMiddleware } from "@/services/socket/protobuf/buildReq";
 
 /**
  * 客户资料审核
@@ -29,6 +32,12 @@ export const roleOperate = (param: ManagerRoleOperateReq): Promise<ManagerRoleOp
  * @param param
  */
 export const loginAccountOperate = (param: LoginaccountOperateReq): Promise<LoginaccountOperateRsp> => {
+    const obj = {
+        userid: getUserId(),
+        modifierid: String(getLongTypeLoginID()),
+        areauserid: getAreaUserId(),
+    }
+    Object.assign(param, obj)
     return protoMiddleware<LoginaccountOperateReq>(param, 'LoginaccountOperateReq', 'LoginaccountOperateRsp', 2)
 }
 

+ 7 - 7
src/services/proto/accountinfo/interface.ts

@@ -1,7 +1,7 @@
 // 客户信息审核通过请求 0 29 122
-import {ErmcpBizGroupSpotGoods} from "@/services/go/ermcp/account/interface";
+import { ErmcpBizGroupSpotGoods } from "@/services/go/ermcp/account/interface";
 
-export interface UserInfoCheckMangeReq{
+export interface UserInfoCheckMangeReq {
     auditflag: number // uint64 1审核通过2审核拒绝
     userid: number // uint64 客户userid
     audituserid: number // uint64 审核操作人userid
@@ -39,16 +39,16 @@ export interface MemberFuncMenu {
 // 登录账户操作请求 0 29 160
 export interface LoginaccountOperateReq {
     operatetype: number; // uint32 操作类型-1:新增 2:修改 3:新增管理员 4:修改管理员 5:锁定 6:解锁 7:注销 8:恢复 9:重置密码 10:新增登录帐号 11:停用用户 12:恢复用户 13:修改用户信息
-    userid: number; // uint64 用户ID(新增成功接口返回的userid)
+    userid?: number; // uint64 用户ID(新增成功接口返回的userid)
     loginid: number; // uint64 登录ID(新增成功接口返回的loginid)
-    areauserid: number; // uint64 所属机构(当前登录userid 必填)
+    areauserid?: number; // uint64 所属机构(当前登录userid 必填)
     logincode: string; // string 登录账号
     accountname: string; // string 账户名称
     password: string; // string 登录密码(明文)
     mobile: string; // string 手机号码(明文)
     roleids: number[]; // uint64 账号角色
     logintaaccounts: LoginTaaccount[]; // LoginTaaccount 期货账户(勾选交易员必填)
-    modifierid: number; // uint64 修改人ID(当前登录loginid 必填)
+    modifierid?: number; // uint64 修改人ID(当前登录loginid 必填)
 }
 
 // 登录账户操作响应 0 29 156
@@ -60,7 +60,7 @@ export interface LoginaccountOperateRsp {
 }
 
 // 期货账户数据 0 29 155
-export interface  LoginTaaccount {
+export interface LoginTaaccount {
     accountid: number; // uint64 期货账户ID
 }
 
@@ -84,6 +84,6 @@ export interface ErmcpBizGroupRsp {
 }
 
 // 期货账户分组账户 0 29 148
-export interface  ErmcpBizGroupTAAccount {
+export interface ErmcpBizGroupTAAccount {
     AccountID: number; // uint64 账户ID
 }

+ 4 - 7
src/services/proto/delivery/index.ts

@@ -1,14 +1,11 @@
-import APP from "@/services";
-import { getSelectedAccountId, getUserId } from '@/services/bus/account';
-import { getLongTypeLoginID } from '@/services/bus/login';
+import { getUserId } from '@/services/bus/account';
+import { getAreaUserId } from "@/services/bus/user";
 import {
     DeliveryGoodsApplyReq,
     DeliveryGoodsCancelReq,
     ErmsMiddelGoodsEditReq
 } from "@/services/proto/delivery/interface";
-import {buildProtoReq50, parseProtoRsp50, protoMiddleware} from "@/services/socket/protobuf/buildReq";
-import { Callback } from "@/utils/websocket";
-import {ErmcpHedgePlanReq} from "@/services/proto/hedgeplan/interface";
+import { protoMiddleware } from "@/services/socket/protobuf/buildReq";
 
 /**
  * 现货品种申请请求
@@ -27,7 +24,7 @@ export const addDeliveryGoodsApply = (param: DeliveryGoodsApplyReq): Promise<any
  * 修改套保品种请求 ErmsMiddelGoodsEditReq 只能修改比率 但是其它参数也必须传
  */
 export const ermsMiddelGoodsEdit = (param: ErmsMiddelGoodsEditReq): Promise<any> => {
-    param.areauserid = APP.get('userAccount').memberuserid // 机构用户id
+    param.areauserid = getAreaUserId() // 机构用户id
     return protoMiddleware<ErmsMiddelGoodsEditReq>(param, 'ErmsMiddelGoodsEditReq', 'ErmsMiddelGoodsEditRsp', 2)
 }
 

+ 2 - 1
src/views/business/plan/components/add/index.vue

@@ -155,6 +155,7 @@ import { ErmcpHedgePlanReq } from '@/services/proto/hedgeplan/interface';
 import { getLongTypeLoginID } from '@/services/bus/login';
 import { LongType } from '@/services/socket/login/interface';
 import APP from '@/services';
+import { getAreaUserId } from '@/services/bus/user';
 
 export default defineComponent({
     name: 'add-custom',
@@ -178,7 +179,7 @@ export default defineComponent({
                 .then(() => {
                     const param = toRaw(formState);
                     const loginId = getLongTypeLoginID() as LongType;
-                    const userid = APP.get('userAccount').memberuserid;
+                    const userid = getAreaUserId();
                     const reqParam: ErmcpHedgePlanReq = {
                         HedgePlanNo: param.HedgePlanNo, // 计划类型
                         ContractType: param.ContractType, // 计划类型

+ 2 - 1
src/views/business/plan/components/modify/index.vue

@@ -154,6 +154,7 @@ import { LongType } from '@/services/socket/login/interface';
 import APP from '@/services';
 import { mergeTwoObj } from '@/utils/objHandle';
 import { Ermcp3HedgePlan } from '@/services/go/ermcp/plan/interface';
+import { getAreaUserId } from '@/services/bus/user';
 
 export default defineComponent({
     name: 'plan_uncommitted_modify',
@@ -191,7 +192,7 @@ export default defineComponent({
                 .then(() => {
                     const param = toRaw(formState);
                     const loginId = getLongTypeLoginID() as LongType;
-                    const userid = APP.get('userAccount').memberuserid;
+                    const userid = getAreaUserId();
                     const reqParam: ErmcpHedgePlanReq = {
                         HedgePlanNo: param.HedgePlanNo, // 计划类型
                         ContractType: param.ContractType, // 计划类型

+ 17 - 4
src/views/information/account_info/compoments/add-business/index.vue

@@ -20,8 +20,9 @@
       <a-row :gutter="24">
         <a-col :span="12">
           <a-form-item label="账户角色"
-                       name="LoginTaaccount">
-            <a-checkbox-group class="commonCheckboxGroup">
+                       name="roleids">
+            <a-checkbox-group class="commonCheckboxGroup"
+                              v-model:value="formState.roleids">
               <a-row>
                 <a-col :span="12">
                   <a-checkbox value="22">业务员</a-checkbox>
@@ -79,11 +80,13 @@ import { closeModal } from '@/common/setup/modal/index';
 import { defineComponent, ref, toRaw } from 'vue';
 import { ValidateErrorEntity } from 'ant-design-vue/es/form/interface';
 import { handleForm, FormState } from './setup';
+import { loginAccountOperate } from '@/services/proto/accountinfo';
+import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
 
 export default defineComponent({
     name: 'add-business-info',
     components: {},
-    setup() {
+    setup(props, context) {
         // 控制关闭弹窗
         const { visible, cancel } = closeModal('account_info_business_btn_add');
         const loading = ref<boolean>(false);
@@ -93,7 +96,17 @@ export default defineComponent({
                 .validate()
                 .then(() => {
                     const param = toRaw(formState);
-                    console.log('values', param);
+                    param.roleids = param.roleids.map((e) => Number(e));
+                    const req = {
+                        operatetype: 1, // uint32 操作类型-1:新增 2:修改 3:新增管理员 4:修改管理员 5:锁定 6:解锁 7:注销 8:恢复 9:重置密码 10:新增登录帐号 11:停用用户 12:恢复用户 13:修改用户信息
+                        loginid: 0, // uint64 登录ID(新增成功接口返回的loginid)
+                        logintaaccounts: [], // LoginTaaccount 期货账户(勾选交易员必填)
+                    };
+                    Object.assign(req, param);
+                    requestResultLoadingAndInfo(loginAccountOperate, param, loading, ['新增登录账号成功', '新增登录账号失败']).then(() => {
+                        cancel();
+                        context.emit('refresh');
+                    });
                 })
                 .catch((error: ValidateErrorEntity<FormState>) => {
                     console.log('error', error);

+ 14 - 3
src/views/information/account_info/compoments/add-business/setup.ts

@@ -1,3 +1,4 @@
+import { RuleObject } from "ant-design-vue/lib/form/interface";
 import { reactive, ref, UnwrapRef } from "vue";
 
 export interface FormState {
@@ -5,7 +6,7 @@ export interface FormState {
     accountname: string // 账户名称
     password: string // 登录密码(明文)
     mobile?: string // 手机号码(明文)
-    LoginTaaccount: string // 期货账户(勾选交易员必填)
+    roleids: number[]; // uint64 账号角色
 }
 /**
  * 表单
@@ -18,13 +19,23 @@ export function handleForm() {
         accountname: '',
         password: '',
         mobile: '',
-        LoginTaaccount: '',
+        roleids: [],
     })
+    // 验证账号角色
+    async function v_TradeUser(rule: RuleObject, value: number[]) {
+        debugger
+        if (formState.roleids.length) {
+            return Promise.resolve();
+
+        } else {
+            return Promise.reject('请选择账号角色');
+        }
+    }
     const rules = {
         logincode: [{ required: true, message: '请输入登录账号', trigger: 'blur' }],
         accountname: [{ required: true, message: '请输入账户名称', trigger: 'blur' }],
         password: [{ required: true, message: '请输入账户名称', trigger: 'blur' }],
-        LoginTaaccount: [{ required: true, message: '请选择货账户', trigger: 'blur' }],
+        roleids: [{ required: true, message: '请选择账号角色', trigger: 'change', type: 'array', }],
     }
     return { rules, formState, formRef }
 }

+ 14 - 16
src/views/information/account_info/list/account_info_business/index.vue

@@ -13,6 +13,8 @@
       </span>
     </div>
     <a-collapse class="spotCollapse"
+                v-for="(item, i) in tableList"
+                :key="i + '11'"
                 :bordered="false">
       <template #expandIcon="props">
         <svg class="icon svg-icon"
@@ -29,21 +31,21 @@
       <a-collapse-panel>
         <template #header>
           <a-row class="headRow">
-            <a-col :span="12">业务员(2)</a-col>
+            <a-col :span="12">{{item.rolename}}({{item.userlist.length}})</a-col>
             <a-col :span="12">
               <BtnList :btnList="commonBtn" />
             </a-col>
           </a-row>
         </template>
         <a-row class="contRow"
-               v-for="(item, i) in businesserList"
+               v-for="(sub, i) in item.userlist"
                :key="i + '11'">
-          <a-col :span="12">{{item.accountname}}-{{item.logincode}}</a-col>
-          <a-col :span="12">{{getLoginStatusEnumItemName(item.loginstatus)}}</a-col>
+          <a-col :span="12">{{sub.accountname}}-{{sub.logincode}}</a-col>
+          <a-col :span="12">{{getLoginStatusEnumItemName(sub.loginstatus)}}</a-col>
         </a-row>
       </a-collapse-panel>
     </a-collapse>
-    <a-collapse class="spotCollapse"
+    <!-- <a-collapse class="spotCollapse"
                 :bordered="false">
       <template #expandIcon="props">
         <svg class="icon svg-icon"
@@ -81,8 +83,8 @@
           </a-collapse-panel>
         </a-collapse>
       </a-collapse-panel>
-    </a-collapse>
-    <Add />
+    </a-collapse> -->
+    <Add @refresh="queryTable" />
     <Modify />
     <Reset />
     <Locked />
@@ -94,8 +96,7 @@
 <script lang="ts">
 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 { handleBusinessAccount } from './setup';
+import { queryTableList } from './setup';
 import { getLoginStatusEnumItemName } from '@/common/constants/enumsName';
 import Add from '../../compoments/add-business/index.vue';
 import Modify from '../../compoments/modify-business/index.vue';
@@ -118,14 +119,11 @@ export default defineComponent({
         Detail,
     },
     setup() {
-        const { businesserList, merchandiserList, getBusinesserList } = handleBusinessAccount();
-
+        const { loading, tableList, queryTable } = queryTableList();
         const { commonBtn, forDataBtn } = getBtnList('account_info_business', true);
-        const loading = ref<boolean>(false);
         initData(() => {
-            getBusinesserList();
+            queryTable();
         });
-
         // 查询
         function search(value: any) {}
 
@@ -134,9 +132,9 @@ export default defineComponent({
             forDataBtn,
             loading,
             search,
-            businesserList,
-            merchandiserList,
+            tableList,
             getLoginStatusEnumItemName,
+            queryTable,
         };
     },
 });

+ 11 - 42
src/views/information/account_info/list/account_info_business/setup.ts

@@ -1,47 +1,16 @@
+import { queryResultLoadingAndInfo } from "@/common/methods/request/resultInfo";
 import { QueryAccMgrLoginUser } from "@/services/go/ermcp/account";
-import { ErmcpLoginUser } from "@/services/go/ermcp/account/interface";
-import { message } from "ant-design-vue";
+import { ErmcpLoginUserEx } from "@/services/go/ermcp/account/interface";
 import { ref } from "vue";
 
-export function handleBusinessAccount() {
-    // 处理 跟单员 /  业务员 列表
-    function handleList(el: ErmcpLoginUser, type: string, set: Set<number>): ErmcpLoginUser | null {
-        const { userid, roletype } = el;
-        let result = null
-        if (roletype.includes(type)) {  // 过滤角色类型
-            if (!set.has(userid)) { // 去重
-                set.add(userid)
-                result = el
-            }
-        }
-        return result
+export function queryTableList() {
+    // 加载状态
+    const loading = ref<boolean>(false);
+    // 表格数据
+    const tableList = ref<ErmcpLoginUserEx[]>([]);
+    function queryTable() {
+        queryResultLoadingAndInfo(QueryAccMgrLoginUser, loading, 1)
+            .then(res => tableList.value = res)
     }
-    // 业务员
-    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 { businesserList, merchandiserList, getBusinesserList }
+    return { loading, tableList, queryTable }
 }

+ 5 - 6
src/views/information/account_info/list/account_info_futures/index.vue

@@ -13,7 +13,7 @@
       </span>
     </div>
     <a-collapse class="spotCollapse"
-                v-for="(item, i) in futuresList"
+                v-for="(item, i) in tableList"
                 :key="i + '11'"
                 :bordered="false">
       <template #expandIcon="props">
@@ -62,7 +62,7 @@ import { defineComponent, initData, getBtnList, contextMenu, BtnList } from '@/c
 import filterCustomTable from '@/views/information/goods/components/filterTable/index.vue';
 import { ref } from 'vue';
 import { getAccountStatus } from '../setup';
-import { handleTradeAccount } from './setup';
+import { queryTableList } from './setup';
 import { getUserName } from '@/services/bus/user';
 import Add from '../../compoments/add-futures/index.vue';
 
@@ -75,11 +75,10 @@ export default defineComponent({
         Add,
     },
     setup() {
-        const { futuresList, getRoleList } = handleTradeAccount();
+        const { loading, tableList, queryTable } = queryTableList();
         const { commonBtn, forDataBtn } = getBtnList('account_info_manager', true);
-        const loading = ref<boolean>(false);
         initData(() => {
-            getRoleList();
+            queryTable();
         });
 
         // 查询
@@ -90,7 +89,7 @@ export default defineComponent({
             forDataBtn,
             loading,
             search,
-            futuresList,
+            tableList,
             getAccountStatus,
             getUserName,
         };

+ 10 - 20
src/views/information/account_info/list/account_info_futures/setup.ts

@@ -1,26 +1,16 @@
+import { queryResultLoadingAndInfo } from "@/common/methods/request/resultInfo";
 import { QueryAccMgrTaaccount } from "@/services/go/ermcp/account";
 import { ErmcpTaAccountEx } from "@/services/go/ermcp/account/interface";
-import { message } from "ant-design-vue";
 import { ref } from "vue";
 
-export function handleTradeAccount() {
-    // 管理账户
-    const futuresList = ref<ErmcpTaAccountEx[]>([])
-    function getRoleList() {
-        QueryAccMgrTaaccount().then(res => {
-            futuresList.value = res;
-            // const set = new Set<number>([])
-            console.log('期货账户', res);
-
-            // managersList.value.length = 0;
-            // res.forEach(e => {
-            //     const { roleid } = e;
-            //     if (!set.has(roleid)) { // 去重
-            //         set.add(roleid)
-            //         managersList.value.push(e)
-            //     }
-            // })
-        }).catch(err => message.error(err))
+export function queryTableList() {
+    // 加载状态
+    const loading = ref<boolean>(false);
+    // 表格数据
+    const tableList = ref<ErmcpTaAccountEx[]>([]);
+    function queryTable() {
+        queryResultLoadingAndInfo(QueryAccMgrTaaccount, loading)
+            .then(res => tableList.value = res)
     }
-    return { futuresList, getRoleList }
+    return { loading, tableList, queryTable }
 }

+ 12 - 13
src/views/information/account_info/list/account_info_manager/index.vue

@@ -13,7 +13,7 @@
       </span>
     </div>
     <a-collapse class="spotCollapse"
-                v-for="(item, i) in managersList"
+                v-for="(item, i) in tableList"
                 :key="i + '11'"
                 :bordered="false">
       <template #expandIcon="props">
@@ -37,20 +37,20 @@
             </a-col>
           </a-row>
         </template>
-        <!-- <a-collapse class="busyCollapse"
-                    v-for="(item, i) in managersList"
-                    :key="i + '11'"
+        <a-collapse class="busyCollapse"
                     :bordered="false">
           <a-collapse-panel :show-arrow="false">
             <template #header>
-              <a-row class="contRow">
-                <a-col :span="12">{{item.rolename}}</a-col>
-                <a-col :span="12">{{getAccountStatus(item.accountstatus)}}</a-col>
+              <a-row class="contRow"
+                     v-for="(sub, i) in item.userlist"
+                     :key="i + '11'">
+                <a-col :span="12">{{sub.accountname}}-{{sub.logincode}}</a-col>
+                <a-col :span="12">{{getLoginStatusEnumItemName(sub.loginstatus)}}</a-col>
               </a-row>
             </template>
             <BtnList :btnList="forDataBtn" />
           </a-collapse-panel>
-        </a-collapse> -->
+        </a-collapse>
       </a-collapse-panel>
     </a-collapse>
     <Add />
@@ -62,7 +62,7 @@ import { defineComponent, initData, getBtnList, contextMenu, BtnList } from '@/c
 import filterCustomTable from '@/views/information/goods/components/filterTable/index.vue';
 import { ref } from 'vue';
 import { getAccountStatus } from '../setup';
-import { handleTradeAccount } from './setup';
+import { queryTableList } from './setup';
 import { getUserName } from '@/services/bus/user';
 import Add from '../../compoments/add-managers/index.vue';
 
@@ -75,11 +75,10 @@ export default defineComponent({
         Add,
     },
     setup() {
-        const { managersList, getRoleList } = handleTradeAccount();
+        const { loading, tableList, queryTable } = queryTableList();
         const { commonBtn, forDataBtn } = getBtnList('account_info_manager', true);
-        const loading = ref<boolean>(false);
         initData(() => {
-            getRoleList();
+            queryTable();
         });
 
         // 查询
@@ -90,7 +89,7 @@ export default defineComponent({
             forDataBtn,
             loading,
             search,
-            managersList,
+            tableList,
             getAccountStatus,
             getUserName,
         };

+ 10 - 20
src/views/information/account_info/list/account_info_manager/setup.ts

@@ -1,26 +1,16 @@
+import { queryResultLoadingAndInfo } from "@/common/methods/request/resultInfo";
 import { QueryAccMgrLoginUser } from "@/services/go/ermcp/account";
 import { ErmcpLoginUserEx } from "@/services/go/ermcp/account/interface";
-import { message } from "ant-design-vue";
 import { ref } from "vue";
 
-export function handleTradeAccount() {
-    // 管理账户
-    const managersList = ref<ErmcpLoginUserEx[]>([])
-    function getRoleList() {
-        QueryAccMgrLoginUser(3).then(res => {
-            managersList.value = res;
-            // const set = new Set<number>([])
-            console.log('管理账户', res);
-
-            // managersList.value.length = 0;
-            // res.forEach(e => {
-            //     const { roleid } = e;
-            //     if (!set.has(roleid)) { // 去重
-            //         set.add(roleid)
-            //         managersList.value.push(e)
-            //     }
-            // })
-        }).catch(err => message.error(err))
+export function queryTableList() {
+    // 加载状态
+    const loading = ref<boolean>(false);
+    // 表格数据
+    const tableList = ref<ErmcpLoginUserEx[]>([]);
+    function queryTable() {
+        queryResultLoadingAndInfo(QueryAccMgrLoginUser, loading, 3)
+            .then(res => tableList.value = res)
     }
-    return { managersList, getRoleList }
+    return { loading, tableList, queryTable }
 }

+ 12 - 12
src/views/information/account_info/list/account_info_trade/index.vue

@@ -13,6 +13,8 @@
       </span>
     </div>
     <a-collapse class="spotCollapse"
+                v-for="(item, i) in tableList"
+                :key="i + '11'"
                 :bordered="false">
       <template #expandIcon="props">
         <svg class="icon svg-icon"
@@ -29,21 +31,21 @@
       <a-collapse-panel>
         <template #header>
           <a-row class="headRow">
-            <a-col :span="12">跟单员(3)</a-col>
+            <a-col :span="12">{{item.rolename}}({{item.userlist.length}})</a-col>
             <a-col :span="12">
               <BtnList :btnList="commonBtn" />
             </a-col>
           </a-row>
         </template>
         <a-collapse class="busyCollapse"
-                    v-for="(item, i) in traderList"
+                    v-for="(sub, i) in item.userlist"
                     :key="i + '11'"
                     :bordered="false">
           <a-collapse-panel :show-arrow="false">
             <template #header>
               <a-row class="contRow">
-                <a-col :span="12">{{item.rolename}}</a-col>
-                <a-col :span="12">{{getAccountStatus(item.accountstatus)}}</a-col>
+                <a-col :span="12">{{sub.rolename}}</a-col>
+                <a-col :span="12">{{getRoleTypeName(sub.rolestatus)}}</a-col>
               </a-row>
             </template>
             <BtnList :btnList="forDataBtn" />
@@ -59,9 +61,8 @@
 <script lang="ts">
 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 { getAccountStatus } from '../setup';
-import { handleTradeAccount } from './setup';
+import { getRoleTypeName } from '../setup';
+import { queryTableList } from './setup';
 import { getUserName } from '@/services/bus/user';
 import Modify from '../../compoments/modify-traders/index.vue';
 import Add from '../../compoments/add-traders/index.vue';
@@ -76,11 +77,10 @@ export default defineComponent({
         Add,
     },
     setup() {
-        const { traderList, getRoleList } = handleTradeAccount();
+        const { loading, tableList, queryTable } = queryTableList();
         const { commonBtn, forDataBtn } = getBtnList('account_info_trade', true);
-        const loading = ref<boolean>(false);
         initData(() => {
-            getRoleList();
+            queryTable();
         });
 
         // 查询
@@ -91,8 +91,8 @@ export default defineComponent({
             forDataBtn,
             loading,
             search,
-            traderList,
-            getAccountStatus,
+            tableList,
+            getRoleTypeName,
             getUserName,
         };
     },

+ 10 - 17
src/views/information/account_info/list/account_info_trade/setup.ts

@@ -1,23 +1,16 @@
+import { queryResultLoadingAndInfo } from "@/common/methods/request/resultInfo";
 import { QueryAccMgrLoginUser } from "@/services/go/ermcp/account";
 import { ErmcpLoginUserEx } from "@/services/go/ermcp/account/interface";
-import { message } from "ant-design-vue";
 import { ref } from "vue";
 
-export function handleTradeAccount() {
-    // 交易用户
-    const traderList = ref<ErmcpLoginUserEx[]>([])
-    function getRoleList() {
-        QueryAccMgrLoginUser(2).then(res => {
-            const set = new Set<number>([])
-            traderList.value.length = 0;
-            res.forEach(e => {
-                const { roleid } = e;
-                if (!set.has(roleid)) { // 去重
-                    set.add(roleid)
-                    traderList.value.push(e)
-                }
-            })
-        }).catch(err => message.error(err))
+export function queryTableList() {
+    // 加载状态
+    const loading = ref<boolean>(false);
+    // 表格数据
+    const tableList = ref<ErmcpLoginUserEx[]>([]);
+    function queryTable() {
+        queryResultLoadingAndInfo(QueryAccMgrLoginUser, loading, 2)
+            .then(res => tableList.value = res)
     }
-    return { traderList, getRoleList }
+    return { loading, tableList, queryTable }
 }

+ 18 - 0
src/views/information/account_info/list/setup.ts

@@ -117,3 +117,21 @@ export function getAccountStatus(type: number) {
     }
     return result
 }
+
+/**
+ * 获取角色状态
+ * @param type 
+ * @returns 
+ */
+export function getRoleTypeName(type: number) {
+    let result = '--'
+    switch (type) {
+        case 1:
+            result = '启用'
+            break;
+        case 2:
+            result = '停用'
+            break;
+    }
+    return result
+}

+ 2 - 2
src/views/information/spot-contract/components/add/setup.ts

@@ -1,4 +1,4 @@
-import APP from "@/services";
+import { getAreaUserId } from "@/services/bus/user";
 import {
     GldErmcpSpotContractOperateReq,
     GldSpotContractInfo
@@ -19,7 +19,7 @@ export function addContractReq() {
     function sendReq(form: FormState, loading: Ref<boolean>, OperateType: 1 | 2): Promise<string> {
         loading.value = true
         const info: GldSpotContractInfo = {
-            UserID: APP.get('userAccount').memberuserid,//  机构ID
+            UserID: getAreaUserId(),//  机构ID
             ProductType: 1, //                              产品类型 产品类型-1:标准仓单2:等标3:非标
             ContractNo: form.ContractNo,      //            现货合同编号
             ContractType: form.ContractType, //             现货合同类型-1:采购-1:销售

+ 2 - 2
src/views/information/spot-contract/components/modify/setup.ts

@@ -1,4 +1,4 @@
-import APP from "@/services";
+import { getAreaUserId } from "@/services/bus/user";
 import {
     GldErmcpSpotContractOperateReq,
     GldSpotContractInfo
@@ -20,7 +20,7 @@ export function addContractReq() {
     function sendReq(form: FormState, loading: Ref<boolean>, OperateType: 1 | 2): Promise<string> {
         loading.value = true
         const info: GldSpotContractInfo = {
-            UserID: APP.get('userAccount').memberuserid,//  机构ID
+            UserID: getAreaUserId(),//  机构ID
             ProductType: 1, //                              产品类型 产品类型-1:标准仓单2:等标3:非标
             ContractNo: form.ContractNo,      //            现货合同编号
             ContractType: form.ContractType, //             现货合同类型-1:采购-1:销售