index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <!-- 出入库登记-->
  3. <a-modal class="commonModal add-spot-contract"
  4. :title="`出入库登记(生产${inOrOut()})`"
  5. v-model:visible="visible"
  6. centered
  7. :maskClosable="false"
  8. @cancel="closeAction"
  9. width="890px">
  10. <template #footer>
  11. <a-button key="submit"
  12. class="cancelBtn"
  13. @click="closeAction">取消</a-button>
  14. <a-button key="submit"
  15. type="primary"
  16. :loading="loading"
  17. @click="submit(2)">{{inOrOut()}}登记</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="InOutType">
  27. <a-select class="inlineFormSelect"
  28. style="width: 200px"
  29. v-model:value="formState.InOutType"
  30. placeholder="请选择出入库类型">
  31. <a-select-option v-for="item in warehouseType"
  32. :key="item.key"
  33. :value="item.key">
  34. {{item.name}}
  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="DeliveryGoodsID">
  42. <a-select class="inlineFormSelect"
  43. style="width: 200px"
  44. @change="deliveryGoodsChange"
  45. :getPopupContainer="(triggerNode) => triggerNode.parentNode"
  46. v-model:value="formState.DeliveryGoodsID"
  47. placeholder="请选择现货品种">
  48. <a-select-option v-for="item in deliveryGoodsList"
  49. :key="item.deliverygoodsid"
  50. :value="item.deliverygoodsid">
  51. {{item.deliverygoodsname}}
  52. </a-select-option>
  53. </a-select>
  54. </a-form-item>
  55. </a-col>
  56. <a-col :span="12">
  57. <a-form-item label="品类"
  58. name="WRStandardID">
  59. <a-select class="inlineFormSelect"
  60. style="width: 200px"
  61. :getPopupContainer="(triggerNode) => triggerNode.parentNode"
  62. @change="WrStandardChange"
  63. v-model:value="formState.WRStandardID"
  64. placeholder="请选择品类">
  65. <a-select-option v-for="item in gmlist"
  66. :key="item.wrstandardid"
  67. :value="item.wrstandardid">
  68. {{item.wrstandardname}}
  69. </a-select-option>
  70. </a-select>
  71. </a-form-item>
  72. </a-col>
  73. <a-col :span="12">
  74. <a-form-item label="品牌"
  75. name="SpotGoodsBrandID">
  76. <a-select class="inlineFormSelect"
  77. style="width: 200px"
  78. :getPopupContainer="(triggerNode) => triggerNode.parentNode"
  79. v-model:value="formState.SpotGoodsBrandID"
  80. placeholder="请选择品牌">
  81. <a-select-option v-for="item in gblist"
  82. :key="item.brandid"
  83. :value="item.brandid">
  84. {{item.brandname}}
  85. </a-select-option>
  86. </a-select>
  87. </a-form-item>
  88. </a-col>
  89. <a-col :span="12">
  90. <a-form-item :label="`${inOrOut()}仓库`"
  91. name="WarehouseInfo">
  92. <a-select class="inlineFormSelect"
  93. style="width: 200px"
  94. :placeholder="`请选择${inOrOut()}仓库`"
  95. v-model:value="formState.WarehouseInfo">
  96. <a-select-option v-for="option in wareHouseList"
  97. :key="option.autoid"
  98. :value="option.autoid">
  99. {{option.warehousecode}}
  100. </a-select-option>
  101. </a-select>
  102. </a-form-item>
  103. </a-col>
  104. <a-col :span="12">
  105. <a-form-item :label="`${inOrOut()}数量`"
  106. name="Qty">
  107. <a-input class="dialogInput"
  108. style="width: 200px"
  109. v-model:value="formState.Qty"
  110. :placeholder="`请输入${inOrOut()}数量`" />
  111. </a-form-item>
  112. </a-col>
  113. </a-row>
  114. </a-form>
  115. </a-modal>
  116. </template>
  117. <script lang="ts">
  118. import { defineComponent, PropType, ref, toRaw, watchEffect } from 'vue';
  119. import { closeModal } from '@/common/setup/modal/index';
  120. import { initData } from '@/common/methods';
  121. import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
  122. import { handleDeliveryGoods, handleFormState, handleWarehouseList, handleWarehouseType } from './setup';
  123. import { validateAction } from '@/common/setup/form';
  124. import { FormState } from './interface';
  125. import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
  126. import { ermcpInOutStockApplyReq } from '@/services/proto/warehouse';
  127. import { ERMCPAreaInOutStockApplyReq } from '@/services/proto/warehouse/interface';
  128. export default defineComponent({
  129. name: 'add-spot-contract',
  130. components: {},
  131. props: {
  132. selectedRow: {
  133. type: Object as PropType<Ermcp3ContractRsp>,
  134. default: {},
  135. },
  136. },
  137. setup(props, context) {
  138. const { visible, cancel } = closeModal('inventory_current_add');
  139. const { rules, formState, formRef, initFormData } = handleFormState();
  140. const { warehouseType, inOrOut } = handleWarehouseType(formState);
  141. const { wareHouseList, getWarehouseList } = handleWarehouseList();
  142. const { deliveryGoodsList, gblist, gmlist, numberUnit, WrStandardChange, getDeliveryGoods, deliveryGoodsChange } = handleDeliveryGoods(formState);
  143. const loading = ref<boolean>(false);
  144. function submit() {
  145. validateAction<FormState>(formRef, formState).then((param) => {
  146. let reqParam: ERMCPAreaInOutStockApplyReq = {
  147. InOutType: param.InOutType, // int32 出入库类型 - 1:采购入库 2:销售出库 3:生产入库 4:生产出库
  148. WRStandardID: param.WRStandardID as number, // uint64 现货商品ID
  149. // SpotGoodsModelID: param.S; // uint64 现货型号ID
  150. SpotGoodsBrandID: param.SpotGoodsBrandID as number, // uint64 现货品牌ID
  151. DeliveryGoodsID: param.DeliveryGoodsID as number, // uint64 现货品种ID
  152. // SpotContractID: param.SpotContractID, // uint64 关联现货合同ID [1:采购入库 2:销售出库 ](1,2状态必填)
  153. WarehouseInfo: param.WarehouseInfo as number, // uint64 现货仓库ID
  154. Qty: Number(param.Qty), // double 数量
  155. ApplyRemark: '', // string 申请备注
  156. };
  157. requestResultLoadingAndInfo(ermcpInOutStockApplyReq, reqParam, loading, ['出入库登记成功', '出入库登记失败:']).then(() => {
  158. closeAction();
  159. context.emit('refresh');
  160. });
  161. });
  162. }
  163. function closeAction() {
  164. Object.assign(formState, initFormData());
  165. cancel();
  166. }
  167. initData(() => {
  168. getWarehouseList();
  169. getDeliveryGoods();
  170. });
  171. return {
  172. visible,
  173. closeAction,
  174. submit,
  175. loading,
  176. maskClosableFlag: false,
  177. rules,
  178. formState,
  179. formRef,
  180. warehouseType,
  181. inOrOut,
  182. wareHouseList,
  183. deliveryGoodsList,
  184. gblist,
  185. gmlist,
  186. numberUnit,
  187. WrStandardChange,
  188. getDeliveryGoods,
  189. deliveryGoodsChange,
  190. };
  191. },
  192. });
  193. </script>
  194. <style lang="less">
  195. .add-spot-contract {
  196. }
  197. </style>;