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

+ 35 - 22
src/views/information/spot-contract/components/add/index.vue

@@ -354,9 +354,9 @@
                         style="width: 200px"
                         placeholder="请选择业务员">
                 <a-select-option v-for="item in businesserList"
-                                 :key="item.id"
-                                 :value="item.id">
-                  {{item.name}}
+                                 :key="item.loginid"
+                                 :value="item.loginid">
+                  {{item.accountname}}-{{item.logincode}}
                 </a-select-option>
               </a-select>
             </a-form-item>
@@ -371,9 +371,9 @@
                         style="width: 200px"
                         placeholder="请选择跟单员">
                 <a-select-option v-for="item in merchandiserList"
-                                 :key="item.id"
-                                 :value="item.id">
-                  {{item.name}}
+                                 :key="item.loginid"
+                                 :value="item.loginid">
+                  {{item.accountname}}-{{item.logincode}}
                 </a-select-option>
               </a-select>
             </a-form-item>
@@ -386,9 +386,9 @@
                         v-model:value="formState.TradeUserID"
                         placeholder="请选择期货账户">
                 <a-select-option v-for="item in traderList"
-                                 :key="item.id"
-                                 :value="item.id">
-                  {{item.name}}
+                                 :key="item.roleid"
+                                 :value="item.roleid">
+                  {{item.rolename}}
                 </a-select-option>
               </a-select>
             </a-form-item>
@@ -396,9 +396,11 @@
         </a-row>
         <a-row :gutter="24">
           <a-col :span="24">
-            <a-form-item label="备注">
+            <a-form-item label="备注"
+                         name="Remark">
               <a-input class="dialogInput"
                        style="width: 608px"
+                       v-model:value="formState.Remark"
                        placeholder="请输入备注" />
             </a-form-item>
           </a-col>
@@ -409,7 +411,7 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, PropType, ref, toRaw } from 'vue';
+import { defineComponent, PropType, ref, toRaw, watchEffect } from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
 import { initData } from '@/common/methods';
 import { addContractReq } from './setup';
@@ -420,10 +422,11 @@ import { ValidateErrorEntity } from 'ant-design-vue/lib/form/interface';
 import { FormState } from '../interface';
 import { formatTime } from '@/common/methods/format';
 import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
-import { handleAccountManager } from '../setup';
 import { Moment } from 'moment';
 import { handleFormRule, handleContract, handleDeliveryGoods, handleAmout, handlePrice, handleDate, handleFromState } from '../setup';
 import { validateAction } from '@/common/setup/form';
+import { ErmcpLoginUser } from '@/services/go/ermcp/account/interface';
+import { handlerManagerList } from '@/common/setup/user';
 
 export default defineComponent({
     name: 'add-spot-contract',
@@ -454,11 +457,27 @@ export default defineComponent({
         const { deliveryDate, priceDate, disabledDate } = handleDate();
         // 处理金额
         const { getAmout } = handleAmout(formState);
-        // 账号列表: 交易用户 业务员 跟单员
-        const { traderList, businesserList, merchandiserList, getRoleList, getBusinesserList } = handleAccountManager();
+        // 获取 业务账户
+        const { queryTable: queryBusinessManager, getBusinesserOrMerchandiser } = handlerManagerList(loading, 1);
+        const { tableList: traderList, queryTable: queryTradeManager } = handlerManagerList(loading, 2, true);
+        // 业务员
+        const businesserList = ref<ErmcpLoginUser[]>([]);
+        // 跟单员
+        const merchandiserList = ref<ErmcpLoginUser[]>([]);
         // 现货商品列表
         const goodsList = ref<Goods[]>([]);
-
+        watchEffect(() => {
+            if (visible.value) {
+                queryCustomList();
+                getDeliveryGoods();
+                queryTradeManager();
+                goodsList.value = getGoodsList();
+                queryBusinessManager().then(() => {
+                    businesserList.value = getBusinesserOrMerchandiser('22');
+                    merchandiserList.value = getBusinesserOrMerchandiser('23');
+                });
+            }
+        });
         function submit(OperateType: 1 | 2) {
             validateAction<FormState>(formRef, formState).then((param) => {
                 const id = getUsrId();
@@ -495,13 +514,7 @@ export default defineComponent({
             Object.assign(formState, initFormData());
             cancel();
         }
-        initData(() => {
-            queryCustomList();
-            getDeliveryGoods();
-            goodsList.value = getGoodsList();
-            getRoleList();
-            getBusinesserList();
-        });
+
         return {
             visible,
             closeAction,

+ 6 - 0
src/views/information/spot-contract/components/check/index.vue

@@ -314,6 +314,12 @@ export default defineComponent({
                     merchandiserList.value = getBusinesserOrMerchandiser('23');
                 });
                 queryTradeManager();
+                const { saleuserid, tradeuserid, meruserid, remark } = props.selectedRow;
+
+                saleuserid && (formState.SaleUserID = saleuserid);
+                tradeuserid && (formState.TradeUserID = tradeuserid);
+                meruserid && (formState.MerUserID = meruserid);
+                formState.Remark = remark;
             }
         });
         return {

+ 0 - 1
src/views/information/spot-contract/components/modify/index.vue

@@ -416,7 +416,6 @@ import { ValidateErrorEntity } from 'ant-design-vue/lib/form/interface';
 import { FormState } from '../interface';
 import { formatTime } from '@/common/methods/format';
 import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
-import { handleAccountManager } from '../setup';
 import { Moment } from 'moment';
 import { handleFormRule, handleContract, handleDeliveryGoods, handleAmout, handlePrice, handleDate, handleFromState } from '../setup';
 import { addContractReq } from '@/views/information/spot-contract/components/add/setup';

+ 0 - 69
src/views/information/spot-contract/components/setup.ts

@@ -3,8 +3,6 @@ import { getGoodsUnitEnumItemName } from "@/common/constants/enumsName";
 import { commonResultInfo, getRequestResultInfo } from "@/common/methods/request";
 import { validateCommon } from "@/common/setup/validate";
 import APP from '@/services';
-import { QueryAccMgrLoginUser } from "@/services/go/ermcp/account";
-import { ErmcpLoginUser } from "@/services/go/ermcp/account/interface";
 import { QueryCustomInfo } from "@/services/go/ermcp/customInfo";
 import { QueryCustomInfoType } from "@/services/go/ermcp/customInfo/interface";
 import { QueryDeliveryGoods } from "@/services/go/ermcp/goodsInfo";
@@ -20,7 +18,6 @@ import { RuleObject } from "ant-design-vue/lib/form/interface";
 import Long from 'long';
 import moment, { Moment } from "moment";
 import { reactive, ref, Ref, UnwrapRef } from "vue";
-import { Value } from "./check/interface";
 import { FormState } from './interface';
 
 
@@ -66,72 +63,6 @@ export function orderContractOperateControl(reqs: SpotContractOperateReq, loadin
     return commonResultInfo(result, sign, loading)
 }
 
-/**
- * 处理 /账号列表: 交易用户 业务员 跟单员
- * @returns 
- */
-export function handleAccountManager() {
-    // 交易用户
-    const traderList = ref<Value[]>([])
-    function getRoleList() {
-        QueryAccMgrLoginUser(2).then(res => {
-            const set = new Set<number>([])
-            traderList.value.length = 0;
-            res.forEach(e => {
-                const { roleid, rolename, accountstatus } = e;
-                if (accountstatus === 4) {  // 账户的状态 - 4 正常
-                    if (!set.has(roleid)) { // 去重
-                        set.add(roleid)
-                        traderList.value.push({ id: roleid, name: rolename })
-                    }
-                }
-            })
-        }).catch(err => message.error(err))
-    }
-    // 处理 跟单员 /  业务员 列表
-    function handleList(el: ErmcpLoginUser, type: string, set: Set<number>): Value | null {
-        const { loginstatus, userid, accountname, logincode, roletype } = el;
-        let result = null
-        if (loginstatus === 1) {// 登录账户状态 - 1:正常 
-            if (roletype.includes(type)) {  // 过滤角色类型
-                if (!set.has(userid)) { // 去重
-                    set.add(userid)
-                    result = { id: userid, name: `${accountname}-${logincode}` }
-                }
-            }
-        }
-        return result
-    }
-    // 业务员
-    const businesserList = ref<Value[]>([])
-    // 跟单员
-    const merchandiserList = ref<Value[]>([])
-    function getBusinesserList() {
-        QueryAccMgrLoginUser(1).then(res => {
-            const bSet = new Set<number>([]);
-            const mSet = new Set<number>([]);
-            const list: ErmcpLoginUser[] = []
-            res.forEach(e => {
-                // eslint-disable-next-line prefer-spread
-                list.push.apply(list, e.userlist)
-            })
-            list.forEach(el => {
-                // 业务员
-                const b = handleList(el, '22', bSet)
-                if (b) {
-                    businesserList.value.push(b)
-                }
-                // 跟单员
-                const m = handleList(el, '23', mSet)
-                if (m) {
-                    merchandiserList.value.push(m)
-                }
-            })
-        }).catch(err => message.error(err))
-    }
-    return { traderList, businesserList, merchandiserList, getRoleList, getBusinesserList }
-}
-
 
 /**
  * 新增和修改的表单数据