huangbin 4 년 전
부모
커밋
5e1119e91c

+ 85 - 58
src/views/information/account_info/list/account_info_manager/index.vue

@@ -1,53 +1,70 @@
 <template>
-    <div style="background: red; color: #fff; padding: 5px 0">待修改</div>
-    <!-- 管理账户 -->
-    <div class="account_info_manager account_info_container" :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>
-                {{ getUserName() }}
-            </span>
-            <mtp-table-button :buttons="firstBtn" @click="openComponent" />
-        </div>
-        <div class="a-collapse-container">
-            <a-collapse class="spotCollapse" v-for="(item, i) in tableList" :key="i + '11'" :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">{{ item.rolename }}({{ item.userlist.length }})</a-col>
-                            <a-col :span="12">
-                                <!-- <BtnList :selectedData="item" :btnList="secondBtn" @onClick="openAction" /> -->
-                                <mtp-table-button :buttons="secondBtn" :record="item" @click="openComponent" />
-                            </a-col>
-                        </a-row>
-                    </template>
-                    <a-collapse class="busyCollapse" 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">{{ sub.loginname }}-{{ sub.logincode }}</a-col>
-                                    <a-col :span="12">{{ getLoginStatusEnumItemName(sub.loginstatus) }}</a-col>
-                                </a-row>
-                            </template>
-                            <!-- <BtnList :btnList="sub.btnList" :selectedData="sub" @onClick="moreOptenAction" /> -->
-                            <mtp-table-button :buttons="thirdBtn" :record="sub" @click="openComponent" />
-                        </a-collapse-panel>
-                    </a-collapse>
-                </a-collapse-panel>
-            </a-collapse>
-        </div>
-        <!-- <Add @refresh="handleBtnAction" :selectedData="addModelData" :tableList="tableList" />
+  <div style="background: red; color: #fff; padding: 5px 0">待修改</div>
+  <!-- 管理账户 -->
+  <div class="account_info_manager account_info_container"
+       :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>
+        {{ getUserName() }}
+      </span>
+      <mtp-table-button :buttons="firstBtn"
+                        @click="openComponent" />
+    </div>
+    <div class="a-collapse-container">
+      <a-collapse class="spotCollapse"
+                  v-for="(item, i) in tableList"
+                  :key="i + '11'"
+                  :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">{{ item.rolename }}({{ item.userlist.length }})</a-col>
+              <a-col :span="12">
+                <!-- <BtnList :selectedData="item" :btnList="secondBtn" @onClick="openAction" /> -->
+                <mtp-table-button :buttons="secondBtn"
+                                  :record="item"
+                                  @click="openComponent" />
+              </a-col>
+            </a-row>
+          </template>
+          <a-collapse class="busyCollapse"
+                      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">{{ sub.loginname }}-{{ sub.logincode }}</a-col>
+                  <a-col :span="12">{{ getLoginStatusEnumItemName(sub.loginstatus) }}</a-col>
+                </a-row>
+              </template>
+              <!-- <BtnList :btnList="sub.btnList" :selectedData="sub" @onClick="moreOptenAction" /> -->
+              <mtp-table-button :buttons="thirdBtn"
+                                :record="sub"
+                                @click="openComponent" />
+            </a-collapse-panel>
+          </a-collapse>
+        </a-collapse-panel>
+      </a-collapse>
+    </div>
+    <!-- <Add @refresh="handleBtnAction" :selectedData="addModelData" :tableList="tableList" />
         <Modify :tableList="tableList" @refresh="handleBtnAction" :selectedData="moreModelData" />
         <Cancel @refresh="handleBtnAction" :selectedData="moreModelData" />
         <Locked @refresh="handleBtnAction" :selectedData="moreModelData" />
@@ -56,8 +73,12 @@
         <Detail :selectedData="moreModelData" />
         <AddPermission @refresh="handleBtnAction" />
         <Permission /> -->
-        <component :is="componentId" v-if="componentId" :tableList="tableList" :selectedData="selectedData" @cancel="closeComponent"></component>
-    </div>
+    <component :is="componentId"
+               v-if="componentId"
+               :tableList="tableList"
+               :selectedData="selectedData"
+               @cancel="closeComponent"></component>
+  </div>
 </template>
 
 <script lang="ts">
@@ -65,7 +86,7 @@ import { defineAsyncComponent, defineComponent, MtpTableButton } from '@/common/
 import { initData } from '@/common/methods';
 import filterCustomTable from '@/views/information/goods/components/filterTable/index.vue';
 import { getLoginStatusEnumItemName } from '@/common/constants/enumsName';
-import { getAccountStatus, handleModalData, handleTableList, useTaAccount } from '../setup';
+import { getAccountStatus, handleModalData, handleTableList, useSelectedData, useTaAccount } from '../setup';
 import { getUserName } from '@/services/bus/user';
 import { ErmcpLoginUser, ErmcpLoginUserEx } from '@/services/go/ermcp/account/interface';
 import { handlerManagerList } from '@/common/setup/user';
@@ -98,9 +119,9 @@ export default defineComponent({
         const thirdBtn = getTableButton(['account_manager_child_modify', 'account_manager_child_reset', 'account_manager_child_locked', 'account_manager_child_unlocked', 'account_trade_child_cancel', 'detail']);
 
         // 新增弹窗
-        const { selectedData: addModelData, openAction } = handleModalData<ErmcpLoginUserEx>();
+        // const { selectedData: addModelData, openAction } = handleModalData<ErmcpLoginUserEx>();
         // 修改 重置密码、详情等弹窗
-        const { selectedData: moreModelData, openAction: moreOptenAction } = handleModalData<ErmcpLoginUser>();
+        // const { selectedData: moreModelData, openAction: moreOptenAction } = handleModalData<ErmcpLoginUser>();
 
         // 处理根据状态显示对应按钮
         function handleBtnAction() {
@@ -112,6 +133,9 @@ export default defineComponent({
         // 控制异步组件
         const { componentId, closeComponent, openComponent } = handleModalComponent<ErmcpLoginUser>(handleBtnAction, selectedData as Ref<ErmcpLoginUser>);
 
+        // 处理点击 二级按钮时候 选中的数据
+        const { firstSelectedData, openSecondBtnAction } = useSelectedData(tableList, openComponent);
+
         // 期货账户
         const { updateTaAccount } = useTaAccount();
         initData(() => {
@@ -132,14 +156,17 @@ export default defineComponent({
             getAccountStatus,
             getUserName,
             getLoginStatusEnumItemName,
-            addModelData,
-            openAction,
-            moreModelData,
-            moreOptenAction,
+            // addModelData,
+            // openAction,
+            // moreModelData,
+            // moreOptenAction,
             handleBtnAction,
             componentId,
             closeComponent,
             openComponent,
+            firstSelectedData,
+            openSecondBtnAction,
+            selectedData,
         };
     },
 });

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

@@ -1,58 +1,81 @@
 <template>
-    <!-- 交易账户 -->
-    <div class="account_info_trade account_info_container" :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>
-                {{ getUserName() }}
-            </span>
-            <mtp-table-button :buttons="firstBtn" @click="openComponent" />
-        </div>
-        <div class="a-collapse-container">
-            <a-collapse class="spotCollapse" v-for="(item, i) in tableList" :key="i + '11'" :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"> {{ item.rolename }}({{ item.userlist.length }}) </a-col>
-                            <a-col :span="12">
-                                <mtp-table-button :buttons="secondBtn" :record="item" @click="openComponent" />
-                            </a-col>
-                        </a-row>
-                    </template>
-                    <a-collapse class="busyCollapse" 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">{{ sub.loginname }}-{{ sub.logincode }}</a-col>
-                                    <a-col :span="12">{{ getRoleTypeName(sub.loginstatus) }}</a-col>
-                                </a-row>
-                            </template>
-                            <mtp-table-button :buttons="thirdBtn" :record="sub" @click="openSecondBtnAction" />
-                        </a-collapse-panel>
-                    </a-collapse>
-                </a-collapse-panel>
-            </a-collapse>
-        </div>
-        <component :is="componentId" v-if="componentId" :accountList="accountList" :tableList="tableList" :firstBtnData="firstSelectedData" :selectedData="selectedData" @cancel="closeComponent"></component>
+  <!-- 交易账户 -->
+  <div class="account_info_trade account_info_container"
+       :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>
+        {{ getUserName() }}
+      </span>
+      <mtp-table-button :buttons="firstBtn"
+                        @click="openComponent" />
     </div>
+    <div class="a-collapse-container">
+      <a-collapse class="spotCollapse"
+                  v-for="(item, i) in tableList"
+                  :key="i + '11'"
+                  :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"> {{ item.rolename }}({{ item.userlist.length }}) </a-col>
+              <a-col :span="12">
+                <mtp-table-button :buttons="secondBtn"
+                                  :record="item"
+                                  @click="openComponent" />
+              </a-col>
+            </a-row>
+          </template>
+          <a-collapse class="busyCollapse"
+                      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">{{ sub.loginname }}-{{ sub.logincode }}</a-col>
+                  <a-col :span="12">{{ getRoleTypeName(sub.loginstatus) }}</a-col>
+                </a-row>
+              </template>
+              <mtp-table-button :buttons="thirdBtn"
+                                :record="sub"
+                                @click="openSecondBtnAction" />
+            </a-collapse-panel>
+          </a-collapse>
+        </a-collapse-panel>
+      </a-collapse>
+    </div>
+    <component :is="componentId"
+               v-if="componentId"
+               :accountList="accountList"
+               :tableList="tableList"
+               :firstBtnData="firstSelectedData"
+               :selectedData="selectedData"
+               @cancel="closeComponent"></component>
+  </div>
 </template>
 
 <script lang="ts">
 import { initData } from '@/common/methods';
 import { defineAsyncComponent, defineComponent, MtpTableButton } from '@/common/export/commonTable';
 import filterCustomTable from '@/views/information/goods/components/filterTable/index.vue';
-import { getRoleTypeName } from '../setup';
+import { getRoleTypeName, useSelectedData } from '../setup';
 import { getUserName } from '@/services/bus/user';
 import { handleTableList } from '../setup';
 import { ErmcpLoginUser, ErmcpLoginUserEx, ErmcpTaAccount, ErmcpTaAccountEx } from '@/services/go/ermcp/account/interface';
@@ -99,19 +122,9 @@ export default defineComponent({
         const selectedData = ref<ErmcpLoginUser>();
         // 控制异步组件
         const { componentId, closeComponent, openComponent } = handleModalComponent<ErmcpLoginUser>(handleBtnAction, selectedData as Ref<ErmcpLoginUser>);
-        // 一级 对应的选中数据
-        const firstSelectedData = ref<ErmcpLoginUserEx>();
-        // 二级按钮 打开,处理选中上一层数据
-        function openSecondBtnAction(item: BtnListType, second: ErmcpLoginUser) {
-            tableList.value.forEach((el) => {
-                el.userlist.forEach((sub) => {
-                    if (second.userid === sub.userid) {
-                        firstSelectedData.value = el;
-                    }
-                });
-            });
-            openComponent(item, second);
-        }
+
+        // 处理点击 二级按钮时候 选中的数据
+        const { firstSelectedData, openSecondBtnAction } = useSelectedData(tableList, openComponent);
 
         initData(() => {
             handleBtnAction();

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

@@ -2,7 +2,7 @@ import { BtnListType } from '@/common/components/btnList/interface';
 import { initData } from '@/common/methods';
 import { queryResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
 import { QueryAccMgrTaaccount } from '@/services/go/ermcp/account';
-import { ErmcpLoginUserEx, ErmcpTaAccount, ErmcpTaAccountEx } from "@/services/go/ermcp/account/interface";
+import { ErmcpLoginUser, ErmcpLoginUserEx, ErmcpTaAccount, ErmcpTaAccountEx } from "@/services/go/ermcp/account/interface";
 import { reactive, ref, Ref } from "vue";
 
 /**
@@ -190,4 +190,23 @@ export function useTaAccount() {
         return accountList.value.filter((e) => e.relateduserid === id);
     }
     return { accountList, filerTaAccount, updateTaAccount }
+}
+
+
+// 处理 点击二级 按钮时候,一级 选中 的数据
+export function useSelectedData(tableList: Ref<ErmcpLoginUserEx[]>, openComponent: Function) {
+    // 一级 对应的选中数据
+    const firstSelectedData = ref<ErmcpLoginUserEx>();
+    // 二级按钮 打开,处理选中上一层数据
+    function openSecondBtnAction(item: BtnListType, second: ErmcpLoginUser) {
+        tableList.value.forEach((el) => {
+            el.userlist.forEach((sub) => {
+                if (second.userid === sub.userid) {
+                    firstSelectedData.value = el;
+                }
+            });
+        });
+        openComponent(item, second);
+    }
+    return { firstSelectedData, openSecondBtnAction }
 }