bottom.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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: 3px;
  107. margin-right: 10px;
  108. .ant-select-selector {
  109. background-color: @m-grey6;
  110. border: none;
  111. }
  112. .ant-select-arrow {
  113. top: 15px;
  114. }
  115. }
  116. }
  117. .layout-bottom-all {
  118. height: 330px;
  119. }
  120. .layout-bottom-hidden {
  121. height: 40px;
  122. }
  123. .main-all {
  124. max-width: 100;
  125. }
  126. .main-some {
  127. max-width: calc(100% - 180px);
  128. }
  129. .layout-bottom {
  130. display: flex;
  131. width: 100%;
  132. transition: height 0.5s;
  133. overflow: hidden;
  134. .capital-info-container {
  135. width: 180px;
  136. border-right: 1px solid @m-black2;
  137. }
  138. main {
  139. max-width: 100%;
  140. flex: 1;
  141. .flex;
  142. flex-direction: column;
  143. background: @m-black1;
  144. position: relative;
  145. .conditionIcon {
  146. font-size: 16px;
  147. color: @m-grey1;
  148. width: 16px;
  149. cursor: pointer;
  150. height: 40px;
  151. line-height: 40px;
  152. margin-right: 10px;
  153. &:hover {
  154. color: @m-grey1-hover;
  155. }
  156. }
  157. }
  158. }
  159. </style>