index.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <!-- 新增计划 -->
  3. <a-modal class="commonModal"
  4. title="新增套保计划"
  5. v-model:visible="visible"
  6. centered
  7. @cancel="cancel"
  8. width="890px">
  9. <template #footer>
  10. <a-button key="submit"
  11. class="cancelBtn"
  12. @click="submit(1)">保存草稿
  13. </a-button>
  14. <a-button key="submit"
  15. type="primary"
  16. :loading="loading"
  17. @click="submit(2)">提交审核</a-button>
  18. </template>
  19. <a-form class="inlineForm"
  20. ref="formRef"
  21. :model="formState"
  22. :rules="rules">
  23. <a-row :gutter="24">
  24. <a-col :span="12">
  25. <a-form-item label="计划类型"
  26. name="ContractType">
  27. <a-select class="inlineFormSelect"
  28. style="width: 200px"
  29. v-model:value="formState.ContractType"
  30. placeholder="请选择计划类型">
  31. <a-select-option v-for="item in planTye"
  32. :value="item.enumitemname"
  33. :key="item.autoid">
  34. {{item.enumdicname}}
  35. </a-select-option>
  36. </a-select>
  37. </a-form-item>
  38. </a-col>
  39. <a-col :span="12">
  40. <a-form-item label="计划名称"
  41. name="HedgePlanNo">
  42. <a-input class="dialogInput"
  43. v-model:value="formState.HedgePlanNo"
  44. style="width: 200px"
  45. placeholder="请输入计划名称" />
  46. </a-form-item>
  47. </a-col>
  48. <a-col :span="12">
  49. <a-form-item label="现货品种"
  50. name="DeliveryGoodsID">
  51. <a-select class="inlineFormSelect"
  52. style="width: 200px"
  53. v-model:value="formState.DeliveryGoodsID"
  54. @change="chooseMG"
  55. placeholder="请选择现货品种">
  56. <a-select-option v-for="item in DGList"
  57. :value="item.data.deliverygoodsid"
  58. :key="item.data.deliverygoodsid">
  59. {{item.data.deliverygoodsname}}
  60. </a-select-option>
  61. </a-select>
  62. </a-form-item>
  63. </a-col>
  64. <a-col :span="12">
  65. <a-form-item label="品类"
  66. name="WRStandardID">
  67. <a-select class="inlineFormSelect"
  68. style="width: 200px"
  69. @change="chooseWR"
  70. v-model:value="formState.WRStandardID"
  71. placeholder="请选择品类">
  72. <a-select-option v-for="item in gmlist"
  73. :value="item.wrstandardid"
  74. :key="item.wrstandardid">
  75. {{item.wrstandardname}}
  76. </a-select-option>
  77. </a-select>
  78. </a-form-item>
  79. </a-col>
  80. <a-col :span="12">
  81. <a-form-item label="标仓系数"
  82. name="">
  83. <a-input class="dialogInput"
  84. v-model:value="formState.ConvertFactor"
  85. readonly
  86. style="width: 200px"
  87. placeholder="请输入标仓系数" />
  88. </a-form-item>
  89. </a-col>
  90. <a-col :span="12">
  91. <a-form-item label="计划量"
  92. class="relative"
  93. name="PlanQty">
  94. <a-input-number class="dialogInput"
  95. style="width: 200px"
  96. v-model:value="formState.PlanQty"
  97. placeholder="请输入计划量"></a-input-number>
  98. </a-form-item>
  99. </a-col>
  100. <a-col :span="12">
  101. <a-form-item label="交易用户"
  102. name="Tradeuserid">
  103. <a-select class="inlineFormSelect"
  104. style="width: 200px"
  105. v-model:value="formState.Tradeuserid"
  106. placeholder="请选择交易用户">
  107. <a-select-option v-for="item in tableList"
  108. :value="item.roleid"
  109. :key="item.roleid">
  110. {{item.rolename}}
  111. </a-select-option>
  112. </a-select>
  113. </a-form-item>
  114. </a-col>
  115. <a-col :span="12">
  116. <a-form-item label="结算币种"
  117. name="Currencyid">
  118. <a-select class="inlineFormSelect"
  119. style="width: 200px"
  120. v-model:value="formState.Currencyid"
  121. placeholder="请选择结算币种">
  122. <a-select-option v-for="item in priceTyep"
  123. :key="item.enumitemname"
  124. :value="item.enumitemname">
  125. {{item.enumdicname}}
  126. </a-select-option>
  127. </a-select>
  128. </a-form-item>
  129. </a-col>
  130. <a-col :span="24">
  131. <a-form-item label="备注"
  132. class="relative"
  133. name="Remark">
  134. <a-input class="dialogInput"
  135. v-model:value="formState.Remark"
  136. style="width: 636px"
  137. placeholder="请输入备注" />
  138. </a-form-item>
  139. </a-col>
  140. </a-row>
  141. </a-form>
  142. </a-modal>
  143. </template>
  144. <script lang="ts">
  145. import { defineComponent, ref } from 'vue';
  146. import { formatTime, initData } from '@/common/methods/index';
  147. import { getPayCurrencyTypeEnumList, getSpotContractTypeEnumList } from '@/common/constants/enumsList';
  148. import { AllEnums } from '@/services/go/commonService/interface';
  149. import { getMiddleGoodsD, handleForm } from '../setup';
  150. import { ErmcpHedgePlanReq } from '@/services/proto/hedgeplan/interface';
  151. import { getLongTypeLoginID } from '@/services/bus/login';
  152. import { LongType } from '@/services/socket/login/interface';
  153. import { hedgePlanReq } from '@/services/proto/hedgeplan';
  154. import { getAreaUserId } from '@/services/bus/user';
  155. import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
  156. import { validateAction } from '@/common/setup/form';
  157. import { FormState } from '../interface';
  158. import { handlerManagerList } from '@/common/setup/user';
  159. import { _closeModal } from '@/common/setup/modal/modal';
  160. export default defineComponent({
  161. name: 'add-custom',
  162. emits: ['cancel'],
  163. setup(props, context) {
  164. const { visible, cancel } = _closeModal(context);
  165. const loading = ref<boolean>(false);
  166. const planTye = ref<AllEnums[]>(getSpotContractTypeEnumList());
  167. // 表单
  168. const { formRef, formState, rules } = handleForm();
  169. // 品种、品类
  170. const { DGList, getDG, gmlist, chooseMG, chooseWR, numberUnit } = getMiddleGoodsD(formState);
  171. // 交易用户
  172. const { tableList, queryTable } = handlerManagerList(loading, 2);
  173. // 币种
  174. const priceTyep = getPayCurrencyTypeEnumList();
  175. function submit(OperateType: 1 | 2) {
  176. validateAction<FormState>(formRef, formState).then((param) => {
  177. const loginId = getLongTypeLoginID() as LongType;
  178. const userid = getAreaUserId();
  179. const reqParam: ErmcpHedgePlanReq = {
  180. HedgePlanNo: param.HedgePlanNo, // 计划类型
  181. ContractType: param.ContractType, // 计划类型
  182. DeliveryGoodsID: Number(param.DeliveryGoodsID),
  183. WRStandardID: Number(param.WRStandardID), // 现货品种
  184. PlanQty: Number(param.PlanQty), // 计划数量
  185. OperateType: OperateType,
  186. Currencyid: param.Currencyid,
  187. ConvertFactor: param.ConvertFactor,
  188. ApplyId: Number(loginId),
  189. PlanTime: formatTime(new Date(), 's'),
  190. ProductType: 1,
  191. Biztype: 1,
  192. AreaUserID: userid,
  193. Remark: param.Remark,
  194. Tradeuserid: param.Tradeuserid, // 交易用户id
  195. };
  196. requestResultLoadingAndInfo(hedgePlanReq, reqParam, loading, OperateType === 1 ? ['保存草稿成功', '保存草稿失败:'] : ['提交申请成功', '提交申请失败:']).then(() => {
  197. cancel(true);
  198. });
  199. });
  200. }
  201. initData(() => {
  202. getDG();
  203. queryTable();
  204. });
  205. return {
  206. visible,
  207. cancel,
  208. submit,
  209. loading,
  210. planTye,
  211. DGList,
  212. gmlist,
  213. chooseMG,
  214. tableList,
  215. priceTyep,
  216. formRef,
  217. formState,
  218. numberUnit,
  219. rules,
  220. chooseWR,
  221. };
  222. },
  223. });
  224. </script>
  225. <style lang="less">
  226. .add-custom {
  227. }
  228. </style
  229. >;