index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <!-- 套期交易-期货成交关联-补单关联 -->
  3. <a-modal class="commonModal custom-detail" title="补单关联" v-model:visible="visible" centered @cancel="cancel(false)"
  4. :maskClosable="false" width="980px">
  5. <a-form class="inlineForm" ref="formElement" :model="formData" :rules="rules">
  6. <fieldset class="formFieldSet">
  7. <legend>成交单信息</legend>
  8. <a-row :gutter="24">
  9. <a-col :span="12">
  10. <a-form-item label="期货合约" name="GoodsID">
  11. <a-select class="inlineFormSelect" placeholder="请选择合约" :filterOption="filterOption"
  12. v-model:value="formData.GoodsID" show-search style="width:200px">
  13. <a-select-option v-for="item in goodsList" :value="item.goodsid" :key="item.goodsid">{{
  14. item.goodsname
  15. }}</a-select-option>
  16. </a-select>
  17. </a-form-item>
  18. </a-col>
  19. <a-col :span="12">
  20. <a-form-item label="方向" name="BuyOrSell">
  21. <a-select class="inlineFormSelect" placeholder="请选择方向" v-model:value="formData.BuyOrSell"
  22. style="width:200px">
  23. <a-select-option :value="BuyOrSell.buy">买</a-select-option>
  24. <a-select-option :value="BuyOrSell.sell">卖</a-select-option>
  25. </a-select>
  26. </a-form-item>
  27. </a-col>
  28. <a-col :span="12">
  29. <a-form-item label="期货子账户" name="AccountID">
  30. <a-select class="inlineFormSelect" placeholder="请选择账户" v-model:value="formData.AccountID"
  31. @change="changeGoods" style="width:200px">
  32. <a-select-option v-for="item in accountList" :value="item.accountid"
  33. :key="item.accountid">
  34. {{ item.accountid }}/{{ item.accountname }}</a-select-option>
  35. </a-select>
  36. </a-form-item>
  37. </a-col>
  38. <a-col :span="12">
  39. <a-form-item label="建平" name="ChannelBuildType">
  40. <a-select class="inlineFormSelect" placeholder="请选择下单类型"
  41. v-model:value="formData.ChannelBuildType" style="width:200px">
  42. <a-select-option :value="BuildType.open">建仓</a-select-option>
  43. <a-select-option :value="BuildType.close">平仓</a-select-option>
  44. </a-select>
  45. </a-form-item>
  46. </a-col>
  47. <a-col :span="12">
  48. <a-form-item label="成交价" name="TradePrice">
  49. <a-input-number class="dialogInput" placeholder="请输入价格" v-model:value="formData.TradePrice"
  50. style="width:200px" />
  51. </a-form-item>
  52. </a-col>
  53. <a-col :span="12">
  54. <a-form-item label="成交数量" name="TradeQty">
  55. <span class="white">
  56. <a-input-number class="dialogInput" placeholder="请输入数量" :precision="0"
  57. v-model:value="formData.TradeQty" style="width:200px" />
  58. </span>
  59. </a-form-item>
  60. </a-col>
  61. </a-row>
  62. </fieldset>
  63. <fieldset class="formFieldSet">
  64. <legend>关联信息</legend>
  65. <div class="tableDatas">
  66. <a-table class="dialogTable" :columns="columns" :data-source="tableList" :pagination="false"
  67. :loading="loading" :rowKey="(record, index) => index" :row-selection="rowSelection">
  68. <template #wrstandardname="{ record }">
  69. <span>{{ record.deliverygoodsname }}/{{ record.wrstandardname }}</span>
  70. </template>
  71. <template #unexehedgeqty="{ text }">
  72. <span>{{ getDecimalsNum(text) }}</span>
  73. </template>
  74. </a-table>
  75. </div>
  76. </fieldset>
  77. </a-form>
  78. <template #footer>
  79. <a-button key="submit" class="cancelBtn" :loading="loading" @click="cancel(false)">取消</a-button>
  80. <a-button key="submit" type="primary" :loading="loading" @click="formSubmit(() => cancel(true))">确定
  81. </a-button>
  82. </template>
  83. </a-modal>
  84. </template>
  85. <script lang="ts">
  86. import { defineComponent, PropType } from 'vue'
  87. import { _closeModal } from '@/common/setup/modal/modal'
  88. import { formatValue } from '@/common/methods'
  89. import { getChannelBuildName, getBuyOrSellName } from '@/common/constants/enumsName'
  90. import { InternalUncorrelatedTradeDetailRsp } from '@/services/go/ermcp/hedgedItem/interface'
  91. import { useForm } from './form'
  92. import { BuildType, BuyOrSell } from '@/common/constants/enumCommon'
  93. import { getDecimalsNum } from '@/utils/number'
  94. export default defineComponent({
  95. emits: ['cancel'],
  96. props: {
  97. selectedRow: {
  98. type: Object as PropType<InternalUncorrelatedTradeDetailRsp>,
  99. required: true
  100. },
  101. },
  102. setup(props, context) {
  103. const { visible, cancel } = _closeModal(context);
  104. const { formData, rules, formElement, loading, tableList, accountList, goodsList, columns, selectedRowKeys, rowSelection, changeGoods, formSubmit } = useForm();
  105. // 搜索商品合约
  106. function filterOption(input: string, option: any) {
  107. return option.children[0].children.includes(input);
  108. }
  109. return {
  110. visible,
  111. loading,
  112. tableList,
  113. rules,
  114. columns,
  115. cancel,
  116. formatValue,
  117. goodsList,
  118. accountList,
  119. formData,
  120. selectedRowKeys,
  121. rowSelection,
  122. formElement,
  123. BuildType,
  124. BuyOrSell,
  125. formSubmit,
  126. filterOption,
  127. changeGoods,
  128. getDecimalsNum,
  129. getBuyOrSellName,
  130. getChannelBuildName,
  131. }
  132. }
  133. })
  134. </script>
  135. <style lang="less">
  136. .custom-detail {
  137. .ant-modal-body {
  138. padding-top: 0;
  139. padding-left: 0;
  140. padding-right: 0;
  141. }
  142. .tableDatas {
  143. margin-top: 26px;
  144. padding: 0;
  145. overflow: hidden;
  146. .dialogTable {
  147. width: 100%;
  148. max-height: 230px;
  149. overflow-x: auto !important;
  150. }
  151. }
  152. .ant-form.inlineForm {
  153. margin-top: 20px;
  154. padding: 0 24px;
  155. }
  156. }
  157. </style>