Quellcode durchsuchen

fix(订单管理): 修复编辑订单保存后返回列表的问题

yz vor 2 Wochen
Ursprung
Commit
0f217af0f7
3 geänderte Dateien mit 26 neuen und 12 gelöschten Zeilen
  1. 1 1
      README.md
  2. 11 6
      src/components/order-form/order-form-mixin.js
  3. 14 5
      src/views/order/order/index-avue.vue

+ 1 - 1
README.md

@@ -48,7 +48,7 @@ npm install --registry=https://registry.npmmirror.com
   - [ ] 导出预测:不再重复选择年月;列表首列增加复选框按选择导出;工厂导入包含两个 sheet:数据明细 与 所有经销商物料汇总(去掉经销商列)(急)
 
 - 订单管理
-  - [ ] 编辑明细首次保存留在当前页,可继续编辑;修复保存后返回列表看不到的问题(急)
+  - [x] 编辑明细首次保存留在当前页,可继续编辑;修复保存后返回列表看不到的问题(急)
   - [ ] 详情页:已提交的物料明细不可编辑;未提交可编辑数量并删除行(急)
   - [ ] 明确单价是否含税,需与客户确认(否)
   - [ ] 库存不足可提交订单,仅提示不限制(中)

+ 11 - 6
src/components/order-form/order-form-mixin.js

@@ -332,10 +332,10 @@ export default {
                 callback()
               }
             },
-            trigger: 'blur'
-          }
-        ],
-        receiverRegion: [
+             trigger: 'blur'
+           }
+         ],
+         receiverRegion: [
           {
             required: true,
             message: '请输入收货地区',
@@ -914,8 +914,13 @@ export default {
          */
         this.$emit(ORDER_FORM_EVENTS.SAVE_SUCCESS, response.data.data)
 
-        // 返回列表
-        this.handleBack()
+        // 保持在当前页:编辑模式不返回列表,仅在新增模式返回列表
+        if (!this.isEdit) {
+          // 新增模式:保存成功后返回列表
+          this.handleBack()
+        } else {
+          // 编辑模式:留在当前页,方便继续编辑
+        }
 
       } catch (error) {
         const errorMessage = this.isEdit ? '订单更新失败,请重试' : '订单创建失败,请重试'

+ 14 - 5
src/views/order/order/index-avue.vue

@@ -382,11 +382,20 @@ export default {
      * @returns {void}
      */
     handleFormSaveSuccess(orderData) {
-      this.orderFormVisible = false
-      this.isEditMode = false
-      this.editOrderId = null
-      // 刷新列表数据
-      this.onLoad(this.page)
+      if (this.isEditMode) {
+        // 编辑模式:保持在表单页,不返回列表
+        this.orderFormVisible = true
+        // 确保编辑ID保持最新(后端返回可能是字符串/数字)
+        this.editOrderId = orderData && (orderData.id || this.editOrderId)
+        // 后台刷新列表数据,不影响停留在表单
+        this.onLoad(this.page)
+      } else {
+        // 新增模式:保存后返回列表
+        this.orderFormVisible = false
+        this.isEditMode = false
+        this.editOrderId = null
+        this.onLoad(this.page)
+      }
     },
 
     /**