Browse Source

修改期货子账户

huangbin 4 năm trước cách đây
mục cha
commit
7ed086b9e2

+ 2 - 0
src/common/setup/table/clolumn.ts

@@ -45,6 +45,8 @@ export function getTableColumns() {
             }
             if (columnwidth) {
                 item.width = +columnwidth
+            } else {
+                item.width = 120 // 默认120
             }
             // 以下添加过滤数据对应的方法
             filterKeyList.forEach(el => {

+ 2 - 2
src/views/information/account_info/compoments/add-business/index.vue

@@ -39,7 +39,7 @@
                        name="logincode">
             <a-input class="dialogInput"
                      style="width: 200px"
-                     v-model:value="formState.accountname"
+                     v-model:value="formState.logincode"
                      placeholder="请输入账户名称" />
           </a-form-item>
         </a-col>
@@ -48,7 +48,7 @@
                        name="accountname">
             <a-input class="dialogInput"
                      style="width: 200px"
-                     v-model:value="formState.logincode"
+                     v-model:value="formState.accountname"
                      placeholder="请输入登录账号" />
           </a-form-item>
         </a-col>

+ 1 - 1
src/views/information/account_info/compoments/add-child-futures/setup.ts

@@ -33,7 +33,7 @@ export function handleTradeTemplate() {
     // 手续费
     const feeList = ref<ErmcpTradeConfigTMP[]>([])
     function queryTemplate() {
-        QueryTradeConfigTMP().then(res => {
+        return QueryTradeConfigTMP().then(res => {
             marginList.value.length = 0
             feeList.value.length = 0
             res.forEach(el => {

+ 110 - 64
src/views/information/account_info/compoments/modify-futures-son/index.vue

@@ -21,35 +21,58 @@
         <a-col :span="12">
           <a-form-item label="所属期货账户"
                        name="userinfotype">
-            <span class="white">王小小/824327648</span>
+            <span class="white">{{selectedData.mainAcc.accountname}}/{{selectedData.mainAcc.hedgeaccountcode}}</span>
           </a-form-item>
         </a-col>
         <a-col :span="12">
           <a-form-item label="账户名称"
-                       name="">
+                       name="accountname">
             <a-input class="dialogInput"
+                     v-model:value="formState.accountname"
                      style="width: 200px"
                      placeholder="请输入账户名称" />
           </a-form-item>
         </a-col>
         <a-col :span="12">
           <a-form-item label="期货保证金"
-                       name="">
-            <a-input class="dialogInput"
-                     style="width: 200px"
-                     placeholder="请输入期货保证金" />
+                       name="trademargintmpid">
+            <a-select class="inlineFormSelect"
+                      style="width: 200px"
+                      v-model:value="formState.trademargintmpid"
+                      placeholder="请选择保证金模板">
+              <a-select-option v-for="item in marginList"
+                               :key="item.tradeconfigtmpid"
+                               :value="item.tradeconfigtmpid">
+                {{item.tradeconfigtmpname}}
+              </a-select-option>
+            </a-select>
           </a-form-item>
         </a-col>
         <a-col :span="12">
           <a-form-item label="期货手续费"
-                       name="">
+                       name="tradefeetmpid">
             <a-select class="inlineFormSelect"
                       style="width: 200px"
+                      v-model:value="formState.tradefeetmpid"
                       placeholder="请选择期货手续费">
-              <a-select-option value="权限一">权限一</a-select-option>
+              <a-select-option v-for="item in feeList"
+                               :key="item.tradeconfigtmpid"
+                               :value="item.tradeconfigtmpid">
+                {{item.tradeconfigtmpname}}
+              </a-select-option>
             </a-select>
           </a-form-item>
         </a-col>
+        <a-col :span="24">
+          <a-form-item label="指定交易用户"
+                       name="traderUserId">
+            <a-input class="dialogInput"
+                     style="width: 200px"
+                     readonly
+                     v-model:value="formState.traderUserId"
+                     placeholder="请输入账户名称" />
+          </a-form-item>
+        </a-col>
       </a-row>
     </a-form>
   </a-modal>
@@ -57,10 +80,7 @@
 
 <script lang="ts">
 import { closeModal } from '@/common/setup/modal/index';
-import { initData } from '@/common/methods/index';
-import { defineComponent, ref, reactive, toRaw, UnwrapRef } from 'vue';
-import { AllEnums } from '@/services/go/commonService/interface';
-import { RuleObject, ValidateErrorEntity } from 'ant-design-vue/es/form/interface';
+import { defineComponent, ref, reactive, toRaw, UnwrapRef, watchEffect, PropType } from 'vue';
 import {validateAction} from "@/common/setup/form";
 import {FormState} from "@/views/information/account_info/compoments/add-child-futures/interface";
 import {HedgeOutMainConfigReq} from "@/services/proto/accountinfo/interface";
@@ -68,70 +88,96 @@ import {getLongTypeLoginID} from "@/services/bus/login";
 import {getUserId} from "@/services/bus/account";
 import {requestResultLoadingAndInfo} from "@/common/methods/request/resultInfo";
 import {hedgeOutMainReq} from "@/services/proto/accountinfo";
+import { handleAddOrModifyFuturesForm } from '../setup';
+import { handlerManagerList } from '@/common/setup/user';
+import { handleBusinessForm, handleTradeTemplate } from '../add-child-futures/setup';
+import { ErmcpTaAccount, ErmcpTaAccountEx } from '@/services/go/ermcp/account/interface';
+import { mergeTwoObj } from '@/utils/objHandle';
 
 export default defineComponent({
     name: 'account_info_futures_btn_child_modify',
     components: {},
-    setup(name, context) {
+        props: {
+        selectedData: {
+            default: {},
+            type: Object as PropType<ErmcpTaAccountEx>,
+        },
+        secondeData: {
+            default: {},
+            type: Object as PropType<ErmcpTaAccount>,
+        },
+    },
+    setup(props, context) {
         // 控制关闭弹窗
         const { visible, cancel } = closeModal('account_info_futures_btn_child_modify');
 
         const loading = ref<boolean>(false);
-        // 证件类型
-        // const cardTypeList = ref<AllEnums[]>(getCardType());
-        // // 表单
-        // const formRef = ref();
-        // const formState: UnwrapRef<FormState> = reactive(initFormState());
-        // const rules = {
-        //     userinfotype: [{ required: true, message: '请选择客户类型', trigger: 'change' }],
-        //     customername: [{ required: true, message: '请输入企业名称', trigger: 'blur' }],
-        //     nickname: [{ required: true, message: '请输入企业简称', trigger: 'blur' }],
-        //     cardtype: [{ required: true, message: '请选择证件类型', trigger: 'change' }],
-        // };
-        // // 下单方法
-        // const { loading, applyAction } = handleApply();
-        // function isPersonal(): boolean {
-        //     return formState.userinfotype === '1';
-        // }
+        const { rules, formState, formRef } = handleBusinessForm();
+        // 交易用户
+        const { tableList, queryTable } = handlerManagerList(loading, 2);
+        // 交易模板
+        const { marginList, feeList, queryTemplate } = handleTradeTemplate();
+        watchEffect(() => {
+            if (visible.value) {
+              // 默认第一个 服务只放回一个,这里是个坑
+                queryTable().then(() => {
+                  if(tableList.value.length) {
+                    formState.traderUserId = tableList.value[0].roleid
+                  }
+                });
+                queryTemplate().then(() => {
+                  if(marginList.value.length) {
+                    formState.trademargintmpid = marginList.value[0].tradeconfigtmpid
+                  }
+                  if(feeList.value.length) {
+                    formState.tradefeetmpid = feeList.value[0].tradeconfigtmpid
+                  }
+                });
+                mergeTwoObj(formState, props.secondeData);
+            }
+            
+        });
+
         // 增加accountid 就是修改
-        // function submit() {
-        //     validateAction<FormState>(formRef, formState).then((res) => {
-        //         let reqParam: HedgeOutMainConfigReq = {
-        //             marketid: 15101, // uint64 内部市场ID(HedgeOutMainConfig)
-        //             limitnumber: 0, // uint64 挂单笔数限额默认0(HedgeOutMainConfig)
-        //             status: 1, // int32 渠道账号状态 1-可买入可卖出 2-可卖出不可买入默认1(HedgeOutMainConfig)
-        //             accountname: res.accountname, // string 账户名称accountname1(Taaccount)
-        //             taaccounttype: 1, // int32 账号类型 - 1:外部账号 2:内部账号 3:内部做市自营账号 4:内部做市接单账号(Taaccount)
-        //             currencyid: 1, // int32 货币ID默认为1(Taaccount)
-        //             outthreshold: 0, // double 出金阈值默认为0(Taaccount)
-        //             ismain: 0, // int32 是否母账号 0:不是母账户 1:是母账户(Taaccount)
-        //             parentaccountid: props.selectedData.mainAcc.accountid, // uint64 所属根账号(Taaccount)
-        //             relateduserid: res.traderUserId, // uint64 关联用户(Taaccount)
-        //             fromaccountid: props.selectedData.mainAcc.accountid, // uint64 所属上级账户(Taaccount)
-        //             trademargintmpid: res.trademargintmpid, // uint64 保证金模板id(TAACCOUNTCONFIG)
-        //             tradefeetmpid: res.tradefeetmpid, // uint64 手续费模板ID(TAACCOUNTCONFIG)
-        //             maxsubaccouts: 0, // uint64 最大子账户数[最大99999][外部母账户用 默认0(TAACCOUNTCONFIG)
-        //             creatorid: Number(getLongTypeLoginID()), // uint64 创建人
-        //             modifierid: Number(getLongTypeLoginID()), // uint64 修改人
-        //             areauserid: getUserId(), // uint64 机构用户ID
-        //         };
-        //
-        //         requestResultLoadingAndInfo(hedgeOutMainReq, reqParam, loading, ['新增期货子账户成功', '新增期货子账户失败:']).then(() => {
-        //             cancel();
-        //             context.emit('refresh');
-        //         });
-        //     });
-        // }
+        function submit() {
+            validateAction<FormState>(formRef, formState).then((res) => {
+                // let reqParam: HedgeOutMainConfigReq = {
+                //     marketid: 15101, // uint64 内部市场ID(HedgeOutMainConfig)
+                //     limitnumber: 0, // uint64 挂单笔数限额默认0(HedgeOutMainConfig)
+                //     status: 1, // int32 渠道账号状态 1-可买入可卖出 2-可卖出不可买入默认1(HedgeOutMainConfig)
+                //     accountname: res.accountname, // string 账户名称accountname1(Taaccount)
+                //     taaccounttype: 1, // int32 账号类型 - 1:外部账号 2:内部账号 3:内部做市自营账号 4:内部做市接单账号(Taaccount)
+                //     currencyid: 1, // int32 货币ID默认为1(Taaccount)
+                //     outthreshold: 0, // double 出金阈值默认为0(Taaccount)
+                //     ismain: 0, // int32 是否母账号 0:不是母账户 1:是母账户(Taaccount)
+                //     parentaccountid: props.selectedData.mainAcc.accountid, // uint64 所属根账号(Taaccount)
+                //     relateduserid: res.traderUserId, // uint64 关联用户(Taaccount)
+                //     fromaccountid: props.selectedData.mainAcc.accountid, // uint64 所属上级账户(Taaccount)
+                //     trademargintmpid: res.trademargintmpid, // uint64 保证金模板id(TAACCOUNTCONFIG)
+                //     tradefeetmpid: res.tradefeetmpid, // uint64 手续费模板ID(TAACCOUNTCONFIG)
+                //     maxsubaccouts: 0, // uint64 最大子账户数[最大99999][外部母账户用 默认0(TAACCOUNTCONFIG)
+                //     creatorid: Number(getLongTypeLoginID()), // uint64 创建人
+                //     modifierid: Number(getLongTypeLoginID()), // uint64 修改人
+                //     areauserid: getUserId(), // uint64 机构用户ID
+                // };
+        
+                // requestResultLoadingAndInfo(hedgeOutMainReq, reqParam, loading, ['新增期货子账户成功', '新增期货子账户失败:']).then(() => {
+                //     cancel();
+                //     context.emit('refresh');
+                // });
+            });
+        }
         return {
-            // formState,
-            // rules,
-            // formRef,
-            // cardTypeList,
-            // isPersonal,
+            formState,
+            rules,
+            formRef,
             visible,
             cancel,
-            // submit,
-            // loading,
+            tableList,
+            marginList,
+            feeList,
+            submit,
+            loading,
         };
     },
 });

+ 7 - 6
src/views/information/account_info/list/account_info_futures/index.vue

@@ -63,6 +63,7 @@
     <Modify :selectedData="firstData"
             @refresh="queryTable" />
     <ModifyChild @refresh="queryTable"
+                 :secondeData="secondeData"
                  :selectedData="firstData" />
     <Detail :selectedData="firstData"
             :secondeData="secondeData" />
@@ -177,12 +178,12 @@ export default defineComponent({
         }
     }
     .ant-collapse.busyCollapse {
-      .operBtn.ant-btn {
-        margin-top: 0;
-        margin-bottom: 0;
-        height: 26px;
-        line-height: 26px;
-      }
+        .operBtn.ant-btn {
+            margin-top: 0;
+            margin-bottom: 0;
+            height: 26px;
+            line-height: 26px;
+        }
     }
     .ant-row.headRow {
         .ant-col:nth-child(2) {