bottom.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <section
  3. :class="['layout-bottom', isShowBottom ? 'layout-bottom-all' : 'layout-bottom-hidden']"
  4. >
  5. <CapitalInfo class="capital-info-container" v-if="isCapitalLeft"></CapitalInfo>
  6. <main :class="[isCapitalLeft ? 'main-some' : 'main-all']">
  7. <firstMenu :list="orderList" :value="'title'" @selectMenu="selectMenu">
  8. <div class="right-menu-content">
  9. <!-- 资金信息 -->
  10. <a-select
  11. class="capitalSelect"
  12. style="width: 180px"
  13. v-if="!isCapitalLeft"
  14. @change="accountChange"
  15. v-model:value="selectedAccountId"
  16. >
  17. <a-select-option
  18. v-for="item in getAllTaAccount()"
  19. :value="item.accountid"
  20. :key="item.accountid"
  21. >{{item.accountid}}</a-select-option>
  22. </a-select>
  23. <div class="conditionIcon icon iconfont icon-shouqi" @click="handleShowBottom"></div>
  24. </div>
  25. </firstMenu>
  26. <div v-show="isShowBottom">
  27. <component :is="componentId" v-if="componentId"></component>
  28. </div>
  29. </main>
  30. </section>
  31. </template>
  32. <script lang="ts">
  33. import { defineAsyncComponent, defineComponent, reactive, ref } from 'vue';
  34. import CapitalInfo from '@/common/components/capitalInfo/index.vue';
  35. import firstMenu from '@/common/components/firstMenu/index.vue';
  36. import thirdMenu from '@/common/components/thirdMenu/index.vue';
  37. import quoteTable from '@/common/components/quoteTable/index.vue';
  38. import { OperationTabMenu } from '@/services/go/commonService/interface';
  39. import { handleOrderData } from '@/common/setup/order/orderData';
  40. import { enumOrderComponents } from '@/common/constants/enumOrderComponents';
  41. import { handleShowBottom, getShowBottomValue } from '@/common/config/constrolBottom';
  42. import { getAllTaAccount, getCanUseMoney, getFreeze, getSelectedAccount, setSelectedAccount } from '@/services/bus/account';
  43. import { AccountListItem } from '@/services/dataCenter/interafce/account';
  44. import { getTaAccount } from '@/services/go/TaAccount';
  45. import Bus from '@/utils/eventBus/index';
  46. import { isOemByEnum, OemType } from '@/common/config/projectName';
  47. import { initData } from '@/common/methods';
  48. export default defineComponent({
  49. name: 'layout-top',
  50. components: {
  51. CapitalInfo,
  52. firstMenu,
  53. quoteTable,
  54. thirdMenu,
  55. [enumOrderComponents.spot_warrant]: defineAsyncComponent(() => import('@/views/order/spot_warran/index.vue')),
  56. [enumOrderComponents.funding_information]: defineAsyncComponent(() => import('@/views/order/funding_information/index.vue')),
  57. [enumOrderComponents.performance_information]: defineAsyncComponent(() => import('@/views/order/performance_information/index.vue')),
  58. [enumOrderComponents.pre_sale_warehouse_receipt]: defineAsyncComponent(() => import('@/views/order/pre_sale_warehouse_receipt/index.vue')),
  59. [enumOrderComponents.financing_manager]: defineAsyncComponent(() => import('@/views/order/financing_manager/index.vue')),
  60. [enumOrderComponents.commodity_contract]: defineAsyncComponent(() => import('@/views/order/commodity_contract/index.vue')),
  61. },
  62. setup() {
  63. const { orderList, componentId } = handleOrderData();
  64. const selectedAccount = getSelectedAccount();
  65. const selectedAccountId = ref<number>(selectedAccount.accountid);
  66. function accountChange(id: number) {
  67. const item = getAllTaAccount().find((e) => e.accountid === id) as AccountListItem;
  68. setSelectedAccount(item);
  69. }
  70. // 资金变化,重新加载数据
  71. Bus.$on('moneyChangedNtf_UI', () => {
  72. getTaAccount().then(() => {
  73. accountChange(selectedAccountId.value);
  74. });
  75. });
  76. // 控制资金面板是否显示在左边
  77. const isCapitalLeft = ref<boolean>(true);
  78. initData(() => {
  79. if (isOemByEnum(OemType.wrspot)) {
  80. isCapitalLeft.value = false;
  81. }
  82. });
  83. // 切换组件
  84. function selectMenu(value: OperationTabMenu) {
  85. componentId.value = value.code as enumOrderComponents;
  86. }
  87. return {
  88. selectMenu,
  89. componentId,
  90. orderList,
  91. isShowBottom: getShowBottomValue(),
  92. getShowBottomValue,
  93. handleShowBottom,
  94. getAllTaAccount,
  95. selectedAccountId,
  96. accountChange,
  97. isCapitalLeft,
  98. };
  99. },
  100. });
  101. </script>
  102. <style lang="less">
  103. .right-menu-content {
  104. display: flex;
  105. .capitalSelect {
  106. margin-top: 2px;
  107. margin-right: 10px;
  108. .ant-select-selector {
  109. background-color: @m-grey6;
  110. border: none;
  111. height: 28px;
  112. }
  113. .ant-select-arrow {
  114. top: 15px;
  115. }
  116. }
  117. }
  118. .layout-bottom-all {
  119. height: 280px;
  120. }
  121. .layout-bottom-hidden {
  122. height: 40px;
  123. }
  124. .main-all {
  125. max-width: 100;
  126. }
  127. .main-some {
  128. max-width: calc(100% - 160px);
  129. }
  130. .layout-bottom {
  131. display: flex;
  132. width: 100%;
  133. transition: height 0.5s;
  134. overflow: hidden;
  135. .capital-info-container {
  136. width: 180px;
  137. border-right: 1px solid @m-black2;
  138. }
  139. main {
  140. max-width: 100%;
  141. flex: 1;
  142. .flex;
  143. flex-direction: column;
  144. background: @m-black36;
  145. position: relative;
  146. .conditionIcon {
  147. font-size: 16px;
  148. color: @m-grey1;
  149. width: 16px;
  150. cursor: pointer;
  151. height: 40px;
  152. line-height: 40px;
  153. margin-right: 10px;
  154. &:hover {
  155. color: @m-grey1-hover;
  156. }
  157. }
  158. }
  159. }
  160. </style>