Browse Source

交易账号详情

huangbin 4 years ago
parent
commit
dabbca3fef

+ 6 - 20
src/views/information/account_info/compoments/add-traders/index.vue

@@ -84,13 +84,11 @@
 
 
 <script lang="ts">
 <script lang="ts">
 import { closeModal } from '@/common/setup/modal/index';
 import { closeModal } from '@/common/setup/modal/index';
-import { defineComponent, ref, PropType, watchEffect } from 'vue';
-import { ErmcpLoginUserEx, ErmcpTaAccount, ErmcpTaAccountEx } from '@/services/go/ermcp/account/interface';
-import { queryResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
+import { defineComponent, ref, PropType } from 'vue';
+import { ErmcpLoginUserEx, ErmcpTaAccount } from '@/services/go/ermcp/account/interface';
 import { handleBusinessForm } from '../setup';
 import { handleBusinessForm } from '../setup';
 import { validateAction } from '@/common/setup/form';
 import { validateAction } from '@/common/setup/form';
 import { BusinessFormState } from '../interface';
 import { BusinessFormState } from '../interface';
-import { QueryAccMgrTaaccount } from '@/services/go/ermcp/account';
 
 
 export default defineComponent({
 export default defineComponent({
     name: 'account_info_trade_btn_add',
     name: 'account_info_trade_btn_add',
@@ -100,27 +98,16 @@ export default defineComponent({
             default: {},
             default: {},
             type: Object as PropType<ErmcpLoginUserEx>,
             type: Object as PropType<ErmcpLoginUserEx>,
         },
         },
+        accountList: {
+            default: {},
+            type: Object as PropType<ErmcpTaAccount>,
+        },
     },
     },
     setup() {
     setup() {
         const loading = ref<boolean>(false);
         const loading = ref<boolean>(false);
-        const accountList = ref<ErmcpTaAccount[]>([]);
         // 控制关闭弹窗
         // 控制关闭弹窗
         const { visible, cancel } = closeModal('account_info_trade_btn_add');
         const { visible, cancel } = closeModal('account_info_trade_btn_add');
         const { rules, formState, formRef } = handleBusinessForm();
         const { rules, formState, formRef } = handleBusinessForm();
-        watchEffect(() => {
-            if (visible.value) {
-                // 处理授权期货账户
-                queryResultLoadingAndInfo(QueryAccMgrTaaccount, loading).then((res) => {
-                    accountList.value.length = 0;
-                    res.forEach((el: ErmcpTaAccountEx) => {
-                        const { mainAcc, subacclist } = el;
-                        accountList.value.push(mainAcc);
-                        subacclist.forEach((e) => accountList.value.push(e));
-                    });
-                });
-            }
-        });
-
         function submit() {
         function submit() {
             validateAction<BusinessFormState>(formRef, formState).then((res) => {});
             validateAction<BusinessFormState>(formRef, formState).then((res) => {});
         }
         }
@@ -132,7 +119,6 @@ export default defineComponent({
             cancel,
             cancel,
             submit,
             submit,
             loading,
             loading,
-            accountList,
         };
         };
     },
     },
 });
 });

+ 18 - 22
src/views/information/account_info/compoments/detail-trader/index.vue

@@ -25,6 +25,7 @@
           <a-form-item label="账户名称"
           <a-form-item label="账户名称"
                        name="logincode">
                        name="logincode">
             <a-input class="dialogInput"
             <a-input class="dialogInput"
+                     readonly
                      style="width: 200px"
                      style="width: 200px"
                      v-model:value="formState.logincode"
                      v-model:value="formState.logincode"
                      placeholder="请输入账户名称" />
                      placeholder="请输入账户名称" />
@@ -35,25 +36,18 @@
                        name="accountname">
                        name="accountname">
             <a-input class="dialogInput"
             <a-input class="dialogInput"
                      style="width: 200px"
                      style="width: 200px"
+                     readonly
                      v-model:value="formState.accountname"
                      v-model:value="formState.accountname"
                      placeholder="请输入登录账号" />
                      placeholder="请输入登录账号" />
           </a-form-item>
           </a-form-item>
         </a-col>
         </a-col>
         <a-col :span="12">
         <a-col :span="12">
-          <a-form-item label="登录密码"
-                       name="password">
-            <a-input-password class="dialogInput"
-                              style="width: 200px"
-                              v-model:value="formState.password"
-                              placeholder="请输入登录密码" />
-          </a-form-item>
-        </a-col>
-        <a-col :span="24">
           <a-form-item label="手机号码"
           <a-form-item label="手机号码"
                        name="mobile">
                        name="mobile">
             <a-input class="dialogInput"
             <a-input class="dialogInput"
                      v-model:value="formState.mobile"
                      v-model:value="formState.mobile"
                      style="width: 200px"
                      style="width: 200px"
+                     readonly
                      placeholder="请输入手机号码" />
                      placeholder="请输入手机号码" />
           </a-form-item>
           </a-form-item>
         </a-col>
         </a-col>
@@ -62,10 +56,10 @@
                        class="checkboxGroupItem"
                        class="checkboxGroupItem"
                        name="logintaaccounts">
                        name="logintaaccounts">
             <a-checkbox-group class="commonCheckboxGroup"
             <a-checkbox-group class="commonCheckboxGroup"
-                              v-model:value="formState.logintaaccounts">
+                              v-model:checked="checkedList">
               <a-row>
               <a-row>
                 <a-col :span="12"
                 <a-col :span="12"
-                       v-for="(item, index) in accountList"
+                       v-for="(item, index) in selectedData.acclist"
                        :key="index">
                        :key="index">
                   <a-checkbox :value="item.accountid">{{item.accountname}}/{{item.accountid}}</a-checkbox>
                   <a-checkbox :value="item.accountid">{{item.accountname}}/{{item.accountid}}</a-checkbox>
                 </a-col>
                 </a-col>
@@ -82,8 +76,8 @@
 import { defineComponent, PropType, ref, watchEffect } from 'vue';
 import { defineComponent, PropType, ref, watchEffect } from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
 import { closeModal } from '@/common/setup/modal/index';
 import { mergeTwoObj } from '@/utils/objHandle';
 import { mergeTwoObj } from '@/utils/objHandle';
-import { handleBusinessForm } from '../setup';
-import { ErmcpLoginUser, ErmcpLoginUserEx } from '@/services/go/ermcp/account/interface';
+import { handleBusinessForm, handleRoleName } from '../setup';
+import { ErmcpLoginUser, ErmcpLoginUserEx, ErmcpTaAccount } from '@/services/go/ermcp/account/interface';
 
 
 export default defineComponent({
 export default defineComponent({
     name: 'trader-detail',
     name: 'trader-detail',
@@ -97,21 +91,22 @@ export default defineComponent({
             type: Array as PropType<ErmcpLoginUserEx[]>,
             type: Array as PropType<ErmcpLoginUserEx[]>,
             default: [],
             default: [],
         },
         },
+        accountList: {
+            default: [],
+            type: Object as PropType<ErmcpTaAccount[]>,
+        },
     },
     },
     setup(props) {
     setup(props) {
         const { visible, cancel } = closeModal('detail');
         const { visible, cancel } = closeModal('detail');
         const { formState } = handleBusinessForm();
         const { formState } = handleBusinessForm();
-        const rolename = ref<string>('');
+        const { rolename, getRoleName } = handleRoleName();
+        const checkedList = ref<number[]>([]);
         watchEffect(() => {
         watchEffect(() => {
             if (visible.value) {
             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;
-                        }
-                    });
-                });
+                const { selectedData, tableList } = props;
+                mergeTwoObj(formState, selectedData);
+                getRoleName(tableList, selectedData);
+                checkedList.value = selectedData.acclist.map((e) => e.accountid);
             }
             }
         });
         });
         return {
         return {
@@ -120,6 +115,7 @@ export default defineComponent({
             formState,
             formState,
             maskClosableFlag: false,
             maskClosableFlag: false,
             rolename,
             rolename,
+            checkedList,
         };
         };
     },
     },
 });
 });

+ 23 - 4
src/views/information/account_info/compoments/setup.ts

@@ -1,3 +1,4 @@
+import { ErmcpLoginUser, ErmcpLoginUserEx } from "@/services/go/ermcp/account/interface";
 import { reactive, ref, UnwrapRef } from "vue";
 import { reactive, ref, UnwrapRef } from "vue";
 import { BusinessFormState } from './interface';
 import { BusinessFormState } from './interface';
 
 
@@ -26,7 +27,25 @@ export function handleBusinessForm() {
     return { rules, formState, formRef }
     return { rules, formState, formRef }
 }
 }
 
 
-
-
-
-
+/**
+ * 获取所属用户
+ * @returns 
+ */
+export function handleRoleName() {
+    // 所属用户
+    const rolename = ref<string>('');
+    function getRoleName(tableList: ErmcpLoginUserEx[], selectedData: ErmcpLoginUser) {
+        let flag = false;
+        for (const el of tableList) {
+            for (const item of el.userlist) {
+                if (item.loginid === selectedData.loginid) {
+                    rolename.value = el.rolename;
+                    flag = true;
+                    break
+                }
+            }
+            if (flag) break
+        }
+    }
+    return { rolename, getRoleName }
+}

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

@@ -58,18 +58,25 @@
       </a-collapse-panel>
       </a-collapse-panel>
     </a-collapse>
     </a-collapse>
     <Add @refresh="handleBtnAction"
     <Add @refresh="handleBtnAction"
+         :accountList="accountList"
          :selectedData="addModelData" />
          :selectedData="addModelData" />
     <Modify @refresh="handleBtnAction"
     <Modify @refresh="handleBtnAction"
+            :accountList="accountList"
             :selectedData="moreModelData" />
             :selectedData="moreModelData" />
     <Locked @refresh="handleBtnAction"
     <Locked @refresh="handleBtnAction"
+            :accountList="accountList"
             :selectedData="moreModelData" />
             :selectedData="moreModelData" />
     <Unlocked @refresh="handleBtnAction"
     <Unlocked @refresh="handleBtnAction"
+              :accountList="accountList"
               :selectedData="moreModelData" />
               :selectedData="moreModelData" />
     <Cancel @refresh="handleBtnAction"
     <Cancel @refresh="handleBtnAction"
+            :accountList="accountList"
             :selectedData="moreModelData" />
             :selectedData="moreModelData" />
     <Reset @refresh="handleBtnAction"
     <Reset @refresh="handleBtnAction"
+           :accountList="accountList"
            :selectedData="moreModelData" />
            :selectedData="moreModelData" />
     <Detail :selectedData="moreModelData"
     <Detail :selectedData="moreModelData"
+            :accountList="accountList"
             :tableList="tableList" />
             :tableList="tableList" />
 
 
   </div>
   </div>
@@ -89,7 +96,10 @@ import Cancel from '../../compoments/cancel-trader/index.vue';
 import Reset from '../../compoments/reset-trader/index.vue';
 import Reset from '../../compoments/reset-trader/index.vue';
 import Detail from '../../compoments/detail-trader/index.vue';
 import Detail from '../../compoments/detail-trader/index.vue';
 import { handleModalData, handleTableList } from '../setup';
 import { handleModalData, handleTableList } from '../setup';
-import { ErmcpLoginUser, ErmcpLoginUserEx } from '@/services/go/ermcp/account/interface';
+import { ErmcpLoginUser, ErmcpLoginUserEx, ErmcpTaAccount, ErmcpTaAccountEx } from '@/services/go/ermcp/account/interface';
+import { ref } from 'vue';
+import { queryResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
+import { QueryAccMgrTaaccount } from '@/services/go/ermcp/account';
 
 
 export default defineComponent({
 export default defineComponent({
     name: 'account_info_trade',
     name: 'account_info_trade',
@@ -116,8 +126,20 @@ export default defineComponent({
         function handleBtnAction() {
         function handleBtnAction() {
             handleTableList(queryTable, tableList, forDataBtn.value);
             handleTableList(queryTable, tableList, forDataBtn.value);
         }
         }
+        // 授权期货账户
+        const accountList = ref<ErmcpTaAccount[]>([]);
+
         initData(() => {
         initData(() => {
             handleBtnAction();
             handleBtnAction();
+            // 处理授权期货账户
+            queryResultLoadingAndInfo(QueryAccMgrTaaccount, loading).then((res) => {
+                accountList.value.length = 0;
+                res.forEach((el: ErmcpTaAccountEx) => {
+                    const { mainAcc, subacclist } = el;
+                    accountList.value.push(mainAcc);
+                    subacclist.forEach((e) => accountList.value.push(e));
+                });
+            });
         });
         });
         // 查询
         // 查询
         function search(value: any) {}
         function search(value: any) {}
@@ -135,6 +157,7 @@ export default defineComponent({
             moreModelData,
             moreModelData,
             moreOptenAction,
             moreOptenAction,
             handleBtnAction,
             handleBtnAction,
+            accountList,
         };
         };
     },
     },
 });
 });