Explorar o código

新增期货子账户

huangbin %!s(int64=4) %!d(string=hai) anos
pai
achega
adce5eb201

+ 48 - 57
src/views/information/account_info/compoments/add-child-futures/index.vue

@@ -26,30 +26,46 @@
         </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 value="权限一">权限一</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>
           </a-form-item>
         </a-col>
+        <a-col :span="12">
+          <a-form-item label="指定交易用户"
+                       name="traderUserId">
+            <a-select class="inlineFormSelect"
+                      style="width: 200px"
+                      v-model:value="formState.traderUserId"
+                      placeholder="请选择交易用户">
+              <a-select-option value="权限一">权限一</a-select-option>
+            </a-select>
+          </a-form-item>
+        </a-col>
       </a-row>
     </a-form>
   </a-modal>
@@ -57,14 +73,13 @@
 
 <script lang="ts">
 import { closeModal } from '@/common/setup/modal/index';
-import { initData } from '@/common/methods/index';
-import { defineComponent, ref, reactive, toRaw, UnwrapRef, watchEffect } from 'vue';
-import { AllEnums } from '@/services/go/commonService/interface';
-import { RuleObject, ValidateErrorEntity } from 'ant-design-vue/es/form/interface';
+import { defineComponent, ref } from 'vue';
 import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
-import { bizGroupReq, loginAccountOperate } from '@/services/proto/accountinfo';
-import { ErmcpBizGroupReq, ErmcpBizGroupTAAccount } from '@/services/proto/accountinfo/interface';
-import { ErmcpBizGroupSpotGoods } from '@/services/go/ermcp/account/interface';
+import { ErmcpBizGroupReq } from '@/services/proto/accountinfo/interface';
+import { validateAction } from '@/common/setup/form';
+import { FormState } from './interface';
+import { handleBusinessForm } from './setup';
+import { hedgeOutMainReq } from '@/services/proto/accountinfo';
 
 export default defineComponent({
     name: 'account_info_futures_btn_add',
@@ -73,56 +88,32 @@ export default defineComponent({
         // 控制关闭弹窗
         const { visible, cancel } = closeModal('account_info_futures_btn_child_add');
         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();
 
         function submit() {
-            let reqParam: ErmcpBizGroupReq = {
-                // BizGroupID: number; // uint64 分组ID(修改/删除必填)
-                // BizType: number; // int32 业务类型 - 1:套保 2:套利
-                // Remark: string; // string 新增/修改备注
-                // ApplySrc: number; // int32 新增/修改来源 - 1:管理端 2:终端
-                // ApplyId: number; // uint64 新增/修改人
-                // SpotGoods: ErmcpBizGroupSpotGoods[]; // ErmcpBizGroupSpotGoods 期货账户分组商品
-                // TAAccount: ErmcpBizGroupTAAccount[]; // ErmcpBizGroupTAAccount 期货账户分组账户
-                // OptType: number; // int32 操作类型 - 1:新增 2:修改 3:删除
-                // AreaUserID: number; // uint64 所属机构
-            };
+            validateAction<FormState>(formRef, formState).then((res) => {
+                let reqParam: ErmcpBizGroupReq = {
+                    // BizGroupID: number; // uint64 分组ID(修改/删除必填)
+                    // BizType: number; // int32 业务类型 - 1:套保 2:套利
+                    // Remark: string; // string 新增/修改备注
+                    // ApplySrc: number; // int32 新增/修改来源 - 1:管理端 2:终端
+                    // ApplyId: number; // uint64 新增/修改人
+                    // SpotGoods: ErmcpBizGroupSpotGoods[]; // ErmcpBizGroupSpotGoods 期货账户分组商品
+                    // TAAccount: ErmcpBizGroupTAAccount[]; // ErmcpBizGroupTAAccount 期货账户分组账户
+                    // OptType: number; // int32 操作类型 - 1:新增 2:修改 3:删除
+                    // AreaUserID: number; // uint64 所属机构
+                };
 
-            requestResultLoadingAndInfo(bizGroupReq, reqParam, loading, ['新增账户成功', '新增账户失败:']).then(() => {
-                cancel();
-                // context.emit('refresh');
+                requestResultLoadingAndInfo(hedgeOutMainReq, reqParam, loading, ['新增账户成功', '新增账户失败:']).then(() => {
+                    cancel();
+                    // context.emit('refresh');
+                });
             });
-
-            // formRef.value
-            //     .validate()
-            //     .then(() => {
-            //         const param = toRaw(formState);
-            //         applyAction(param);
-            //         console.log('values', formState);
-            //     })
-            //     .catch((error: ValidateErrorEntity<FormState>) => {
-            //         console.log('error', error);
-            //     });
         }
         return {
-            // formState,
-            // rules,
-            // formRef,
+            formState,
+            rules,
+            formRef,
             // cardTypeList,
             // isPersonal,
             visible,

+ 6 - 0
src/views/information/account_info/compoments/add-child-futures/interface.ts

@@ -0,0 +1,6 @@
+export interface FormState {
+    accountname: string; // string 账户名称accountname1(Taaccount)
+    trademargintmpid: number | undefined; // uint64 保证金模板id(TAACCOUNTCONFIG)
+    tradefeetmpid: number | undefined; // uint64 手续费模板ID(TAACCOUNTCONFIG)
+    traderUserId: number | undefined;
+}

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

@@ -0,0 +1,22 @@
+import { reactive, ref, UnwrapRef } from "vue";
+import { FormState } from './interface';
+/**
+ * 表单
+ * @returns 
+ */
+export function handleBusinessForm() {
+    const formRef = ref();
+    const formState: UnwrapRef<FormState> = reactive({
+        accountname: '',
+        trademargintmpid: undefined,
+        tradefeetmpid: undefined,
+        traderUserId: undefined,
+    })
+    const rules = {
+        accountname: [{ required: true, message: '请输入账户名称', trigger: 'blur' }],
+        trademargintmpid: [{ required: true, message: '请选择保证金模板' }],
+        tradefeetmpid: [{ required: true, message: '请选择期货手续费' }],
+        traderUserId: [{ required: true, message: '请选择交易用户' }],
+    }
+    return { rules, formState, formRef }
+}