index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <!-- 套期交易-套期项目关联-合同关联项目 -->
  3. <a-modal class="commonModal custom-detail" title="关联套期项目" v-model:visible="visible" centered @cancel="cancel(false)"
  4. :maskClosable="false" width="890px">
  5. <a-form class="inlineForm">
  6. <fieldset class="formFieldSet">
  7. <legend>合同信息</legend>
  8. <a-row :gutter="24">
  9. <a-col :span="12">
  10. <a-form-item label="合同编号">
  11. <span class="white">{{ formatValue(selectedRow.contractno) }}</span>
  12. </a-form-item>
  13. </a-col>
  14. <a-col :span="12">
  15. <a-form-item label="定价类型">
  16. <span class="white">{{ getPriceTypeName(selectedRow.pricetype) }}</span>
  17. </a-form-item>
  18. </a-col>
  19. <a-col :span="12">
  20. <a-form-item label="对手方">
  21. <span class="white">{{ formatValue(selectedRow.customername) }}</span>
  22. </a-form-item>
  23. </a-col>
  24. <a-col :span="12">
  25. <a-form-item label="点价合约">
  26. <span class="white">{{ formatValue(selectedRow.goodscode) }}</span>
  27. </a-form-item>
  28. </a-col>
  29. <a-col :span="12">
  30. <a-form-item label="现货商品">
  31. <span class="white">{{ formatValue(selectedRow.wrstandardname) }}</span>
  32. </a-form-item>
  33. </a-col>
  34. <a-col :span="12">
  35. <a-form-item label="套期主体">
  36. <span class="white">{{ formatValue(selectedRow.accountname) }}</span>
  37. </a-form-item>
  38. </a-col>
  39. <a-col :span="12">
  40. <a-form-item label="合同数量">
  41. <span class="white">{{ formatValue(selectedRow.qty) }}</span>
  42. </a-form-item>
  43. </a-col>
  44. </a-row>
  45. </fieldset>
  46. <fieldset class="formFieldSet">
  47. <legend>关联信息</legend>
  48. <a-row :gutter="24">
  49. <a-col :span="12">
  50. <a-form-item label="当前关联数量">
  51. <span class="up-quote-color">{{ currentQty }}</span>
  52. </a-form-item>
  53. </a-col>
  54. </a-row>
  55. <div class="tableDatas">
  56. <a-table class="dialogTable" :columns="columns" :data-source="tableList" :pagination="false"
  57. :loading="loading" :rowKey="(record, index) => index" :row-selection="rowSelection">
  58. <!-- 套期类型 -->
  59. <template #hedgedtype="{ text }">
  60. <span>{{ getHedgedTypeName(text) }}</span>
  61. </template>
  62. <template #relatedqty="{ record, index }">
  63. <a-input-number class="dialogInput" size="small"
  64. :disabled="!selectedRowKeys.includes(index)" :precision="0"
  65. v-model:value="record.relatedqty" style="width:100px" />
  66. </template>
  67. </a-table>
  68. </div>
  69. </fieldset>
  70. </a-form>
  71. <template #footer>
  72. <a-button key="submit" class="cancelBtn" :loading="loading" @click="cancel(false)">取消</a-button>
  73. <a-button key="submit" type="primary" :loading="loading" @click="formSubmit(() => cancel(true))">确定
  74. </a-button>
  75. </template>
  76. </a-modal>
  77. </template>
  78. <script lang="ts">
  79. import { defineComponent, PropType } from 'vue'
  80. import { _closeModal } from '@/common/setup/modal/modal'
  81. import { getPriceTypeName } from '@/@next/constants/enum/priceType'
  82. import { formatValue } from '@/common/methods'
  83. import { UnLinkSpotContractRsp } from '@/services/go/ermcp/hedgedItem/interface'
  84. import { getHedgedTypeName } from '@/@next/constants/enum/hedgedType'
  85. import { useForm } from './form'
  86. export default defineComponent({
  87. emits: ['cancel'],
  88. props: {
  89. selectedRow: {
  90. type: Object as PropType<UnLinkSpotContractRsp>,
  91. required: true
  92. },
  93. },
  94. setup(props, context) {
  95. const { visible, cancel } = _closeModal(context);
  96. const { loading, tableList, columns, currentQty, selectedRowKeys, rowSelection, formSubmit } = useForm(props.selectedRow);
  97. return {
  98. visible,
  99. loading,
  100. tableList,
  101. columns,
  102. selectedRowKeys,
  103. cancel,
  104. formatValue,
  105. currentQty,
  106. getHedgedTypeName,
  107. formSubmit,
  108. rowSelection,
  109. getPriceTypeName,
  110. }
  111. }
  112. })
  113. </script>
  114. <style lang="less">
  115. .custom-detail {
  116. .ant-modal-body {
  117. padding-top: 0;
  118. padding-left: 0;
  119. padding-right: 0;
  120. }
  121. .tableDatas {
  122. margin-top: 26px;
  123. padding: 0;
  124. overflow: hidden;
  125. .dialogTable {
  126. width: 100%;
  127. max-height: 230px;
  128. overflow-x: auto !important;
  129. }
  130. }
  131. .ant-form.inlineForm {
  132. margin-top: 20px;
  133. padding: 0 24px;
  134. }
  135. }
  136. </style>