Ver Fonte

修改交易用户

huangbin há 4 anos atrás
pai
commit
7d76b97a2e

+ 1 - 0
src/common/constants/buttonType.ts

@@ -33,6 +33,7 @@ export interface ButtonType {
 
     account_info_trade_btn_add: string; // 交易账户 新增
     account_info_trade_btn_modify: string; // 交易账户 修改
+    account_info_trade_btn_modify_self: string; // 交易账户 修改
     account_info_trade_btn_locked: string; // 交易账户 锁定
     account_info_trade_btn_unlocked: string; // 交易账户 解锁
     account_info_trade_btn_reset: string; // 交易账户 重置密码

+ 207 - 0
src/views/information/account_info/compoments/modify-traders-self/index.vue

@@ -0,0 +1,207 @@
+<template>
+  <!-- 修改交易用户 -->
+  <a-modal class="commonModal add-traders"
+           title="修改交易用户"
+           v-model:visible="visible"
+           @cancel="cancel"
+           centered
+           :maskClosable="false"
+           width="890px">
+    <template #footer>
+      <a-button key="submit"
+                type="primary"
+                :loading="loading"
+                @click="submit">完成</a-button>
+    </template>
+    <a-form class="inlineForm"
+            ref="formRef"
+            :model="formState"
+            :rules="rules">
+      <a-row :gutter="24">
+        <a-col :span="12">
+          <a-form-item label="用户名称"
+                       name="rolename">
+            <a-input class="dialogInput"
+                     style="width: 200px"
+                     v-model:value="formState.rolename"
+                     placeholder="请输入账户名称" />
+          </a-form-item>
+        </a-col>
+        <a-col :span="12">
+          <a-form-item label="手机号码"
+                       name="mobile">
+            <a-input class="dialogInput"
+                     style="width: 200px"
+                     v-model:value="formState.mobile"
+                     placeholder="请输入登录账号" />
+          </a-form-item>
+        </a-col>
+      </a-row>
+    </a-form>
+  </a-modal>
+</template>
+
+<script lang="ts">
+import { closeModal } from '@/common/setup/modal/index';
+import { defineComponent, ref, PropType, watchEffect } from 'vue';
+import { ErmcpLoginUserEx } from '@/services/go/ermcp/account/interface';
+import { LoginaccountOperateReq } from '@/services/proto/accountinfo/interface';
+import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
+import { loginAccountOperate } from '@/services/proto/accountinfo';
+import { handleForm } from './setup';
+import { mergeTwoObj } from '@/utils/objHandle';
+import { validateAction } from '@/common/setup/form';
+import { FormState } from './interface';
+
+export default defineComponent({
+    name: 'account_info_trade_btn_modify_self',
+    props: {
+        selectedData: {
+            type: Object as PropType<ErmcpLoginUserEx>,
+            default: {},
+        },
+    },
+    setup(props, context) {
+        // 控制关闭弹窗
+        const { visible, cancel } = closeModal('account_info_trade_btn_modify_self');
+        const loading = ref<boolean>(false);
+        const { rules, formState, formRef } = handleForm();
+        watchEffect(() => {
+            if (visible.value) {
+                const { selectedData } = props;
+                mergeTwoObj(formState, selectedData);
+                console.log('selectedData', selectedData);
+            }
+        });
+        function submit() {
+            validateAction<FormState>(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 {
+            formState,
+            rules,
+            formRef,
+            visible,
+            cancel,
+            submit,
+            loading,
+        };
+    },
+});
+</script>
+
+<style lang="less">
+.add-business-info {
+}
+.add-traders {
+}
+.add-managers {
+}
+.add-powers {
+    .powerTable {
+        width: 100%;
+        height: 100%;
+        border: 3px solid @m-grey11;
+        background-color: @m-black12;
+        font-size: 14px;
+        color: @m-white0;
+        .flex;
+        flex-direction: column;
+        .ant-checkbox-group.commonCheckboxGroup .ant-checkbox-wrapper {
+            width: 90px;
+            span + span {
+                margin-right: 0;
+            }
+        }
+        .powerRow {
+            width: 100%;
+            display: inline-flex;
+            border-bottom: 3px solid @m-grey11;
+            div {
+                align-self: center;
+                align-items: center;
+            }
+            .powerLeft {
+                width: 84px;
+                padding: 0 8px;
+            }
+            .powerMiddle {
+                width: 130px;
+                .flex;
+                flex-direction: column;
+                div {
+                    width: 100%;
+                    height: 40px;
+                    line-height: 40px;
+                    padding: 0 8px;
+                    border: 3px solid @m-grey11;
+                    border-top: 0;
+                }
+                div:last-child {
+                    border-bottom: 0;
+                }
+            }
+            .powerRight {
+                flex: 1;
+                .flex;
+                flex-direction: column;
+                div {
+                    width: 100%;
+                    height: 40px;
+                    line-height: 40px;
+                    padding: 0 8px;
+                    justify-content: flex-start;
+                    border-bottom: 3px solid @m-grey11;
+                }
+                div:last-child {
+                    border-bottom: 0;
+                }
+            }
+        }
+    }
+}
+.add-futures {
+}
+.add-futures-son {
+}
+.add-arbitrage {
+    .ant-checkbox-group.commonCheckboxGroup .ant-checkbox-wrapper {
+        width: 100px;
+        span + span {
+            margin-right: 0;
+        }
+    }
+    .ant-checkbox-group.autoWidth {
+        width: 520px;
+        .ant-checkbox-wrapper {
+            width: auto;
+        }
+    }
+    .checkboxGroupItem {
+        .ant-row {
+            margin-bottom: 10px;
+        }
+    }
+}
+</style
+>;

+ 4 - 0
src/views/information/account_info/compoments/modify-traders-self/interface.ts

@@ -0,0 +1,4 @@
+export interface FormState {
+    rolename: string; // 角色名称(交易账户->用户名称)
+    mobile: string; // 手机号
+}

+ 19 - 0
src/views/information/account_info/compoments/modify-traders-self/setup.ts

@@ -0,0 +1,19 @@
+import { reactive, ref, UnwrapRef } from "vue";
+import { FormState } from "./interface";
+
+/**
+ * 表单
+ * @returns 
+ */
+export function handleForm() {
+    const formRef = ref();
+    const formState: UnwrapRef<FormState> = reactive({
+        rolename: '',
+        mobile: '',
+    })
+    const rules = {
+        rolename: [{ required: true, message: '请输入用户名称', trigger: 'blur' }],
+        mobile: [{ required: true, message: '请输入手机号码', trigger: 'blur' }],
+    }
+    return { rules, formState, formRef }
+}

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

@@ -31,7 +31,10 @@
       <a-collapse-panel>
         <template #header>
           <a-row class="headRow">
-            <a-col :span="12">{{item.rolename}}({{item.userlist.length}})</a-col>
+            <a-col :span="12">
+              {{item.rolename}}({{item.userlist.length}})
+              <a-button @click.stop="modifySelfClick(item)">修改</a-button>
+            </a-col>
             <a-col :span="12">
               <BtnList :selectedData="item"
                        :btnList="commonBtn"
@@ -83,7 +86,8 @@
     <Detail :selectedData="moreModelData"
             :accountList="accountList"
             :tableList="tableList" />
-
+    <ModifySelf @refresh="handleBtnAction"
+                :selectedData="addModelData" />
   </div>
 </template>
 
@@ -100,11 +104,13 @@ 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 ModifySelf from '../../compoments/modify-traders-self/index.vue';
 import { handleModalData, handleTableList } from '../setup';
 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';
+import { openModal } from '@/common/setup/modal';
 
 export default defineComponent({
     name: 'account_info_trade',
@@ -119,6 +125,7 @@ export default defineComponent({
         Cancel,
         Reset,
         Detail,
+        ModifySelf,
     },
     setup() {
         const { loading, tableList, queryTable } = queryTableList();
@@ -131,6 +138,12 @@ export default defineComponent({
         function handleBtnAction() {
             handleTableList(queryTable, tableList, forDataBtn.value);
         }
+        // 修改交易用户
+        const { openAction: openModifySelf } = openModal('account_info_trade_btn_modify_self');
+        function modifySelfClick(value: ErmcpLoginUserEx) {
+            Object.assign(addModelData, value);
+            openModifySelf();
+        }
         // 授权期货账户
         const accountList = ref<ErmcpTaAccount[]>([]);
 
@@ -163,6 +176,7 @@ export default defineComponent({
             moreOptenAction,
             handleBtnAction,
             accountList,
+            modifySelfClick,
         };
     },
 });