فهرست منبع

新增期货账户

huangbin 4 سال پیش
والد
کامیت
b97a69a01d

+ 1 - 1
src/services/go/ermcp/account/index.ts

@@ -49,7 +49,7 @@ export function QueryAccMgrLoginUser(querytype: number): Promise<ErmcpLoginUserE
  * 查询期货公司(新增期货主账户时候查询的期货公司接口) /Ermcp/QueryFuturesCompany
  * @constructor
  */
-export function QueryFuturesCompany(): Promise<ErmcpFuturesCompany> {
+export function QueryFuturesCompany(): Promise<ErmcpFuturesCompany[]> {
     return commonSearch_go('/Ermcp/QueryFuturesCompany', {}).catch((err) => {
         throw new Error(`查询期货公司: ${err.message}`);
     });

+ 55 - 66
src/views/information/account_info/compoments/add-futures/index.vue

@@ -20,46 +20,49 @@
       <a-row :gutter="24">
         <a-col :span="12">
           <a-form-item label="期货公司"
-                       name="userinfotype">
+                       name="fcid">
             <a-select class="inlineFormSelect"
                       style="width: 200px"
+                      v-model:value="formState.fcid"
                       placeholder="请选择期货公司">
-              <a-select-option value="权限一">权限一</a-select-option>
+              <a-select-option :value="item.fcid"
+                               :key="item.fcid"
+                               v-for="item in companyList">{{item.fcname}}
+              </a-select-option>
             </a-select>
           </a-form-item>
         </a-col>
         <a-col :span="12">
           <a-form-item label="账户名称"
-                       name="">
+                       name="accountname">
             <a-input class="dialogInput"
                      style="width: 200px"
+                     v-model:value="formState.accountname"
                      placeholder="请输入账户名称" />
           </a-form-item>
         </a-col>
         <a-col :span="12">
           <a-form-item label="期货登录账号"
-                       name="">
+                       name="name">
             <a-input class="dialogInput"
                      style="width: 200px"
+                     v-model:value="formState.name"
                      placeholder="请输入期货登录账号" />
           </a-form-item>
         </a-col>
         <a-col :span="12">
           <a-form-item label="登录密码"
-                       name="">
+                       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="指定交易用户"
                        name="">
-            <a-select class="inlineFormSelect"
-                      style="width: 200px"
-                      placeholder="请选择指定交易用户">
-              <a-select-option value="权限一">权限一</a-select-option>
-            </a-select>
+            <span>{{getUserName()}}</span>
           </a-form-item>
         </a-col>
       </a-row>
@@ -69,14 +72,16 @@
 
 <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 { 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 { defineComponent, ref, watchEffect } from 'vue';
+import { queryResultLoadingAndInfo, requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
+import { hedgeOutMainReq } from '@/services/proto/accountinfo';
+import { ErmcpBizGroupReq } from '@/services/proto/accountinfo/interface';
+import { ErmcpFuturesCompany } from '@/services/go/ermcp/account/interface';
+import { QueryFuturesCompany } from '@/services/go/ermcp/account';
+import { getUserName } from '@/services/bus/user';
+import { handleBusinessForm } from './setup';
+import { validateAction } from '@/common/setup/form';
+import { FormState } from './interface';
 
 export default defineComponent({
     name: 'add-custom',
@@ -85,62 +90,46 @@ export default defineComponent({
         // 控制关闭弹窗
         const { visible, cancel } = closeModal('account_info_futures_btn_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 companyList = ref<ErmcpFuturesCompany[]>([]);
+        const { rules, formState, formRef } = handleBusinessForm();
+        watchEffect(() => {
+            if (visible.value) {
+                queryResultLoadingAndInfo(QueryFuturesCompany, loading).then((res) => {
+                    companyList.value = res;
+                });
+            }
+        });
 
         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,
-            // cardTypeList,
-            // isPersonal,
+            formState,
+            rules,
+            formRef,
             visible,
             cancel,
-            // submit,
-            // loading,
+            companyList,
+            getUserName,
+            submit,
+            loading,
         };
     },
 });

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

@@ -0,0 +1,6 @@
+export interface FormState {
+    fcid: number | undefined; // uint64 期货公司
+    accountname: string; // string 账户名称accountname1(Taaccount)
+    name: string;
+    password: string;
+}

+ 22 - 0
src/views/information/account_info/compoments/add-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({
+        name: '',
+        accountname: '',
+        password: '',
+        fcid: undefined,
+    })
+    const rules = {
+        accountname: [{ required: true, message: '请输入账户名称', trigger: 'blur' }],
+        password: [{ required: true, message: '请输入账户密码', trigger: 'blur' }],
+        name: [{ required: true, message: '请输入期货登录账号', trigger: 'blur' }],
+        fcid: [{ required: true, message: '请选择期货公司' }],
+    }
+    return { rules, formState, formRef }
+}