|
@@ -23,7 +23,7 @@ import {
|
|
|
update as updateAnnouncement
|
|
|
} from '@/api/announcement';
|
|
|
import { getCategoryList } from '@/api/announcement/category';
|
|
|
-import { getCustomerList } from '@/api/common/index';
|
|
|
+import { getCustomerList, getCustomerInfo } from '@/api/common/index';
|
|
|
import {
|
|
|
ROLE_OPTIONS,
|
|
|
STATUS_OPTIONS,
|
|
@@ -322,6 +322,10 @@ export default {
|
|
|
this.initFormOption();
|
|
|
// 初始化表单数据
|
|
|
this.formData = createInitialFormData();
|
|
|
+ // 新增模式下,自动加载客户信息以填充组织字段
|
|
|
+ if (!this.isEdit && !this.editData) {
|
|
|
+ this.loadCustomerInfo();
|
|
|
+ }
|
|
|
// 加载分类选项
|
|
|
this.loadCategoryOptions();
|
|
|
} else {
|
|
@@ -529,6 +533,7 @@ export default {
|
|
|
label: '组织名称',
|
|
|
type: 'input',
|
|
|
span: 8,
|
|
|
+ disabled: true,
|
|
|
rules: this.formRules.orgName
|
|
|
},
|
|
|
{
|
|
@@ -536,6 +541,7 @@ export default {
|
|
|
label: '组织编码',
|
|
|
type: 'input',
|
|
|
span: 8,
|
|
|
+ display: false,
|
|
|
rules: this.formRules.orgCode
|
|
|
},
|
|
|
{
|
|
@@ -543,6 +549,7 @@ export default {
|
|
|
label: '组织ID',
|
|
|
type: 'number',
|
|
|
span: 8,
|
|
|
+ display: false,
|
|
|
rules: this.formRules.orgId
|
|
|
},
|
|
|
{
|
|
@@ -617,6 +624,32 @@ export default {
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
+ * 加载客户信息并填充组织字段
|
|
|
+ * @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;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
* 加载公告详情
|
|
|
* @this {AnnouncementFormMixinComponent & Vue}
|
|
|
* @returns {Promise<void>}
|