huangbin 4 년 전
부모
커밋
671c582f65
1개의 변경된 파일8개의 추가작업 그리고 5개의 파일을 삭제
  1. 8 5
      src/views/information/goods/components/add/index.vue

+ 8 - 5
src/views/information/goods/components/add/index.vue

@@ -4,7 +4,7 @@
            wrapClassName=""
            title="新增现货品种"
            v-model:visible="visible"
-           @cancel="cancel"
+           @cancel="closeAction"
            centered
            :maskClosable="maskClosableFlag"
            width="850px">
@@ -349,9 +349,7 @@ export default defineComponent({
                     }),
                 };
                 requestResultLoadingAndInfo(addDeliveryGoodsApply, reqParam, loading, ['新增现货品种成功', '新增现货品种失败:']).then(() => {
-                    // 清空数据
-                    Object.assign(formState, initFormData());
-                    cancel();
+                    closeAction();
                     context.emit('refresh');
                 });
             });
@@ -388,12 +386,17 @@ export default defineComponent({
                 value.unitid = obj.agreeunit;
             }
         }
+        function closeAction() {
+            //清空添加成功后的数据,确保在此新增打开是个空数据
+            Object.assign(formState, initFormData());
+            cancel();
+        }
         initData(() => {
             getGoodsGroup();
         });
         return {
             visible,
-            cancel,
+            closeAction,
             formRef,
             formState,
             addOne,