Browse Source

修改资金账号

huangbin 4 năm trước cách đây
mục cha
commit
de9796eba3
2 tập tin đã thay đổi với 64 bổ sung40 xóa
  1. 59 39
      src/common/components/capitalInfo/index.vue
  2. 5 1
      src/services/bus/account.ts

+ 59 - 39
src/common/components/capitalInfo/index.vue

@@ -1,48 +1,60 @@
 <template>
-    <div class="capital-info">
-        <!-- 资金信息 -->
-        <a-collapse
-            class="capitalCollapse"
-            default-active-key="1"
-            :bordered="false"
-            expand-icon-position="right"
-        >
-            <a-collapse-panel key="1" header="南山铜加工厂(074345345345345345)">
-                <div class="capitalItem">
-                    <div class="firstLine">
-                        <div>净值</div>
-                        <div>
-                            <i class="iconfont icon-zhengyan"></i>
-                        </div>
-                    </div>
-                    <div class="numBar">128,000.00</div>
-                </div>
-                <div class="capitalItem">
-                    <div class="firstLine">
-                        <div>占用</div>
-                    </div>
-                    <div class="numBar green">128,000.00</div>
-                </div>
-                <div class="capitalItem">
-                    <div class="firstLine">
-                        <div>冻结</div>
-                    </div>
-                    <div class="numBar red">128,000.00</div>
-                </div>
-                <div class="capitalItem">
-                    <div class="firstLine">
-                        <div>可用</div>
-                    </div>
-                    <div class="numBar blue">128,000.00</div>
-                </div>
-                <a-icon slot="extra" type="setting" @click="handleClick" />
-            </a-collapse-panel>
-        </a-collapse>
+  <div class="capital-info">
+    <!-- 资金信息 -->
+    <a-select style="width: 135px"
+              @change="accountChange"
+              v-model:value="selectedAccountId">
+      <a-select-option v-for="item in getAllTaAccount()"
+                       :value="item.accountid"
+                       :key="item.accountid">
+        {{item.accountname}}
+      </a-select-option>
+    </a-select>
+    <!-- <a-collapse class="capitalCollapse"
+                default-active-key="1"
+                :bordered="false"
+                expand-icon-position="right">
+      <a-collapse-panel key="1"
+                        header="南山铜加工厂(074345345345345345)"> -->
+    <div class="capitalItem">
+      <div class="firstLine">
+        <div>净值</div>
+        <div>
+          <i class="iconfont icon-zhengyan"></i>
+        </div>
+      </div>
+      <div class="numBar">128,000.00</div>
     </div>
+    <div class="capitalItem">
+      <div class="firstLine">
+        <div>占用</div>
+      </div>
+      <div class="numBar green">128,000.00</div>
+    </div>
+    <div class="capitalItem">
+      <div class="firstLine">
+        <div>冻结</div>
+      </div>
+      <div class="numBar red">128,000.00</div>
+    </div>
+    <div class="capitalItem">
+      <div class="firstLine">
+        <div>可用</div>
+      </div>
+      <div class="numBar blue">128,000.00</div>
+    </div>
+    <!-- <a-icon slot="extra"
+                type="setting"
+                @click="handleClick" />
+      </a-collapse-panel>
+    </a-collapse> -->
+  </div>
 </template>
 
 <script lang="ts">
 import { defineComponent, ref, PropType } from 'vue';
+import { getAllTaAccount, getSelectedAccount, setSelectedAccount } from '@/services/bus/account';
+import { AccountListItem } from '@/services/dataCenter/interafce/account';
 
 interface Key {
     [propName: string]: string;
@@ -67,6 +79,11 @@ export default defineComponent({
     },
     components: {},
     setup(props, context) {
+        const selectedAccountId = ref<number>(getSelectedAccount().accountid);
+        function accountChange(id: number) {
+            const item = getAllTaAccount().find((e) => e.accountid === id) as AccountListItem;
+            setSelectedAccount(item);
+        }
         const current = ref<string[]>(['0']);
         function menuClick(value: any) {
             const index = +value.key;
@@ -75,6 +92,9 @@ export default defineComponent({
         const activeKey = ref<string[]>(['1']);
         const handleClick = handleCollapse();
         return {
+            getAllTaAccount,
+            selectedAccountId,
+            accountChange,
             current,
             menuClick,
             activeKey,

+ 5 - 1
src/services/bus/account.ts

@@ -3,12 +3,16 @@ import { getLoginData } from '@/services/bus/login';
 import { LongType } from '@/services/socket/login/interface/index';
 import { AccountListItem } from '../dataCenter/interafce/account';
 
+export function getAllTaAccount(): AccountListItem[] {
+    return APP.get('accountList')
+}
+
 /**
  * 获取资金账号列表
  * @return string 拼接之后的字符串
  */
 export const getAccoutIdList = (): string => {
-    const accountList = APP.get('accountList');
+    const accountList = getAllTaAccount();
     return accountList.reduce((prev: string, cur: any, i: number) => {
         const id = String(cur.AccountId);
         const temp = i ? `,${id}` : id;