Browse Source

Hardcodes organization info and hides related fields

yz 1 month ago
parent
commit
6871077692

+ 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;
+      // }
     },
 
     /**

+ 31 - 21
src/views/announcement/category/category.vue

@@ -142,6 +142,8 @@ export default {
                         label: "组织名称",
                         prop: "orgName",
                         search: true,
+                        addDisplay: false,     // 新增时隐藏
+                        editDisplay: false,    // 编辑时隐藏
                         rules: [
                             {
                                 required: true,
@@ -153,6 +155,8 @@ export default {
                     {
                         label: "组织编码",
                         prop: "orgCode",
+                        addDisplay: false,     // 新增时隐藏
+                        editDisplay: false,    // 编辑时隐藏
                         rules: [
                             {
                                 required: true,
@@ -170,6 +174,8 @@ export default {
                         label: "组织ID",
                         prop: "orgId",
                         type: "number",
+                        addDisplay: false,     // 新增时隐藏
+                        editDisplay: false,    // 编辑时隐藏
                         rules: [
                             {
                                 required: true,
@@ -387,35 +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: ""
                 };
 
-                // 获取当前用户的组织信息
-                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('获取组织信息失败,请检查网络连接');
-                }
+                // 注释掉的原始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();
         },