Browse Source

Merge branch 'ecp' of http://git.echepei.com/gubersail/gubersail-platform-ui into ecp

Qukatie 1 week ago
parent
commit
5e4b6e905e

+ 1 - 1
src/api/types/order.d.ts

@@ -201,7 +201,7 @@ export type CustomerAddressListResponse = AxiosResponse<ApiResponseData<Customer
 /**
  * 销售订单创建响应类型
  */
-export type SalesOrderCreateResponse = AxiosResponse<ApiResponseData<boolean>>;
+export type SalesOrderCreateResponse = AxiosResponse<ApiResponseData<string>>;
 
 /**
  * 销售订单更新表单接口(基于SalesOrderCreateForm,修正字段类型)

+ 17 - 1
src/components/order-form/order-form-mixin.js

@@ -989,15 +989,31 @@ export default {
          * @param {Object} data - 保存后的订单数据
          * @description 订单保存成功后触发,携带最新的订单数据
          */
-        this.$emit(ORDER_FORM_EVENTS.SAVE_SUCCESS, response.data.data)
+        // 为了兼容父组件的处理逻辑,将返回的订单ID包装成对象格式
+        const orderData = typeof response.data.data === 'string'
+          ? { id: response.data.data }
+          : response.data.data
+        this.$emit(ORDER_FORM_EVENTS.SAVE_SUCCESS, orderData)
 
         // 保持在当前页:新增与编辑模式均不主动返回列表
+        // 新增模式:保存成功后使用返回的订单ID加载订单详情并切换到编辑模式
         // 编辑模式:保存成功后刷新订单详情,已保存的物料置为不可删除
         if (this.isEdit) {
           const savedId = (response && response.data && response.data.data && response.data.data.id) || this.orderId || (this.formData && this.formData.id)
           if (savedId) {
             await this.loadOrderDetail(String(savedId))
           }
+        } else {
+          // 新增模式:使用接口返回的订单ID加载订单详情并切换到编辑模式
+          const newOrderId = response && response.data && response.data.data
+          if (newOrderId) {
+            // 设置订单ID,触发编辑模式
+            this.orderId = String(newOrderId)
+            // 加载订单详情数据
+            await this.loadOrderDetail(String(newOrderId))
+            // 可选:显示成功提示,告知用户已切换到编辑模式
+            this.$message.success('订单创建成功,已自动切换到编辑模式')
+          }
         }
 
       } catch (error) {

+ 10 - 6
src/views/order/order/index-avue.vue

@@ -9,7 +9,7 @@
       @back="handleFormBack"
       @save-success="handleFormSaveSuccess"
     />
-    
+
     <!-- 订单列表 -->
     <avue-crud
       v-else
@@ -177,7 +177,7 @@ export default {
       editOrderId: null,
       // 同步按钮loading状态
       syncLoading: false,
-      
+
       // 事件常量
       ORDER_FORM_EVENTS,
       // 暴露到模板的订单状态常量,供插槽中使用 ORDER_STATUS.DRAFT 判断
@@ -310,7 +310,7 @@ export default {
         // 不调用done(),阻止默认弹窗打开
         return
       }
-      
+
       if (type === 'add') {
         // 新增模式也使用新的表单组件
         this.isEditMode = false
@@ -319,7 +319,7 @@ export default {
         // 不调用done(),阻止默认弹窗打开
         return
       }
-      
+
       // 其他模式(如查看)使用默认弹窗
       done()
     },
@@ -507,7 +507,7 @@ export default {
 
          const payload = { id: String(row.id) }
          const response = await submitOrderToU9(payload)
-         
+
          if (response.data && response.data.success) {
            this.$message.success('订单提交成功')
            // 刷新列表数据
@@ -537,6 +537,10 @@ export default {
 </script>
 
 <style scoped>
+
+::v-deep .el-col-md-8 {
+  width: 24.33333% !important;
+}
 .order-expand-content {
   padding: 16px 24px;
   background-color: #fafafa;
@@ -582,4 +586,4 @@ export default {
 }
 
 
-</style>
+</style>

+ 5 - 4
src/views/order/order/option.js

@@ -51,7 +51,8 @@ export const option = {
   tip: false,
   searchShow: true,
   searchIcon: true,
-  searchMenuSpan: 6,
+  searchMenuSpan: 18,
+  searchIndex: 3,
   border: true,
   index: true,
   viewBtn: false,
@@ -63,7 +64,7 @@ export const option = {
   expand: true, // 启用行展开功能
   expandRowKeys: [], // 默认展开的行(通过主键数组控制)
   defaultExpandAll: false, // 是否默认展开所有行
-  
+
   // 列配置
   column: [
     {
@@ -287,7 +288,7 @@ export const orderItemOption = {
   expand: false,
   expandRowKeys: [],
   defaultExpandAll: false,
-  
+
   column: [
     {
       label: '商品编码',
@@ -378,4 +379,4 @@ export const orderItemOption = {
       hide: true
     }
   ]
-}
+}