index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <!-- 修改套保品种 -->
  3. <a-modal class="commonModal fieldsetForm modify-custom"
  4. title="修改套保品种"
  5. v-if="visible"
  6. v-model:visible="visible"
  7. :loading="loading"
  8. centered
  9. :maskClosable="maskClosableFlag"
  10. @cancel="cancel"
  11. width="890px">
  12. <template #footer>
  13. <a-button key="submit"
  14. type="primary"
  15. :loading="loading"
  16. @click="submit">完成</a-button>
  17. </template>
  18. <a-spin :spinning="loading">
  19. <a-form class="inlineForm"
  20. ref="formRef"
  21. :model="formState"
  22. :rules="rules">
  23. <fieldset class="formFieldSet">
  24. <legend>基本信息</legend>
  25. <a-row :gutter="24">
  26. <a-col :span="12">
  27. <a-form-item label="套保品种名称">
  28. <span class="white">{{selctedMG.mg.middlegoodsname}}</span>
  29. </a-form-item>
  30. </a-col>
  31. <a-col :span="12">
  32. <a-form-item label="单位">
  33. <span class="white">{{getGoodsUnitEnumItemName(selctedMG.mg.goodsunitid)}}</span>
  34. </a-form-item>
  35. </a-col>
  36. <a-col :span="12">
  37. <a-form-item label="当前套保比例">
  38. <span class="white">{{(selctedMG.mg.needhedgeratio * 100).toFixed(2)}}%</span>
  39. </a-form-item>
  40. </a-col>
  41. <a-col :span="12">
  42. <a-form-item label="修改后套保比例"
  43. name="needhedgeratio"
  44. class="relative">
  45. <a-input-number class="dialogInput"
  46. style="width: 200px"
  47. type="number"
  48. placeholder="请输入套保比例"
  49. v-model:value="formState.needhedgeratio" />
  50. <div class="backUnit">%</div>
  51. </a-form-item>
  52. </a-col>
  53. </a-row>
  54. </fieldset>
  55. <fieldset class="formFieldSet">
  56. <legend>其他信息</legend>
  57. <a-row :gutter="24">
  58. <a-col :span="24">
  59. <a-form-item label="备注">
  60. <span class="white">{{selctedMG.mg.remark}}</span>
  61. </a-form-item>
  62. </a-col>
  63. </a-row>
  64. </fieldset>
  65. </a-form>
  66. </a-spin>
  67. </a-modal>
  68. </template>
  69. <script lang="ts">
  70. import { defineComponent, PropType, ref } from 'vue';
  71. import { closeModal } from '@/common/setup/modal/index';
  72. import { initData } from '@/common/methods/index';
  73. import { initMG } from '../../list/hedging-variety/setup';
  74. import { Ermcp3MiddleGoodsDetail2 } from '@/services/go/ermcp/goodsInfo/interface';
  75. import { getGoodsUnitEnumItemName } from '@/common/constants/enumsName';
  76. import { handleForm } from './setup';
  77. import { ermsMiddelGoodsEdit } from '@/services/proto/delivery';
  78. import { ErmsMiddelGoodsEditReq } from '@/services/proto/delivery/interface';
  79. import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
  80. import { validateAction } from '@/common/setup/form';
  81. import { FormState } from './interface';
  82. export default defineComponent({
  83. name: 'modify-custom',
  84. components: {},
  85. props: {
  86. selctedMG: {
  87. default: initMG,
  88. type: Object as PropType<Ermcp3MiddleGoodsDetail2>,
  89. },
  90. },
  91. setup(props, context) {
  92. const { visible, cancel } = closeModal('goods_info_hedge_normal_modify');
  93. const { rules, formState, formRef } = handleForm();
  94. const loading = ref<boolean>(false);
  95. function submit() {
  96. validateAction<FormState>(formRef, formState).then(() => {
  97. const { middlegoodsid, goodsunitid, relatedgoodsid, evaluateratio, qtydecimalplace, relatedgoodstype, goodsgroupid, remark } = props.selctedMG.mg;
  98. const param: ErmsMiddelGoodsEditReq = {
  99. middlegoodsid, // uint64 套保品种ID
  100. goodsunitid, // int32 单位ID
  101. relatedgoodsid, // uint64 关联交易商品ID
  102. evaluateratio, // double 估价系数
  103. qtydecimalplace, // int32 数量小数位
  104. // modifierid,// uint64 修改人
  105. relatedgoodstype, // int32 关联商品类型 - 1:期货合约 2:现货品种
  106. needhedgeratio: (formState.needhedgeratio as number) / 100, // double 套保比率
  107. // areauserid?,// uint64 机构用户ID
  108. goodsgroupid, // uint64 关联期货品种ID
  109. remark, // string 备注
  110. };
  111. requestResultLoadingAndInfo(ermsMiddelGoodsEdit, param, loading, ['修改成功', '修改失败:']).then(() => {
  112. cancel();
  113. context.emit('refresh');
  114. });
  115. });
  116. }
  117. initData(() => {});
  118. return {
  119. visible,
  120. cancel,
  121. submit,
  122. loading,
  123. maskClosableFlag: false,
  124. getGoodsUnitEnumItemName,
  125. rules,
  126. formState,
  127. formRef,
  128. };
  129. },
  130. });
  131. </script>
  132. <style lang="less">
  133. .modify-custom {
  134. .upload {
  135. display: inline-flex;
  136. .ant-btn.uploadBtn {
  137. width: 60px;
  138. height: 30px;
  139. background: @m-blue0;
  140. border: 0;
  141. padding: 0;
  142. text-align: center;
  143. font-size: 14px;
  144. color: @m-white0;
  145. .rounded-corners(3px);
  146. &:hover {
  147. background: rgba(@m-blue0, 0);
  148. color: rgba(@m-white0, 0.8);
  149. }
  150. }
  151. .look {
  152. color: @m-blue0;
  153. font-size: 14px;
  154. margin-left: 10px;
  155. cursor: pointer;
  156. }
  157. }
  158. }
  159. </style
  160. >;