index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <!-- 出入库登记-->
  3. <a-modal class="commonModal add-spot-contract" :title="`出入库登记(生产${inOrOut()})`" v-model:visible="visible" centered :maskClosable="false" @cancel="cancel" width="890px">
  4. <template #footer>
  5. <a-button key="submit" class="cancelBtn" @click="cancel">取消</a-button>
  6. <a-button key="submit" type="primary" :loading="loading" @click="submit(2)">{{ inOrOut() }}登记</a-button>
  7. </template>
  8. <a-form class="inlineForm" ref="formRef" :model="formState" :rules="rules">
  9. <a-row :gutter="24">
  10. <a-col :span="12">
  11. <a-form-item label="出入库类型" name="InOutType">
  12. <a-select class="inlineFormSelect" style="width: 200px" v-model:value="formState.InOutType" placeholder="请选择出入库类型">
  13. <a-select-option v-for="item in warehouseType" :key="item.key" :value="item.key">
  14. {{ item.name }}
  15. </a-select-option>
  16. </a-select>
  17. </a-form-item>
  18. </a-col>
  19. <a-col :span="12">
  20. <a-form-item label="现货品种" name="DeliveryGoodsID">
  21. <a-select class="inlineFormSelect" style="width: 200px" @change="deliveryGoodsChange" :getPopupContainer="(triggerNode) => triggerNode.parentNode" v-model:value="formState.DeliveryGoodsID" placeholder="请选择现货品种">
  22. <a-select-option v-for="item in deliveryGoodsList" :key="item.deliverygoodsid" :value="item.deliverygoodsid">
  23. {{ item.deliverygoodsname }}
  24. </a-select-option>
  25. </a-select>
  26. </a-form-item>
  27. </a-col>
  28. <a-col :span="12">
  29. <a-form-item label="商品" name="WRStandardID">
  30. <a-select class="inlineFormSelect" style="width: 200px" :getPopupContainer="(triggerNode) => triggerNode.parentNode" @change="WrStandardChange" v-model:value="formState.WRStandardID" placeholder="请选择商品">
  31. <a-select-option v-for="item in gmlist" :key="item.wrstandardid" :value="item.wrstandardid">
  32. {{ item.wrstandardname }}
  33. </a-select-option>
  34. </a-select>
  35. </a-form-item>
  36. </a-col>
  37. <a-col :span="12">
  38. <a-form-item label="品牌" name="SpotGoodsBrandID">
  39. <a-select class="inlineFormSelect" style="width: 200px" :getPopupContainer="(triggerNode) => triggerNode.parentNode" v-model:value="formState.SpotGoodsBrandID" placeholder="请选择品牌">
  40. <a-select-option v-for="item in gblist" :key="item.brandid" :value="item.brandid">
  41. {{ item.brandname }}
  42. </a-select-option>
  43. </a-select>
  44. </a-form-item>
  45. </a-col>
  46. <a-col :span="12">
  47. <a-form-item :label="`${inOrOut()}仓库`" name="WarehouseInfo">
  48. <a-select class="inlineFormSelect" style="width: 200px" :placeholder="`请选择${inOrOut()}仓库`" v-model:value="formState.WarehouseInfo">
  49. <a-select-option v-for="option in wareHouseList" :key="option.autoid" :value="option.autoid">
  50. {{ option.warehousecode }}
  51. </a-select-option>
  52. </a-select>
  53. </a-form-item>
  54. </a-col>
  55. <a-col :span="12">
  56. <a-form-item :label="`${inOrOut()}数量`" name="Qty">
  57. <a-input class="dialogInput" style="width: 200px" v-model:value="formState.Qty" :placeholder="`请输入${inOrOut()}数量`" />
  58. </a-form-item>
  59. </a-col>
  60. </a-row>
  61. </a-form>
  62. </a-modal>
  63. </template>
  64. <script lang="ts">
  65. import { defineComponent, PropType, ref, toRaw, watchEffect } from 'vue';
  66. import { _closeModal } from '@/common/setup/modal/modal';
  67. import { initData } from '@/common/methods';
  68. import { Ermcp3ContractRsp } from '@/services/go/ermcp/spot-contract/interface';
  69. import { handleDeliveryGoods, handleFormState, handleWarehouseList, handleWarehouseType } from './setup';
  70. import { validateAction } from '@/common/setup/form';
  71. import { FormState } from './interface';
  72. import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
  73. import { ermcpInOutStockApplyReq } from '@/services/proto/warehouse';
  74. import { ERMCPAreaInOutStockApplyReq } from '@/services/proto/warehouse/interface';
  75. export default defineComponent({
  76. name: 'add-spot-contract',
  77. emits: ['cancel', 'update'],
  78. components: {},
  79. props: {
  80. selectedRow: {
  81. type: Object as PropType<Ermcp3ContractRsp>,
  82. default: {},
  83. },
  84. },
  85. setup(props, context) {
  86. const { visible, cancel } = _closeModal(context);
  87. const { rules, formState, formRef, initFormData } = handleFormState();
  88. const { warehouseType, inOrOut } = handleWarehouseType(formState);
  89. const { wareHouseList, getWarehouseList } = handleWarehouseList();
  90. const { deliveryGoodsList, gblist, gmlist, numberUnit, WrStandardChange, getDeliveryGoods, deliveryGoodsChange } = handleDeliveryGoods(formState);
  91. const loading = ref<boolean>(false);
  92. function submit() {
  93. validateAction<FormState>(formRef, formState).then((param) => {
  94. let reqParam: ERMCPAreaInOutStockApplyReq = {
  95. InOutType: param.InOutType, // int32 出入库类型 - 1:采购入库 2:销售出库 3:生产入库 4:生产出库
  96. WRStandardID: param.WRStandardID as number, // uint64 现货商品ID
  97. // SpotGoodsModelID: param.S; // uint64 现货型号ID
  98. SpotGoodsBrandID: param.SpotGoodsBrandID as number, // uint64 现货品牌ID
  99. DeliveryGoodsID: param.DeliveryGoodsID as number, // uint64 现货品种ID
  100. // SpotContractID: param.SpotContractID, // uint64 关联现货合同ID [1:采购入库 2:销售出库 ](1,2状态必填)
  101. WarehouseInfo: param.WarehouseInfo as number, // uint64 现货仓库ID
  102. Qty: Number(param.Qty), // double 数量
  103. ApplyRemark: '', // string 申请备注
  104. };
  105. requestResultLoadingAndInfo(ermcpInOutStockApplyReq, reqParam, loading, ['出入库登记成功', '出入库登记失败:']).then(() => {
  106. Object.assign(formState, initFormData());
  107. cancel(true);
  108. });
  109. });
  110. }
  111. initData(() => {
  112. getWarehouseList();
  113. getDeliveryGoods();
  114. });
  115. return {
  116. visible,
  117. cancel,
  118. submit,
  119. loading,
  120. maskClosableFlag: false,
  121. rules,
  122. formState,
  123. formRef,
  124. warehouseType,
  125. inOrOut,
  126. wareHouseList,
  127. deliveryGoodsList,
  128. gblist,
  129. gmlist,
  130. numberUnit,
  131. WrStandardChange,
  132. getDeliveryGoods,
  133. deliveryGoodsChange,
  134. };
  135. },
  136. });
  137. </script>