huangbin před 4 roky
rodič
revize
3be1e6413f

+ 7 - 4
src/views/information/goods/components/add/index.vue

@@ -307,8 +307,8 @@
                           v-model:value="domain.middlegoodsid"
                           placeholder="请选择套保品种">
                   <a-select-option v-for="item in goodsGroup"
-                                   :value="item.groupcategroyid"
-                                   :key="item.groupcategroyid">
+                                   :value="item.goodsgroupid"
+                                   :key="item.goodsgroupid">
                     {{item.goodsgroupname}}
                   </a-select-option>
                 </a-select>
@@ -436,7 +436,7 @@ export default defineComponent({
         PlusOutlined,
         MinusOutlined,
     },
-    setup() {
+    setup(props, context) {
         // 控制关闭弹窗
         const { visible, cancel } = closeModal('spot_contract_btn_add');
         // 下单方法
@@ -527,7 +527,10 @@ export default defineComponent({
                 .validate()
                 .then(() => {
                     const param = toRaw(formState);
-                    addAction(param);
+                    addAction(param).then(() => {
+                        cancel();
+                        context.emit('refresh', true);
+                    });
                     console.log('param', param);
                 })
                 .catch((error: ValidateErrorEntity<FormState>) => {

+ 13 - 14
src/views/information/goods/components/add/setup.ts

@@ -2,7 +2,7 @@ import { getItemEnum } from '@/services/bus/allEnum';
 import { QueryGoodsfGroup } from '@/services/go/ermcp/goodsInfo';
 import { Ermcp3GoodsGroup } from '@/services/go/ermcp/goodsInfo/interface';
 import { addDeliveryGoodsApply } from '@/services/proto/delivery';
-import {DeliveryGoodsApplyReq, GLDWRStandardEx} from '@/services/proto/delivery/interface';
+import { DeliveryGoodsApplyReq } from '@/services/proto/delivery/interface';
 import { message } from 'ant-design-vue';
 import { reactive, ref, UnwrapRef } from 'vue';
 import { FormState } from './interface';
@@ -13,18 +13,18 @@ import { FormState } from './interface';
  */
 export function handleAdd() {
     const loading = ref<boolean>(false);
-    function addAction(param: FormState) {
+    function addAction(param: FormState): Promise<void> {
         const unitid = param.unitid === undefined ? 0 : param.unitid
-        const reqParam :DeliveryGoodsApplyReq = {
+        const reqParam: DeliveryGoodsApplyReq = {
             deliverygoodscode: param.deliverygoodscode,
             deliverygoodsname: param.deliverygoodsname,
-            deliverygoodsid:   param.deliverygoodsid,
+            deliverygoodsid: param.deliverygoodsid,
             unitid: unitid,
             type: 1,
             remark: param.remark,
             gldwrstandards: param.gldwrstandards.map(value => {
-                let gldunitid = value.unitid === undefined ? 0 : value.unitid
-                let convertfactors: any = value.convertfactor === null ? 0 : value.convertfactor
+                const gldunitid = value.unitid === undefined ? 0 : value.unitid
+                const convertfactors: any = value.convertfactor === null ? 0 : value.convertfactor
                 return {
                     wrstandardid: value.wrstandardid,
                     wrstandardname: value.wrstandardname,
@@ -34,22 +34,21 @@ export function handleAdd() {
             }),
             glddgfactoryItems: param.glddgfactoryItems,
             wrsconvertdetails: param.wrsconvertdetails.map(value => {
-                let middlegoodsid = value.middlegoodsid === undefined ? 0 : value.middlegoodsid
-                let convertratio: any = value.convertratio === null ? 0 : value.convertratio
-                let wrsunitid = value.unitid === null ? 0 : value.unitid
+                const middlegoodsid = value.middlegoodsid === undefined ? 0 : value.middlegoodsid
+                const convertratio: any = value.convertratio === null ? 0 : value.convertratio
+                const wrsunitid = value.unitid === null ? 0 : value.unitid
                 return {
                     middlegoodsid: middlegoodsid,
-                    convertratio:  (convertratio as string) ? Number(convertratio) : convertratio,
+                    convertratio: (convertratio as string) ? Number(convertratio) : convertratio,
                     unitid: wrsunitid
                 }
             })
         }
         loading.value = true;
-        addDeliveryGoodsApply(reqParam).then(() => {
+        return addDeliveryGoodsApply(reqParam).then(() => {
             message.success('新增现货品种成功!')
-        }).catch(err => {
-            message.error(err.message)
-        }).finally(() => loading.value = false)
+            Promise.resolve()
+        }).catch(err => message.error(err.message)).finally(() => loading.value = false)
     }
     return { loading, addAction }
 }

+ 1 - 1
src/views/information/goods/list/spot-variety/index.vue

@@ -16,7 +16,7 @@
       </div>
     </div>
     <!-- 新增商品 -->
-    <AddGoods />
+    <AddGoods @refresh="queryDG" />
   </div>
 </template>