huangbin 4 vuotta sitten
vanhempi
commit
af08d29573

+ 48 - 21
src/views/information/account_info/compoments/detail-trader/index.vue

@@ -16,44 +16,58 @@
             :model="formState">
       <a-row :gutter="24">
         <a-col :span="12">
-          <a-form-item label="登录账号"
+          <a-form-item label="所属用户"
                        name="">
-            <span class="white">{{formState.accountname}}</span>
+            <span class="white">{{rolename}}</span>
           </a-form-item>
         </a-col>
         <a-col :span="12">
           <a-form-item label="账户名称"
-                       name="">
-            <span class="white">{{formState.logincode}}</span>
+                       name="logincode">
+            <a-input class="dialogInput"
+                     style="width: 200px"
+                     v-model:value="formState.logincode"
+                     placeholder="请输入账户名称" />
+          </a-form-item>
+        </a-col>
+        <a-col :span="12">
+          <a-form-item label="登录账号"
+                       name="accountname">
+            <a-input class="dialogInput"
+                     style="width: 200px"
+                     v-model:value="formState.accountname"
+                     placeholder="请输入登录账号" />
           </a-form-item>
         </a-col>
         <a-col :span="12">
           <a-form-item label="登录密码"
-                       name="">
+                       name="password">
             <a-input-password class="dialogInput"
                               style="width: 200px"
-                              value="2323423"
                               v-model:value="formState.password"
-                              readonly />
+                              placeholder="请输入登录密码" />
           </a-form-item>
         </a-col>
-        <a-col :span="12">
+        <a-col :span="24">
           <a-form-item label="手机号码"
-                       name="">
-            <span class="white">{{formState.mobile}}</span>
+                       name="mobile">
+            <a-input class="dialogInput"
+                     v-model:value="formState.mobile"
+                     style="width: 200px"
+                     placeholder="请输入手机号码" />
           </a-form-item>
         </a-col>
         <a-col :span="24">
-          <a-form-item label="账户角色"
-                       name="userinfotype">
+          <a-form-item label="授权期货账户"
+                       class="checkboxGroupItem"
+                       name="logintaaccounts">
             <a-checkbox-group class="commonCheckboxGroup"
-                              v-model:value="formState.roleids">
+                              v-model:value="formState.logintaaccounts">
               <a-row>
-                <a-col :span="12">
-                  <a-checkbox :value="22">业务员</a-checkbox>
-                </a-col>
-                <a-col :span="12">
-                  <a-checkbox :value="23">跟单员</a-checkbox>
+                <a-col :span="12"
+                       v-for="(item, index) in accountList"
+                       :key="index">
+                  <a-checkbox :value="item.accountid">{{item.accountname}}/{{item.accountid}}</a-checkbox>
                 </a-col>
               </a-row>
             </a-checkbox-group>
@@ -65,27 +79,39 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, PropType, watchEffect } from 'vue';
+import { defineComponent, PropType, ref, watchEffect } from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
 import { mergeTwoObj } from '@/utils/objHandle';
 import { handleBusinessForm } from '../setup';
-import { ErmcpLoginUser } from '@/services/go/ermcp/account/interface';
+import { ErmcpLoginUser, ErmcpLoginUserEx } from '@/services/go/ermcp/account/interface';
 
 export default defineComponent({
-    name: 'business-detail',
+    name: 'trader-detail',
     components: {},
     props: {
         selectedData: {
             type: Object as PropType<ErmcpLoginUser>,
             default: {},
         },
+        tableList: {
+            type: Array as PropType<ErmcpLoginUserEx[]>,
+            default: [],
+        },
     },
     setup(props) {
         const { visible, cancel } = closeModal('detail');
         const { formState } = handleBusinessForm();
+        const rolename = ref<string>('');
         watchEffect(() => {
             if (visible.value) {
                 mergeTwoObj(formState, props.selectedData);
+                props.tableList.forEach((el) => {
+                    el.userlist.forEach((item) => {
+                        if (item.loginid === props.selectedData.loginid) {
+                            rolename.value = el.rolename;
+                        }
+                    });
+                });
             }
         });
         return {
@@ -93,6 +119,7 @@ export default defineComponent({
             cancel,
             formState,
             maskClosableFlag: false,
+            rolename,
         };
     },
 });

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

@@ -57,18 +57,18 @@
         </a-collapse>
       </a-collapse-panel>
     </a-collapse>
-    <Add @refresh="handleTableList"
+    <Add @refresh="handleBtnAction"
          :roleid="addModelData.roleid" />
     <Modify :selectedData="moreModelData"
-            @refresh="handleTableList" />
+            @refresh="handleBtnAction" />
     <Reset :selectedData="moreModelData"
-           @refresh="handleTableList" />
+           @refresh="handleBtnAction" />
     <Locked :selectedData="moreModelData"
-            @refresh="handleTableList" />
+            @refresh="handleBtnAction" />
     <Unlocked :selectedData="moreModelData"
-              @refresh="handleTableList" />
+              @refresh="handleBtnAction" />
     <Cancel :selectedData="moreModelData"
-            @refresh="handleTableList" />
+            @refresh="handleBtnAction" />
     <Detail :selectedData="moreModelData" />
   </div>
 </template>
@@ -87,7 +87,7 @@ import Detail from '../../compoments/detail-business/index.vue';
 import Unlocked from '../../compoments/unlocked-business/index.vue';
 import { ErmcpLoginUser, ErmcpLoginUserEx } from '@/services/go/ermcp/account/interface';
 import { getUserName } from '@/services/bus/user';
-import { handleModalData } from '../setup';
+import { handleModalData, handleTableList } from '../setup';
 
 export default defineComponent({
     name: 'account_info_business',
@@ -110,29 +110,12 @@ export default defineComponent({
         const { selectedData: addModelData, openAction } = handleModalData<ErmcpLoginUserEx>();
         // 修改 重置密码、详情等弹窗
         const { selectedData: moreModelData, openAction: moreOptenAction } = handleModalData<ErmcpLoginUser>();
-        function handleTableList() {
-            queryTable().then(() => {
-                tableList.value.forEach((el) => {
-                    // 过滤无效
-                    const arr = el.userlist.filter((item) => item.loginstatus !== 3);
-                    arr.forEach((item) => {
-                        const { loginstatus } = item;
-                        let btnList = [...forDataBtn.value];
-                        if (loginstatus === 1) {
-                            // 正常
-                            btnList = forDataBtn.value.filter((e) => e.lable !== '解锁');
-                        } else if (loginstatus === 2) {
-                            // 冻结
-                            btnList = forDataBtn.value.filter((e) => e.lable === '解锁' || e.lable === '详情');
-                        }
-                        Object.assign(item, { btnList });
-                    });
-                    Object.assign(el, { userlist: arr });
-                });
-            });
+        // 处理根据状态显示对应按钮
+        function handleBtnAction() {
+            handleTableList(queryTable, tableList, forDataBtn.value);
         }
         initData(() => {
-            handleTableList();
+            handleBtnAction();
         });
         // 查询
         function search(value: any) {}
@@ -143,7 +126,7 @@ export default defineComponent({
             search,
             tableList,
             getLoginStatusEnumItemName,
-            handleTableList,
+            handleBtnAction,
             moreModelData,
             getUserName,
             openAction,

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

@@ -50,24 +50,27 @@
                 <a-col :span="12">{{getRoleTypeName(sub.rolestatus)}}</a-col>
               </a-row>
             </template>
-            <BtnList :btnList="forDataBtn" />
+            <BtnList :btnList="sub.btnList"
+                     :selectedData="sub"
+                     @onClick="moreOptenAction" />
           </a-collapse-panel>
         </a-collapse>
       </a-collapse-panel>
     </a-collapse>
-    <Add @refresh="queryTable"
+    <Add @refresh="handleBtnAction"
          :selectedData="addModelData" />
-    <Modify @refresh="queryTable"
-            :selectedData="moreOptenAction" />
-    <Locked @refresh="queryTable"
-            :selectedData="moreOptenAction" />
-    <Unlocked @refresh="queryTable"
-              :selectedData="moreOptenAction" />
-    <Cancel @refresh="queryTable"
-            :selectedData="moreOptenAction" />
-    <Reset @refresh="queryTable"
-           :selectedData="moreOptenAction" />
-    <Detail :selectedData="moreOptenAction" />
+    <Modify @refresh="handleBtnAction"
+            :selectedData="moreModelData" />
+    <Locked @refresh="handleBtnAction"
+            :selectedData="moreModelData" />
+    <Unlocked @refresh="handleBtnAction"
+              :selectedData="moreModelData" />
+    <Cancel @refresh="handleBtnAction"
+            :selectedData="moreModelData" />
+    <Reset @refresh="handleBtnAction"
+           :selectedData="moreModelData" />
+    <Detail :selectedData="moreModelData"
+            :tableList="tableList" />
 
   </div>
 </template>
@@ -85,7 +88,7 @@ import Unlocked from '../../compoments/unlocked-trader/index.vue';
 import Cancel from '../../compoments/cancel-trader/index.vue';
 import Reset from '../../compoments/reset-trader/index.vue';
 import Detail from '../../compoments/detail-trader/index.vue';
-import { handleModalData } from '../setup';
+import { handleModalData, handleTableList } from '../setup';
 import { ErmcpLoginUser, ErmcpLoginUserEx } from '@/services/go/ermcp/account/interface';
 
 export default defineComponent({
@@ -109,8 +112,12 @@ export default defineComponent({
         const { selectedData: addModelData, openAction } = handleModalData<ErmcpLoginUserEx>();
         // 修改 重置密码、详情等弹窗
         const { selectedData: moreModelData, openAction: moreOptenAction } = handleModalData<ErmcpLoginUser>();
+        // 处理根据状态显示对应按钮
+        function handleBtnAction() {
+            handleTableList(queryTable, tableList, forDataBtn.value);
+        }
         initData(() => {
-            queryTable();
+            handleBtnAction();
         });
         // 查询
         function search(value: any) {}
@@ -127,6 +134,7 @@ export default defineComponent({
             openAction,
             moreModelData,
             moreOptenAction,
+            handleBtnAction,
         };
     },
 });

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

@@ -9,7 +9,7 @@ export function queryTableList() {
     // 表格数据
     const tableList = ref<ErmcpLoginUserEx[]>([]);
     function queryTable() {
-        queryResultLoadingAndInfo(QueryAccMgrLoginUser, loading, 2)
+        return queryResultLoadingAndInfo(QueryAccMgrLoginUser, loading, 2)
             .then(res => tableList.value = res)
     }
     return { loading, tableList, queryTable }

+ 25 - 1
src/views/information/account_info/list/setup.ts

@@ -1,4 +1,6 @@
-import { reactive } from "vue";
+import { BtnList } from "@/common/setup/table/interface";
+import { ErmcpLoginUserEx } from "@/services/go/ermcp/account/interface";
+import { reactive, Ref } from "vue";
 
 /**
  * 获取账户状态
@@ -59,4 +61,26 @@ export function handleModalData<T extends object>() {
         Object.assign(selectedData, item)
     }
     return { selectedData, openAction }
+}
+
+export function handleTableList(fn: Function, tableList: Ref<ErmcpLoginUserEx[]>, btnList: BtnList[]) {
+    fn().then(() => {
+        tableList.value.forEach((el) => {
+            // 过滤无效
+            const arr = el.userlist.filter((item) => item.loginstatus !== 3);
+            arr.forEach((item) => {
+                const { loginstatus } = item;
+                let result = [...btnList];
+                if (loginstatus === 1) {
+                    // 正常
+                    result = btnList.filter((e) => e.lable !== '解锁');
+                } else if (loginstatus === 2) {
+                    // 冻结
+                    result = btnList.filter((e) => e.lable === '解锁' || e.lable === '详情');
+                }
+                Object.assign(item, { btnList: result });
+            });
+            Object.assign(el, { userlist: arr });
+        });
+    });
 }