bottom.vue 5.7 KB

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