Przeglądaj źródła

Adds user organization info to category form

yz 2 tygodni temu
rodzic
commit
e75696e5d0
1 zmienionych plików z 19 dodań i 0 usunięć
  1. 19 0
      src/views/announcement/category/category.vue

+ 19 - 0
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";
 
 /**
@@ -397,6 +398,24 @@ export default {
                     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('获取组织信息失败,请检查网络连接');
+                }
             }
             done();
         },