Explorar el Código

交易账号详情

huangbin hace 4 años
padre
commit
2758f35d8b

+ 1 - 1
src/common/setup/form/validateAction.ts

@@ -17,6 +17,6 @@ export function validateAction<T>(formRef: Ref<any>, formState: UnwrapRef<T>): P
         })
         .catch((error: ValidateErrorEntity<T>) => {
             console.error('表单验证错误:', error);
-            Promise.reject(error)
+            throw new Error('表单验证错误:')
         });
 }

+ 7 - 6
src/views/information/account_info/compoments/detail-trader/index.vue

@@ -56,12 +56,15 @@
                        class="checkboxGroupItem"
                        name="logintaaccounts">
             <a-checkbox-group class="commonCheckboxGroup"
-                              v-model:checked="checkedList">
+                              v-model:value="formState.logintaaccounts">
               <a-row>
                 <a-col :span="12"
                        v-for="(item, index) in selectedData.acclist"
                        :key="index">
-                  <a-checkbox :value="item.accountid">{{item.accountname}}/{{item.accountid}}</a-checkbox>
+                  <a-checkbox disabled
+                              :value="item.accountid">
+                    {{item.accountname}}/{{item.accountid}}
+                  </a-checkbox>
                 </a-col>
               </a-row>
             </a-checkbox-group>
@@ -73,7 +76,7 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, PropType, ref, watchEffect } from 'vue';
+import { defineComponent, PropType, watchEffect } from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
 import { mergeTwoObj } from '@/utils/objHandle';
 import { handleBusinessForm, handleRoleName } from '../setup';
@@ -100,13 +103,12 @@ export default defineComponent({
         const { visible, cancel } = closeModal('detail');
         const { formState } = handleBusinessForm();
         const { rolename, getRoleName } = handleRoleName();
-        const checkedList = ref<number[]>([]);
         watchEffect(() => {
             if (visible.value) {
                 const { selectedData, tableList } = props;
                 mergeTwoObj(formState, selectedData);
                 getRoleName(tableList, selectedData);
-                checkedList.value = selectedData.acclist.map((e) => e.accountid);
+                formState.logintaaccounts = selectedData.acclist.map((e) => e.accountid);
             }
         });
         return {
@@ -115,7 +117,6 @@ export default defineComponent({
             formState,
             maskClosableFlag: false,
             rolename,
-            checkedList,
         };
     },
 });

+ 18 - 25
src/views/information/account_info/compoments/modify-business/index.vue

@@ -69,18 +69,18 @@
 
 <script lang="ts">
 import { closeModal } from '@/common/setup/modal/index';
-import { defineComponent, ref, toRaw, watchEffect, PropType } from 'vue';
-import { ValidateErrorEntity } from 'ant-design-vue/es/form/interface';
+import { defineComponent, ref, watchEffect, PropType } from 'vue';
 import { handleBusinessForm } from '../setup';
 import { BusinessFormState } from '../interface';
 import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
 import { loginAccountOperate } from '@/services/proto/accountinfo';
 import { mergeTwoObj } from '@/utils/objHandle';
 import { ErmcpLoginUser } from '@/services/go/ermcp/account/interface';
-import {getUserId} from "@/services/bus/account";
+import { getUserId } from '@/services/bus/account';
+import { validateAction } from '@/common/setup/form';
 
 export default defineComponent({
-    name: 'add-custom',
+    name: 'account_info_business_btn_modify',
     components: {},
     props: {
         selectedData: {
@@ -101,28 +101,21 @@ export default defineComponent({
             }
         });
         function submit() {
-            formRef.value
-                .validate()
-                .then(() => {
-                    const param = toRaw(formState);
-                    const reqParam = {
-                        operatetype: 2,
-                        userid: props.selectedData.userid,
-                        loginid: props.selectedData.loginid,
-                        areauserid: Number(getUserId()),
-                        password: "",
-                        logintaaccounts: []
-                    };
-                    Object.assign(reqParam, param);
-                    console.log('reqParam', reqParam);
-                    requestResultLoadingAndInfo(loginAccountOperate, reqParam, loading, ['修改账户成功', '修改账户失败:']).then(() => {
-                        cancel();
-                        context.emit('refresh');
-                    });
-                })
-                .catch((error: ValidateErrorEntity<BusinessFormState>) => {
-                    console.log('error', error);
+            validateAction<BusinessFormState>(formRef, formState).then((param) => {
+                const reqParam = {
+                    operatetype: 2,
+                    userid: props.selectedData.userid,
+                    loginid: props.selectedData.loginid,
+                    areauserid: Number(getUserId()),
+                    password: '',
+                    logintaaccounts: [],
+                };
+                Object.assign(reqParam, param);
+                requestResultLoadingAndInfo(loginAccountOperate, reqParam, loading, ['修改账户成功', '修改账户失败:']).then(() => {
+                    cancel();
+                    context.emit('refresh');
                 });
+            });
         }
         return {
             formState,

+ 24 - 19
src/views/information/account_info/compoments/modify-traders/index.vue

@@ -90,6 +90,8 @@ import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo
 import { loginAccountOperate } from '@/services/proto/accountinfo';
 import { handleBusinessForm, handleRoleName } from '../setup';
 import { mergeTwoObj } from '@/utils/objHandle';
+import { validateAction } from '@/common/setup/form';
+import { BusinessFormState } from '../interface';
 
 export default defineComponent({
     name: 'account_info_trade_btn_modify',
@@ -118,28 +120,31 @@ export default defineComponent({
                 const { selectedData, tableList } = props;
                 mergeTwoObj(formState, selectedData);
                 getRoleName(tableList, selectedData);
+                formState.logintaaccounts = selectedData.acclist.map((e) => e.accountid);
             }
         });
         function submit() {
-            const reqParam: LoginaccountOperateReq = {
-                operatetype: 13, // uint32 操作类型-1:新增 2:修改 3:新增管理员 4:修改管理员 5:锁定 6:解锁 7:注销 8:恢复 9:重置密码 10:新增登录帐号 11:停用用户 12:恢复用户 13:修改用户信息
-                // logincode: res.logincode, // string 登录账号
-                // accountname: res.accountname, // string 账户名称
-                // password: res.password, // string 登录密码(明文)
-                // mobile: res.mobile, // string 手机号码(明文)
-                // roleids: [props.selectedData.roleid], // uint64 账号角色
-                // loginid = obj.loginid
-                // userid = obj.userid
-                // logintaaccounts: res.logintaaccounts.map(res => {
-                //     const taAccount: LoginTaaccount = {
-                //         accountid: res
-                //     };
-                //     return taAccount
-                // }), // LoginTaaccount 期货账户(勾选交易员必填)
-            };
-            requestResultLoadingAndInfo(loginAccountOperate, reqParam, loading, ['修改交易员成功', '修改交易员失败:']).then(() => {
-                cancel();
-                context.emit('refresh');
+            validateAction<BusinessFormState>(formRef, formState).then((res) => {
+                const reqParam: LoginaccountOperateReq = {
+                    operatetype: 13, // uint32 操作类型-1:新增 2:修改 3:新增管理员 4:修改管理员 5:锁定 6:解锁 7:注销 8:恢复 9:重置密码 10:新增登录帐号 11:停用用户 12:恢复用户 13:修改用户信息
+                    // logincode: res.logincode, // string 登录账号
+                    // accountname: res.accountname, // string 账户名称
+                    // password: res.password, // string 登录密码(明文)
+                    // mobile: res.mobile, // string 手机号码(明文)
+                    // roleids: [props.selectedData.roleid], // uint64 账号角色
+                    // loginid = obj.loginid
+                    // userid = obj.userid
+                    // logintaaccounts: res.logintaaccounts.map(res => {
+                    //     const taAccount: LoginTaaccount = {
+                    //         accountid: res
+                    //     };
+                    //     return taAccount
+                    // }), // LoginTaaccount 期货账户(勾选交易员必填)
+                };
+                requestResultLoadingAndInfo(loginAccountOperate, reqParam, loading, ['修改交易员成功', '修改交易员失败:']).then(() => {
+                    cancel();
+                    context.emit('refresh');
+                });
             });
         }
         return {