index.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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. :min="0"
  97. max="99999999999"
  98. v-model:value="formState.PlanQty"
  99. placeholder="请输入计划量"></a-input-number>
  100. </a-form-item>
  101. </a-col>
  102. <a-col :span="12">
  103. <a-form-item label="交易用户"
  104. name="Tradeuserid">
  105. <a-select class="inlineFormSelect"
  106. style="width: 200px"
  107. v-model:value="formState.Tradeuserid"
  108. placeholder="请选择交易用户">
  109. <a-select-option v-for="item in tableList"
  110. :value="item.roleid"
  111. :key="item.roleid">
  112. {{item.rolename}}
  113. </a-select-option>
  114. </a-select>
  115. </a-form-item>
  116. </a-col>
  117. <a-col :span="12">
  118. <a-form-item label="结算币种"
  119. name="Currencyid">
  120. <a-select class="inlineFormSelect"
  121. style="width: 200px"
  122. v-model:value="formState.Currencyid"
  123. placeholder="请选择结算币种">
  124. <a-select-option v-for="item in priceTyep"
  125. :key="item.enumitemname"
  126. :value="item.enumitemname">
  127. {{item.enumdicname}}
  128. </a-select-option>
  129. </a-select>
  130. </a-form-item>
  131. </a-col>
  132. <a-col :span="24">
  133. <a-form-item label="备注"
  134. class="relative"
  135. name="Remark">
  136. <a-input class="dialogInput"
  137. v-model:value="formState.Remark"
  138. style="width: 636px"
  139. placeholder="请输入备注" />
  140. </a-form-item>
  141. </a-col>
  142. </a-row>
  143. </a-form>
  144. </a-modal>
  145. </template>
  146. <script lang="ts">
  147. import { defineComponent, ref } from 'vue';
  148. import { formatTime, initData } from '@/common/methods/index';
  149. import { getPayCurrencyTypeEnumList, getSpotContractTypeEnumList } from '@/common/constants/enumsList';
  150. import { AllEnums } from '@/services/go/commonService/interface';
  151. import { getMiddleGoodsD, handleForm } from '../setup';
  152. import { ErmcpHedgePlanReq } from '@/services/proto/hedgeplan/interface';
  153. import { geLoginID_number } from '@/services/bus/login';
  154. import { LongType } from '@/services/socket/login/interface';
  155. import { hedgePlanReq } from '@/services/proto/hedgeplan';
  156. import { getAreaUserId } from '@/services/bus/user';
  157. import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
  158. import { validateAction } from '@/common/setup/form';
  159. import { FormState } from '../interface';
  160. import { handlerManagerList } from '@/common/setup/user';
  161. import { _closeModal } from '@/common/setup/modal/modal';
  162. export default defineComponent({
  163. name: 'add-custom',
  164. emits: ['cancel', 'update'],
  165. setup(props, context) {
  166. const { visible, cancel } = _closeModal(context);
  167. const loading = ref<boolean>(false);
  168. const planTye = ref<AllEnums[]>(getSpotContractTypeEnumList());
  169. // 表单
  170. const { formRef, formState, rules } = handleForm();
  171. // 品种、品类
  172. const { DGList, getDG, gmlist, chooseMG, chooseWR, numberUnit } = getMiddleGoodsD(formState);
  173. // 交易用户
  174. const { tableList, queryTable } = handlerManagerList(loading, 2);
  175. // 币种
  176. const priceTyep = getPayCurrencyTypeEnumList();
  177. function submit(OperateType: 1 | 2) {
  178. validateAction<FormState>(formRef, formState).then((param) => {
  179. const loginId = geLoginID_number();
  180. const userid = getAreaUserId();
  181. const reqParam: ErmcpHedgePlanReq = {
  182. HedgePlanNo: param.HedgePlanNo, // 计划类型
  183. ContractType: param.ContractType, // 计划类型
  184. DeliveryGoodsID: Number(param.DeliveryGoodsID),
  185. WRStandardID: Number(param.WRStandardID), // 现货品种
  186. PlanQty: Number(param.PlanQty), // 计划数量
  187. OperateType: OperateType,
  188. Currencyid: param.Currencyid,
  189. ApplyId: Number(loginId),
  190. PlanTime: formatTime(new Date(), 's'),
  191. ProductType: 1,
  192. Biztype: 1,
  193. AreaUserID: userid,
  194. Remark: param.Remark,
  195. };
  196. if (param.ConvertFactor) reqParam.ConvertFactor = param.ConvertFactor;
  197. if (param.Tradeuserid) reqParam.Tradeuserid = param.Tradeuserid;
  198. requestResultLoadingAndInfo(hedgePlanReq, reqParam, loading, OperateType === 1 ? ['保存草稿成功', '保存草稿失败:'] : ['提交申请成功', '提交申请失败:']).then(() => {
  199. cancel(true);
  200. });
  201. });
  202. }
  203. initData(() => {
  204. getDG();
  205. queryTable();
  206. });
  207. return {
  208. visible,
  209. cancel,
  210. submit,
  211. loading,
  212. planTye,
  213. DGList,
  214. gmlist,
  215. chooseMG,
  216. tableList,
  217. priceTyep,
  218. formRef,
  219. formState,
  220. numberUnit,
  221. rules,
  222. chooseWR,
  223. };
  224. },
  225. });
  226. </script>
  227. <style lang="less">
  228. .add-custom {
  229. }
  230. </style
  231. >;