瀏覽代碼

Merge remote-tracking branch 'origin/master'

yu.jie 4 年之前
父節點
當前提交
1d6fc5486a

+ 29 - 28
src/views/information/account_info/compoments/add-child-futures/index.vue

@@ -76,18 +76,19 @@
                       style="width: 200px"
                       v-model:value="formState.traderUserId"
                       placeholder="请选择交易用户">
-              <a-select-option v-for="item in tableList"
+              <a-select-option v-for="item in userList"
                                :key="item.roleid"
                                :value="item.roleid">
                 {{item.rolename}}
               </a-select-option>
             </a-select>
-            <a-button @click="addTrader" class="operBtn">新增</a-button>
+            <a-button @click="addTrader"
+                      class="operBtn">新增</a-button>
           </a-form-item>
         </a-col>
       </a-row>
     </a-form>
-    <AddTrader @refresh="queryTable" />
+    <AddTrader @refresh="updateTrader" />
   </a-modal>
 </template>
 
@@ -100,11 +101,12 @@ import { validateAction } from '@/common/setup/form';
 import { FormState } from './interface';
 import { handleBusinessForm, handleTradeTemplate } from './setup';
 import { hedgeOutMainReq } from '@/services/proto/accountinfo';
-import { ErmcpTaAccountEx } from '@/services/go/ermcp/account/interface';
+import { ErmcpLoginUserEx, ErmcpTaAccountEx } from '@/services/go/ermcp/account/interface';
 import { handlerManagerList } from '@/common/setup/user';
 import {getLongTypeLoginID} from "@/services/bus/login";
 import {getUserId} from "@/services/bus/account";
 import AddTrader from '../add-traders/index.vue'
+import { ErmcpTradeConfigTMP } from '@/services/go/ermcp/business-review/interface';
 
 export default defineComponent({
     name: 'account_info_futures_btn_add',
@@ -116,6 +118,18 @@ export default defineComponent({
             type: Object as PropType<ErmcpTaAccountEx>,
             default: {},
         },
+        userList: {
+            type: Array as PropType<ErmcpLoginUserEx[]>,
+            default: [],
+        },
+        marginList: {
+            type: Array as PropType<ErmcpTradeConfigTMP[]>,
+            default: [],
+        },
+        feeList: {
+            type: Array as PropType<ErmcpTradeConfigTMP[]>,
+            default: [],
+        },
     },
     setup(props, context) {
         // 控制关闭弹窗
@@ -124,19 +138,9 @@ export default defineComponent({
         const {openAction: addTrader} = openModal('account_info_trade_btn_add') 
         const loading = ref<boolean>(false);
         const { rules, formState, formRef } = handleBusinessForm();
-        // 交易用户
-        const { tableList, queryTable } = handlerManagerList(loading, 2);
-        // 交易模板
-        const { marginList, feeList, queryTemplate } = handleTradeTemplate();
-        watchEffect(() => {
-            if (visible.value) {
-                queryTable();
-                queryTemplate();
-            }
-        });
-        // function addTrader() {
-        //   context.emit('addTrader')
-        // }
+        function updateTrader() {
+          context.emit('updateTrader')
+        }
         function submit() {
             validateAction<FormState>(formRef, formState).then((res) => {
                 let reqParam: HedgeOutMainConfigReq = {
@@ -169,14 +173,11 @@ export default defineComponent({
             formState,
             rules,
             formRef,
-            tableList,
-            marginList,
-            feeList,
             visible,
             cancel,
             submit,
             addTrader,
-            queryTable,
+            updateTrader,
             loading,
         };
     },
@@ -185,14 +186,14 @@ export default defineComponent({
 
 <style lang="less">
 .add-futures-son {
-  .inlineForm {
-    .operBtn {
-          position: absolute;
-          top: -5px;
-          margin-bottom: 0;
-          margin-top: 0;
+    .inlineForm {
+        .operBtn {
+            position: absolute;
+            top: -5px;
+            margin-bottom: 0;
+            margin-top: 0;
+        }
     }
-  }
 }
 </style
 >;

+ 28 - 62
src/views/information/account_info/compoments/detail-futures/index.vue

@@ -12,8 +12,7 @@
                 type="primary"
                 @click="cancel">关闭</a-button>
     </template>
-    <a-form class="inlineForm"
-            :model="formState">
+    <a-form class="inlineForm">
       <a-row :gutter="24">
         <a-col :span="12">
           <a-form-item label="所属期货账户"
@@ -24,56 +23,34 @@
         <a-col :span="12">
           <a-form-item label="账户名称"
                        name="accountname">
-            <a-input class="dialogInput"
-                     readonly
-                     style="width: 200px"
-                     v-model:value="formState.accountname"
-                     placeholder="请输入账户名称" />
+            <span class="white">{{secondeData.accountname}}</span>
           </a-form-item>
         </a-col>
         <a-col :span="12">
           <a-form-item label="期货保证金"
                        name="trademargintmpid">
-            <a-select class="inlineFormSelect"
-                      style="width: 200px"
-                      v-model:value="formState.tradefeetmpid"
-                      placeholder="请选择期货手续费">
-              <a-select-option v-for="item in feeList"
-                               :key="item.tradeconfigtmpid"
-                               :value="item.tradeconfigtmpid">
-                {{item.tradeconfigtmpname}}
-              </a-select-option>
-            </a-select>
+            <span class="white"
+                  v-if="marginList.length">{{marginList[0].tradeconfigtmpname}}</span>
+            <span class="white"
+                  v-else>--</span>
           </a-form-item>
         </a-col>
         <a-col :span="12">
           <a-form-item label="期货手续费"
                        name="tradefeetmpid">
-            <a-select class="inlineFormSelect"
-                      style="width: 200px"
-                      v-model:value="formState.tradefeetmpid"
-                      placeholder="请选择期货手续费">
-              <a-select-option v-for="item in feeList"
-                               :key="item.tradeconfigtmpid"
-                               :value="item.tradeconfigtmpid">
-                {{item.tradeconfigtmpname}}
-              </a-select-option>
-            </a-select>
+            <span class="white"
+                  v-if="feeList.length">{{feeList[0].tradeconfigtmpname}}</span>
+            <span class="white"
+                  v-else>--</span>
           </a-form-item>
         </a-col>
         <a-col :span="24">
           <a-form-item label="指定交易用户"
                        name="traderUserId">
-            <a-select class="inlineFormSelect"
-                      style="width: 200px"
-                      v-model:value="formState.traderUserId"
-                      placeholder="请选择交易用户">
-              <a-select-option v-for="item in tableList"
-                               :key="item.roleid"
-                               :value="item.roleid">
-                {{item.rolename}}
-              </a-select-option>
-            </a-select>
+            <span class="white"
+                  v-if="userList.length">{{userList[0].rolename}}</span>
+            <span class="white"
+                  v-else>--</span>
           </a-form-item>
         </a-col>
       </a-row>
@@ -89,48 +66,37 @@ import { handleBusinessForm } from '../add-child-futures/setup';
 import { ErmcpLoginUser, ErmcpLoginUserEx, ErmcpTaAccount, ErmcpTaAccountEx } from '@/services/go/ermcp/account/interface';
 import { handlerManagerList } from '@/common/setup/user';
 import { handleTradeTemplate } from '../add-child-futures/setup';
+import { ErmcpTradeConfigTMP } from '@/services/go/ermcp/business-review/interface';
 
 export default defineComponent({
     name: 'trader-detail',
     components: {},
-    props: {
+        props: {
         selectedData: {
             type: Object as PropType<ErmcpTaAccountEx>,
             default: {},
         },
-        secondeData: {
-            type: Object as PropType<ErmcpTaAccountEx>,
+                secondeData: {
             default: {},
+            type: Object as PropType<ErmcpTaAccount>,
+        },
+        userList: {
+            type: Array as PropType<ErmcpLoginUserEx[]>,
+            default: [],
+        },
+        marginList: {
+            type: Array as PropType<ErmcpTradeConfigTMP[]>,
+            default: [],
         },
-        accountList: {
+        feeList: {
+            type: Array as PropType<ErmcpTradeConfigTMP[]>,
             default: [],
-            type: Object as PropType<ErmcpTaAccount[]>,
         },
     },
     setup(props) {
         const { visible, cancel } = closeModal('detail');
-        const { formState } = handleBusinessForm();
         const loading = ref<boolean>(false);
-                // 交易用户
-        const { tableList, queryTable } = handlerManagerList(loading, 2);
-        // 交易模板
-        const { marginList, feeList, queryTemplate } = handleTradeTemplate();
-        watchEffect(() => {
-            if (visible.value && props.secondeData) {
-              console.log('selectedData', props.secondeData);
-               queryTable();
-                queryTemplate();
-                mergeTwoObj(formState, props.secondeData);
-                // getRoleName(tableList, selectedData);
-                // formState.logintaaccounts = selectedData.acclist.map((e) => e.accountid);
-                // formState.accountname = props.selectedData.loginname;
-            }
-        });
         return {
-                        formState,
-            tableList,
-            marginList,
-            feeList,
             visible,
             cancel,
             loading,

+ 21 - 2
src/views/information/account_info/list/account_info_futures/index.vue

@@ -59,6 +59,10 @@
     </a-collapse>
     <Add @refresh="queryTable" />
     <AddChild :selectedData="firstData"
+              :userList="userList"
+              :marginList="marginList"
+              :feeList="feeList"
+              @updateTrader="queryUserList"
               @refresh="queryTable" />
     <Modify :selectedData="firstData"
             @refresh="queryTable" />
@@ -66,8 +70,12 @@
                  :secondeData="secondeData"
                  :selectedData="firstData" />
     <Detail :selectedData="firstData"
-            :secondeData="secondeData" />
+            :secondeData="secondeData"
+            :userList="userList"
+            :marginList="marginList"
+            :feeList="feeList" />
     <Cancel @refresh="queryTable"
+            :secondeData="secondeData"
             :selectedData="firstData" />
     <Credit @refresh="queryTable"
             :selectedData="firstData" />
@@ -78,7 +86,7 @@
 import { defineComponent, initData, _getBtnList, contextMenu, BtnList } from '@/common/export/table';
 import filterCustomTable from '@/views/information/goods/components/filterTable/index.vue';
 import { getAccountStatus, handleModalData } from '../setup';
-import { queryTableList } from './setup';
+import { handleTradeTemplate, queryTableList } from './setup';
 import { getUserName } from '@/services/bus/user';
 import Add from '../../compoments/add-futures/index.vue';
 import AddChild from '../../compoments/add-child-futures/index.vue';
@@ -89,6 +97,7 @@ import Cancel from '../../compoments/cancel-futures/index.vue';
 import Credit from '../../compoments/credit-futures/index.vue';
 import { ErmcpTaAccountEx } from '@/services/go/ermcp/account/interface';
 import { ref } from 'vue';
+import { handlerManagerList } from '@/common/setup/user';
 
 export default defineComponent({
     name: 'account_info_futures',
@@ -111,8 +120,14 @@ export default defineComponent({
         const { selectedData: addModelData, openAction } = handleModalData<ErmcpTaAccountEx>();
         // 修改 重置密码、详情等弹窗
         const { selectedData: moreModelData, openAction: moreOptenAction } = handleModalData<ErmcpTaAccountEx>();
+                // 交易用户
+        const { tableList: userList, queryTable: queryUserList } = handlerManagerList(loading, 2);
+        // 交易模板
+        const { marginList, feeList, queryTemplate } = handleTradeTemplate();
         initData(() => {
             queryTable();
+            queryUserList();
+            queryTemplate()
         });
         const firstData = ref<ErmcpTaAccountEx | null>(null)
         const secondeData = ref<ErmcpTaAccountEx | null>(null)
@@ -154,6 +169,10 @@ export default defineComponent({
             firstBtn,
             secondBtn,
             thirdBtn,
+            userList,
+            marginList,
+            feeList,
+            queryUserList,
         };
     },
 });

+ 27 - 0
src/views/information/account_info/list/account_info_futures/setup.ts

@@ -1,6 +1,8 @@
 import { queryResultLoadingAndInfo } from "@/common/methods/request/resultInfo";
 import { QueryAccMgrTaaccount } from "@/services/go/ermcp/account";
 import { ErmcpTaAccountEx } from "@/services/go/ermcp/account/interface";
+import { QueryTradeConfigTMP } from "@/services/go/ermcp/business-review";
+import { ErmcpTradeConfigTMP } from "@/services/go/ermcp/business-review/interface";
 import { ref } from "vue";
 
 export function queryTableList() {
@@ -13,4 +15,29 @@ export function queryTableList() {
             .then(res => tableList.value = res)
     }
     return { loading, tableList, queryTable }
+}
+
+/**
+ * 处理交易模板
+ */
+export function handleTradeTemplate() {
+    // 保证金
+    const marginList = ref<ErmcpTradeConfigTMP[]>([])
+    // 手续费
+    const feeList = ref<ErmcpTradeConfigTMP[]>([])
+    function queryTemplate() {
+        return QueryTradeConfigTMP().then(res => {
+            marginList.value.length = 0
+            feeList.value.length = 0
+            res.forEach(el => {
+                const { tradeconfigtmptype } = el
+                if (tradeconfigtmptype === 1) { // 保证金
+                    marginList.value.push(el)
+                } else if (tradeconfigtmptype === 2) { // 手续费
+                    feeList.value.push(el)
+                }
+            })
+        })
+    }
+    return { marginList, feeList, queryTemplate }
 }