Browse Source

Merge branch 'dev' into ecp

liyuan 1 month ago
parent
commit
7d9226092e

+ 35 - 21
src/components/announcement/announcement-form-mixin.js

@@ -188,9 +188,9 @@ export function createInitialFormData() {
     content: '',
     categoryId: '',
     categoryName: '',
-    orgId: 0,
-    orgCode: '',
-    orgName: '',
+    orgId: 1002510140000999,        // 硬编码组织ID
+    orgCode: '001',                  // 硬编码组织编码
+    orgName: '库比森轮胎有限公司',    // 硬编码组织名称
     visibleRoles: [],
     brandScope: [],
     customerBlacklist: [],
@@ -539,6 +539,7 @@ export default {
             label: '组织名称',
             type: 'input',
             span: 8,
+            display: false,    // 隐藏组织名称字段显示
             disabled: true,
             rules: this.formRules.orgName
           },
@@ -631,28 +632,41 @@ export default {
 
     /**
      * 加载客户信息并填充组织字段
-     * @description 新增模式下调用接口获取当前用户组织信息,自动填充组织ID、编码、名称
+     * @description 新增模式下使用硬编码组织信息,自动填充组织ID、编码、名称
      * @returns {Promise<void>}
      * @this {AnnouncementFormMixinComponent & Vue}
      */
     async loadCustomerInfo() {
-      try {
-        this.formLoading = true;
-        const response = await getCustomerInfo();
-        if (response?.data?.success && response.data.data) {
-          const customerData = response.data.data;
-          this.$set(this.formData, 'orgId', customerData.ORG_ID || 0);
-          this.$set(this.formData, 'orgCode', customerData.ORG_CODE || '');
-          this.$set(this.formData, 'orgName', customerData.ORG_NAME || '');
-        } else {
-          const errorMsg = response?.data?.msg || '获取客户信息失败';
-          console.warn('获取客户信息失败:', errorMsg);
-        }
-      } catch (error) {
-        console.error('获取客户信息异常:', error);
-      } finally {
-        this.formLoading = false;
-      }
+      // 业务需求:使用硬编码组织信息替代接口调用
+      // 硬编码值:
+      //   orgId: 1002510140000999
+      //   orgCode: "001"
+      //   orgName: "库比森轮胎有限公司"
+      this.formLoading = false; // 直接设置false,无需异步操作
+
+      // 硬编码填充组织信息
+      this.$set(this.formData, 'orgId', 1002510140000999);
+      this.$set(this.formData, 'orgCode', '001');
+      this.$set(this.formData, 'orgName', '库比森轮胎有限公司');
+
+      // 注释掉的原始接口调用逻辑:
+      // try {
+      //   this.formLoading = true;
+      //   const response = await getCustomerInfo();
+      //   if (response?.data?.success && response.data.data) {
+      //     const customerData = response.data.data;
+      //     this.$set(this.formData, 'orgId', customerData.ORG_ID || 0);
+      //     this.$set(this.formData, 'orgCode', customerData.ORG_CODE || '');
+      //     this.$set(this.formData, 'orgName', customerData.ORG_NAME || '');
+      //   } else {
+      //     const errorMsg = response?.data?.msg || '获取客户信息失败';
+      //     console.warn('获取客户信息失败:', errorMsg);
+      //   }
+      // } catch (error) {
+      //   console.error('获取客户信息异常:', error);
+      // } finally {
+      //   this.formLoading = false;
+      // }
     },
 
     /**

+ 10 - 5
src/components/order-form/order-form-mixin.js

@@ -1039,7 +1039,7 @@ export default {
 
     /**
      * 提交订单到U9系统(表单页)
-     * @description 弹出确认框,提交当前表单的订单ID到U9,成功后刷新订单详情以同步状态
+     * @description 弹出确认框,直接返回订单列表页(跳过U9接口调用)
      * @returns {Promise<void>}
      * @this {import('./types').OrderFormMixinComponent}
      */
@@ -1059,11 +1059,13 @@ export default {
 
         loadingInstance = this.$loading({
           lock: true,
-          text: '正在提交到U9系统...',
+          text: '正在处理...',
           spinner: 'el-icon-loading',
           background: 'rgba(0, 0, 0, 0.7)'
         })
 
+        // 注释掉U9接口调用,直接返回列表页
+        /*
         const response = await submitOrderToU9({ id: String(orderId) })
         if (response && response.data && response.data.success) {
           this.$message.success('订单提交成功')
@@ -1071,15 +1073,18 @@ export default {
           if (orderId) {
             await this.loadOrderDetail(orderId)
           }
-          // 提交动作完成后返回订单列表页
-          this.handleBack()
         } else {
           this.$message.error((response && response.data && response.data.msg) || '提交失败')
         }
+        */
+
+        this.$message.success('订单已提交')
+        // 直接返回订单列表页
+        this.handleBack()
       } catch (error) {
         if (error !== 'cancel') {
           // eslint-disable-next-line no-console
-          console.error('提交订单到U9失败:', error)
+          console.error('提交订单失败:', error)
           this.$message.error('提交失败,请稍后重试')
         }
       } finally {

+ 10 - 0
src/utils/selection-manager.js

@@ -138,6 +138,16 @@ class SelectionManager {
     // 清除当前页选择标记
     this.currentPageSelections.clear();
 
+    // 当当前页选择为空时,清理所有选择状态
+    if (currentPageList.length === 0) {
+      console.log('SelectionManager: 当前页无选择,清空所有选择状态');
+      const wasCount = this.selections.size;
+      this.clearAllSelections();
+      console.log(`SelectionManager: 已清空 ${wasCount} 个选择记录`);
+      return;  // 直接返回,不再执行后续逻辑
+    }
+
+
     // 添加当前页选择
     currentPageList.forEach(order => {
       if (order && order.id) {

+ 33 - 4
src/views/announcement/category/category.vue

@@ -43,6 +43,7 @@ import {
     getCategoryDetail,
     updateCategoryStatus
 } from "@/api/announcement/category";
+import { getCustomerInfo } from "@/api/common/index";
 import { mapGetters } from "vuex";
 
 /**
@@ -141,6 +142,8 @@ export default {
                         label: "组织名称",
                         prop: "orgName",
                         search: true,
+                        addDisplay: false,     // 新增时隐藏
+                        editDisplay: false,    // 编辑时隐藏
                         rules: [
                             {
                                 required: true,
@@ -152,6 +155,8 @@ export default {
                     {
                         label: "组织编码",
                         prop: "orgCode",
+                        addDisplay: false,     // 新增时隐藏
+                        editDisplay: false,    // 编辑时隐藏
                         rules: [
                             {
                                 required: true,
@@ -169,6 +174,8 @@ export default {
                         label: "组织ID",
                         prop: "orgId",
                         type: "number",
+                        addDisplay: false,     // 新增时隐藏
+                        editDisplay: false,    // 编辑时隐藏
                         rules: [
                             {
                                 required: true,
@@ -386,17 +393,39 @@ export default {
                 //     console.error('获取分类详情失败:', error);
                 // }
             } else if (type === "add") {
-                // 新增时设置默认值
+                // 新增时设置默认值,使用硬编码组织信息
+                // 硬编码值:
+                //   orgId: 1002510140000999
+                //   orgCode: "001"
+                //   orgName: "库比森轮胎有限公司"
                 this.form = {
                     createDept: this.userInfo.deptId || 1,
                     createUser: this.userInfo.userId || 1,
-                    orgId: 1,
-                    orgCode: "ORG_0001",
-                    orgName: "库比森",
+                    orgId: 1002510140000999,        // 硬编码组织ID
+                    orgCode: "001",                  // 硬编码组织编码
+                    orgName: "库比森轮胎有限公司",    // 硬编码组织名称
                     sortOrder: 0,
                     status: 1,
                     remark: ""
                 };
+
+                // 注释掉的原始getCustomerInfo接口调用逻辑:
+                // try {
+                //     const response = await getCustomerInfo();
+                //     if (response?.data?.success && response.data.data) {
+                //         const customerData = response.data.data;
+                //         this.form.orgId = customerData.ORG_ID || 0;
+                //         this.form.orgCode = customerData.ORG_CODE || '';
+                //         this.form.orgName = customerData.ORG_NAME || '';
+                //     } else {
+                //         const errorMsg = response?.data?.msg || '获取组织信息失败';
+                //         console.warn('获取组织信息失败:', errorMsg);
+                //         this.$message.warning('获取组织信息失败,将使用默认值');
+                //     }
+                // } catch (error) {
+                //     console.error('获取组织信息异常:', error);
+                //     this.$message.error('获取组织信息失败,请检查网络连接');
+                // }
             }
             done();
         },

+ 39 - 0
src/views/order/factory/index.vue

@@ -326,6 +326,26 @@ export default {
       if (selectionManager && this.lifecycleManager) {
         selectionManager.mergeWithCurrentPage(list);
         this.updateSelectionUI();
+
+
+      // 【新增保护】当当前页选择为空时,确保avue-crud状态同步
+        if (list.length === 0) {
+          this.$nextTick(() => {
+            // 延迟检查,确保选择管理器已处理完成
+            const actualCount = selectionManager.getSelectionCount();
+
+            // 如果选择管理器仍有数据(异常情况),强制清空
+            if (actualCount > 0) {
+              console.warn('FactoryOrder: 检测到选择状态不一致,强制同步');
+              // 双重确保清空
+              if (this.$refs.crud) {
+                this.$refs.crud.clearSelection();
+              }
+              // 强制同步UI
+              this.updateSelectionUI();
+            }
+          });
+        }
       }
     },
     /** 页码变化:保持搜索条件不丢失并重新加载 */
@@ -398,6 +418,25 @@ export default {
           this.lifecycleManager.afterExport(true);
         }
 
+        // 清空选择
+        this.$nextTick(() => {
+          try {
+            // 清空选择管理器数据
+            const clearedCount = selectionManager.clearAllSelections();
+            this.updateSelectionUI();
+
+            // 使用avue-crud的selectClear方法清空表格选择
+            if (this.$refs.crud && this.$refs.crud.selectClear) {
+              this.$refs.crud.selectClear();
+              console.log(`导出成功:已清空 ${clearedCount} 个选择`);
+            } else {
+              console.warn('avue-crud的selectClear方法不可用');
+            }
+          } catch (error) {
+            console.error('清空选择状态时出错:', error);
+          }
+        });
+
       } catch (error) {
         console.error('导出失败:', error);
         this.$message.error(error.message || '导出失败,请稍后重试');