Browse Source

供应商信息

Lijingyang 2 tháng trước cách đây
mục cha
commit
8386aeae54

+ 1 - 1
src/api/supplier/area/index.ts

@@ -10,7 +10,7 @@ import { AreaVO, AreaForm, AreaQuery } from '@/api/supplier/area/types';
 
 export const listArea = (query?: AreaQuery): AxiosPromise<AreaVO[]> => {
   return request({
-    url: '/customer/area/list',
+    url: '/customer/area/srm/list',
     method: 'get',
     params: query
   });

+ 3 - 3
src/api/supplier/info/index.ts

@@ -22,7 +22,7 @@ export const listInfo = (query?: InfoQuery): AxiosPromise<InfoVO[]> => {
  */
 export const getInfo = (id: string | number): AxiosPromise<InfoVO> => {
   return request({
-    url: '/customer/info/' + id,
+    url: '/customer/info/srm/' + id,
     method: 'get'
   });
 };
@@ -45,7 +45,7 @@ export const addInfo = (data: InfoForm) => {
  */
 export const updateInfo = (data: InfoForm) => {
   return request({
-    url: '/customer/info',
+    url: '/customer/info/edit',
     method: 'put',
     data: data
   });
@@ -183,7 +183,7 @@ export const getContactListById = (supplierId: string | number, params?: any) =>
  */
 export const getSupplierCategories = (supplierId: string | number) => {
   return request({
-    url: '/customer/info/getSupplierCategories',
+    url: '/customer/info/getsrmCategories',
     method: 'get',
     params: { supplierId }
   });

+ 63 - 0
src/api/supplier/infoTemporary/index.ts

@@ -0,0 +1,63 @@
+import request from '@/utils/request';
+import { AxiosPromise } from 'axios';
+import { InfoTemporaryVO, InfoTemporaryForm, InfoTemporaryQuery } from '@/api/supplier/infoTemporary/types';
+
+/**
+ * 查询供应商临时信息列表
+ * @param query
+ * @returns {*}
+ */
+
+export const listInfoTemporary = (query?: InfoTemporaryQuery): AxiosPromise<InfoTemporaryVO[]> => {
+  return request({
+    url: '/customer/infoTemporary/list',
+    method: 'get',
+    params: query
+  });
+};
+
+/**
+ * 查询供应商临时信息详细
+ * @param id
+ */
+export const getInfoTemporary = (id: string | number): AxiosPromise<InfoTemporaryVO> => {
+  return request({
+    url: '/customer/infoTemporary/' + id,
+    method: 'get'
+  });
+};
+
+/**
+ * 新增供应商临时信息
+ * @param data
+ */
+export const addInfoTemporary = (data: InfoTemporaryForm) => {
+  return request({
+    url: '/customer/infoTemporary',
+    method: 'post',
+    data: data
+  });
+};
+
+/**
+ * 修改供应商临时信息
+ * @param data
+ */
+export const updateInfoTemporary = (data: InfoTemporaryForm) => {
+  return request({
+    url: '/customer/infoTemporary',
+    method: 'put',
+    data: data
+  });
+};
+
+/**
+ * 删除供应商临时信息
+ * @param id
+ */
+export const delInfoTemporary = (id: string | number | Array<string | number>) => {
+  return request({
+    url: '/customer/infoTemporary/' + id,
+    method: 'delete'
+  });
+};

+ 930 - 0
src/api/supplier/infoTemporary/types.ts

@@ -0,0 +1,930 @@
+export interface InfoTemporaryVO {
+  /**
+   * 对应supplier_info.id 
+   */
+  id: string | number;
+
+  /**
+   * 供应商ID(关联supplier_info表的主键)
+   */
+  supplierId?: string | number;
+
+  /**
+   * 供应商编号
+   */
+  supplierNo: string;
+
+  /**
+   * 供应商名称
+   */
+  enterpriseName: string;
+
+  /**
+   * 企业规模
+   */
+  membershipSize: number;
+
+  /**
+   * 供应商类型(如生产厂家/经销商/代理商)
+   */
+  supplierType: number;
+
+  /**
+   * 合作类型(如框架合作/项目合作/一次性合作)
+   */
+  cooperationType: number;
+
+  /**
+   * 固定电话(多个号码用分隔符区分)
+   */
+  fixedPhone: string;
+
+  /**
+   * 传真号码
+   */
+  fax: string;
+
+  /**
+   * 企业官网地址
+   */
+  url: string;
+
+  /**
+   * 邮政编码
+   */
+  postCode: string;
+
+  /**
+   * 企业邮箱
+   */
+  mailbox: string;
+
+  /**
+   * 办公地址-省份
+   */
+  officeProvince: string;
+
+  /**
+   * 办公地址-城市
+   */
+  officeCity: string;
+
+  /**
+   * 办公地址-区县
+   */
+  officeCounty: string;
+
+  /**
+   * 办公地址-详细地址
+   */
+  officeAddress: string;
+
+  /**
+   * 工商注册名称(与营业执照一致)
+   */
+  businessName: string;
+
+  /**
+   * 统一社会信用代码
+   */
+  socialCreditCode: string;
+
+  /**
+   * 法定代表人姓名
+   */
+  legalPersonName: string;
+
+  /**
+   * 法定代表人身份证号(加密存储)
+   */
+  legalPersonId: string | number;
+
+  /**
+   * 注册资本(如500万/1000万元人民币)
+   */
+  registeredCapital: string;
+
+  /**
+   * 经营地址-省份
+   */
+  businessProvince: string;
+
+  /**
+   * 经营地址-城市
+   */
+  businessCity: string;
+
+  /**
+   * 经营地址-区县
+   */
+  businessCounty: string;
+
+  /**
+   * 经营地址-详细地址
+   */
+  businessAddress: string;
+
+  /**
+   * 营业执照图片存储地址(多个地址用分隔符区分)
+   */
+  businessLicense: string;
+
+  /**
+   * 发票类型(如增值税专票/普票/电子发票)
+   */
+  invoiceType: string;
+
+  /**
+   * 发票抬头
+   */
+  invoiceHeader: string;
+
+  /**
+   * 纳税人识别号
+   */
+  taxpayerIdentifier: string | number;
+
+  /**
+   * 开户银行
+   */
+  depositaryBank: string;
+
+  /**
+   * 行号(开户银行行号)
+   */
+  rowNum: string;
+
+  /**
+   * 银行账号
+   */
+  bankAccounts: string;
+
+  /**
+   * 开票地址
+   */
+  invoiceAddress: string;
+
+  /**
+   * 开票固定电话
+   */
+  invoiceLandline: string;
+
+  /**
+   * 供货范围(经营品类/产品范围)
+   */
+  scopeSupply: string;
+
+  /**
+   * 合作方式(0线下 1线上 2混合)
+   */
+  cooperateWay: string;
+
+  /**
+   * 合作等级(如A级/B级/C级)
+   */
+  cooperateLevel: number;
+
+  /**
+   * 合同到期时间
+   */
+  contractEndTime: string;
+
+  /**
+   * 供货状态(0未供货 1供货中 2暂停供货 3终止供货)
+   */
+  supplyStatus: string;
+
+  /**
+   * 供货评分(如1-100分)
+   */
+  supplyScore: number;
+
+  /**
+   * 年销售额(单位:万元)
+   */
+  yearSales: number;
+
+  /**
+   * 供应商联系人姓名
+   */
+  supplierName: string;
+
+  /**
+   * 供应商联系人电话
+   */
+  supplierPhone: string;
+
+  /**
+   * 供应商登录密码(加密存储)
+   */
+  supplierPassword: string;
+
+  /**
+   * 经营品类(多个品类用分隔符区分)
+   */
+  operatingCategory: string;
+
+  /**
+   * 经营品牌(多个品牌用分隔符区分)
+   */
+  operatingBrand: string;
+
+  /**
+   * 其他合作客户(客户名称列表)
+   */
+  otherCustomers: string;
+
+  /**
+   * 企业简称
+   */
+  shortName: string;
+
+  /**
+   * 行业分类(如电子/建材/食品)
+   */
+  industrCategory: number;
+
+  /**
+   * 补充类型(预留字段)
+   */
+  type: string;
+
+  /**
+   * 所属集团公司(如有)
+   */
+  ownedCompany: number;
+
+  /**
+   * 数据推送状态(0未推送 1已推送 2推送失败)
+   */
+  pushStatus: string;
+
+  /**
+   * 有效期起始时间
+   */
+  validityFromDate: string | number;
+
+  /**
+   * 有效期截止时间
+   */
+  validityToDate: string | number;
+
+  /**
+   * 行序号(导入数据用)
+   */
+  rowNo: number;
+
+  /**
+   * 经办人身份证/授权书图片地址
+   */
+  personImage: string;
+
+  /**
+   * 经办人身份证/授权书图片地址Url
+   */
+  personImageUrl: string;
+  /**
+   * 对接人编号
+   */
+  abutmentNo: number;
+
+  /**
+   * 是否合作(0否 1是)
+   */
+  cooperative: number;
+
+  /**
+   * 覆盖区域列表(JSON格式,如省份/城市列表)
+   */
+  areaListJson: string;
+
+  /**
+   * 状态(0正常 1停用)
+   */
+  status: string;
+
+  /**
+   * 备注信息
+   */
+  remark: string;
+
+}
+
+export interface InfoTemporaryForm extends BaseEntity {
+  /**
+   * 对应supplier_info.id 
+   */
+  id?: string | number;
+
+  /**
+   * 供应商ID(关联supplier_info表的主键)
+   */
+  supplierId?: string | number;
+
+  /**
+   * 供应商编号
+   */
+  supplierNo?: string;
+
+  /**
+   * 供应商名称
+   */
+  enterpriseName?: string;
+
+  /**
+   * 企业规模
+   */
+  membershipSize?: number;
+
+  /**
+   * 供应商类型(如生产厂家/经销商/代理商)
+   */
+  supplierType?: number;
+
+  /**
+   * 合作类型(如框架合作/项目合作/一次性合作)
+   */
+  cooperationType?: number;
+
+  /**
+   * 固定电话(多个号码用分隔符区分)
+   */
+  fixedPhone?: string;
+
+  /**
+   * 传真号码
+   */
+  fax?: string;
+
+  /**
+   * 企业官网地址
+   */
+  url?: string;
+
+  /**
+   * 邮政编码
+   */
+  postCode?: string;
+
+  /**
+   * 企业邮箱
+   */
+  mailbox?: string;
+
+  /**
+   * 办公地址-省份
+   */
+  officeProvince?: string;
+
+  /**
+   * 办公地址-城市
+   */
+  officeCity?: string;
+
+  /**
+   * 办公地址-区县
+   */
+  officeCounty?: string;
+
+  /**
+   * 办公地址-详细地址
+   */
+  officeAddress?: string;
+
+  /**
+   * 工商注册名称(与营业执照一致)
+   */
+  businessName?: string;
+
+  /**
+   * 统一社会信用代码
+   */
+  socialCreditCode?: string;
+
+  /**
+   * 法定代表人姓名
+   */
+  legalPersonName?: string;
+
+  /**
+   * 法定代表人身份证号(加密存储)
+   */
+  legalPersonId?: string | number;
+
+  /**
+   * 注册资本(如500万/1000万元人民币)
+   */
+  registeredCapital?: string;
+
+  /**
+   * 经营地址-省份
+   */
+  businessProvince?: string;
+
+  /**
+   * 经营地址-城市
+   */
+  businessCity?: string;
+
+  /**
+   * 经营地址-区县
+   */
+  businessCounty?: string;
+
+  /**
+   * 经营地址-详细地址
+   */
+  businessAddress?: string;
+
+  /**
+   * 营业执照图片存储地址(多个地址用分隔符区分)
+   */
+  businessLicense?: string;
+
+  /**
+   * 发票类型(如增值税专票/普票/电子发票)
+   */
+  invoiceType?: string;
+
+  /**
+   * 发票抬头
+   */
+  invoiceHeader?: string;
+
+  /**
+   * 纳税人识别号
+   */
+  taxpayerIdentifier?: string | number;
+
+  /**
+   * 开户银行
+   */
+  depositaryBank?: string;
+
+  /**
+   * 行号(开户银行行号)
+   */
+  rowNum?: string;
+
+  /**
+   * 银行账号
+   */
+  bankAccounts?: string;
+
+  /**
+   * 开票地址
+   */
+  invoiceAddress?: string;
+
+  /**
+   * 开票固定电话
+   */
+  invoiceLandline?: string;
+
+  /**
+   * 供货范围(经营品类/产品范围)
+   */
+  scopeSupply?: string;
+
+  /**
+   * 合作方式(0线下 1线上 2混合)
+   */
+  cooperateWay?: string;
+
+  /**
+   * 合作等级(如A级/B级/C级)
+   */
+  cooperateLevel?: number;
+
+  /**
+   * 合同到期时间
+   */
+  contractEndTime?: string;
+
+  /**
+   * 供货状态(0未供货 1供货中 2暂停供货 3终止供货)
+   */
+  supplyStatus?: string;
+
+  /**
+   * 供货评分(如1-100分)
+   */
+  supplyScore?: number;
+
+  /**
+   * 年销售额(单位:万元)
+   */
+  yearSales?: number;
+
+  /**
+   * 供应商联系人姓名
+   */
+  supplierName?: string;
+
+  /**
+   * 供应商联系人电话
+   */
+  supplierPhone?: string;
+
+  /**
+   * 供应商登录密码(加密存储)
+   */
+  supplierPassword?: string;
+
+  /**
+   * 经营品类(多个品类用分隔符区分)
+   */
+  operatingCategory?: string;
+
+  /**
+   * 经营品牌(多个品牌用分隔符区分)
+   */
+  operatingBrand?: string;
+
+  /**
+   * 其他合作客户(客户名称列表)
+   */
+  otherCustomers?: string;
+
+  /**
+   * 企业简称
+   */
+  shortName?: string;
+
+  /**
+   * 行业分类(如电子/建材/食品)
+   */
+  industrCategory?: number;
+
+  /**
+   * 补充类型(预留字段)
+   */
+  type?: string;
+
+  /**
+   * 所属集团公司(如有)
+   */
+  ownedCompany?: number;
+
+  /**
+   * 数据推送状态(0未推送 1已推送 2推送失败)
+   */
+  pushStatus?: string;
+
+  /**
+   * 有效期起始时间
+   */
+  validityFromDate?: string | number;
+
+  /**
+   * 有效期截止时间
+   */
+  validityToDate?: string | number;
+
+  /**
+   * 行序号(导入数据用)
+   */
+  rowNo?: number;
+
+  /**
+   * 经办人身份证/授权书图片地址
+   */
+  personImage?: string;
+
+  /**
+   * 对接人编号
+   */
+  abutmentNo?: number;
+
+  /**
+   * 是否合作(0否 1是)
+   */
+  cooperative?: number;
+
+  /**
+   * 覆盖区域列表(JSON格式,如省份/城市列表)
+   */
+  areaListJson?: string;
+
+  /**
+   * 状态(0正常 1停用)
+   */
+  status?: string;
+
+  /**
+   * 备注信息
+   */
+  remark?: string;
+
+}
+
+export interface InfoTemporaryQuery extends PageQuery {
+
+  /**
+   * 供应商ID(关联supplier_info表的主键)
+   */
+  supplierId?: string | number;
+
+  /**
+   * 供应商编号
+   */
+  supplierNo?: string;
+
+  /**
+   * 供应商名称
+   */
+  enterpriseName?: string;
+
+  /**
+   * 企业规模
+   */
+  membershipSize?: number;
+
+  /**
+   * 供应商类型(如生产厂家/经销商/代理商)
+   */
+  supplierType?: number;
+
+  /**
+   * 合作类型(如框架合作/项目合作/一次性合作)
+   */
+  cooperationType?: number;
+
+  /**
+   * 固定电话(多个号码用分隔符区分)
+   */
+  fixedPhone?: string;
+
+  /**
+   * 传真号码
+   */
+  fax?: string;
+
+  /**
+   * 企业官网地址
+   */
+  url?: string;
+
+  /**
+   * 邮政编码
+   */
+  postCode?: string;
+
+  /**
+   * 企业邮箱
+   */
+  mailbox?: string;
+
+  /**
+   * 办公地址-省份
+   */
+  officeProvince?: string;
+
+  /**
+   * 办公地址-城市
+   */
+  officeCity?: string;
+
+  /**
+   * 办公地址-区县
+   */
+  officeCounty?: string;
+
+  /**
+   * 办公地址-详细地址
+   */
+  officeAddress?: string;
+
+  /**
+   * 工商注册名称(与营业执照一致)
+   */
+  businessName?: string;
+
+  /**
+   * 统一社会信用代码
+   */
+  socialCreditCode?: string;
+
+  /**
+   * 法定代表人姓名
+   */
+  legalPersonName?: string;
+
+  /**
+   * 法定代表人身份证号(加密存储)
+   */
+  legalPersonId?: string | number;
+
+  /**
+   * 注册资本(如500万/1000万元人民币)
+   */
+  registeredCapital?: string;
+
+  /**
+   * 经营地址-省份
+   */
+  businessProvince?: string;
+
+  /**
+   * 经营地址-城市
+   */
+  businessCity?: string;
+
+  /**
+   * 经营地址-区县
+   */
+  businessCounty?: string;
+
+  /**
+   * 经营地址-详细地址
+   */
+  businessAddress?: string;
+
+  /**
+   * 营业执照图片存储地址(多个地址用分隔符区分)
+   */
+  businessLicense?: string;
+
+  /**
+   * 发票类型(如增值税专票/普票/电子发票)
+   */
+  invoiceType?: string;
+
+  /**
+   * 发票抬头
+   */
+  invoiceHeader?: string;
+
+  /**
+   * 纳税人识别号
+   */
+  taxpayerIdentifier?: string | number;
+
+  /**
+   * 开户银行
+   */
+  depositaryBank?: string;
+
+  /**
+   * 行号(开户银行行号)
+   */
+  rowNum?: string;
+
+  /**
+   * 银行账号
+   */
+  bankAccounts?: string;
+
+  /**
+   * 开票地址
+   */
+  invoiceAddress?: string;
+
+  /**
+   * 开票固定电话
+   */
+  invoiceLandline?: string;
+
+  /**
+   * 供货范围(经营品类/产品范围)
+   */
+  scopeSupply?: string;
+
+  /**
+   * 合作方式(0线下 1线上 2混合)
+   */
+  cooperateWay?: string;
+
+  /**
+   * 合作等级(如A级/B级/C级)
+   */
+  cooperateLevel?: number;
+
+  /**
+   * 合同到期时间
+   */
+  contractEndTime?: string;
+
+  /**
+   * 供货状态(0未供货 1供货中 2暂停供货 3终止供货)
+   */
+  supplyStatus?: string;
+
+  /**
+   * 供货评分(如1-100分)
+   */
+  supplyScore?: number;
+
+  /**
+   * 年销售额(单位:万元)
+   */
+  yearSales?: number;
+
+  /**
+   * 供应商联系人姓名
+   */
+  supplierName?: string;
+
+  /**
+   * 供应商联系人电话
+   */
+  supplierPhone?: string;
+
+  /**
+   * 供应商登录密码(加密存储)
+   */
+  supplierPassword?: string;
+
+  /**
+   * 经营品类(多个品类用分隔符区分)
+   */
+  operatingCategory?: string;
+
+  /**
+   * 经营品牌(多个品牌用分隔符区分)
+   */
+  operatingBrand?: string;
+
+  /**
+   * 其他合作客户(客户名称列表)
+   */
+  otherCustomers?: string;
+
+  /**
+   * 企业简称
+   */
+  shortName?: string;
+
+  /**
+   * 行业分类(如电子/建材/食品)
+   */
+  industrCategory?: number;
+
+  /**
+   * 补充类型(预留字段)
+   */
+  type?: string;
+
+  /**
+   * 所属集团公司(如有)
+   */
+  ownedCompany?: number;
+
+  /**
+   * 数据推送状态(0未推送 1已推送 2推送失败)
+   */
+  pushStatus?: string;
+
+  /**
+   * 有效期起始时间
+   */
+  validityFromDate?: string | number;
+
+  /**
+   * 有效期截止时间
+   */
+  validityToDate?: string | number;
+
+  /**
+   * 行序号(导入数据用)
+   */
+  rowNo?: number;
+
+  /**
+   * 经办人身份证/授权书图片地址
+   */
+  personImage?: string;
+
+  /**
+   * 对接人编号
+   */
+  abutmentNo?: number;
+
+  /**
+   * 是否合作(0否 1是)
+   */
+  cooperative?: number;
+
+  /**
+   * 覆盖区域列表(JSON格式,如省份/城市列表)
+   */
+  areaListJson?: string;
+
+  /**
+   * 状态(0正常 1停用)
+   */
+  status?: string;
+
+  /**
+   * 备注信息
+   */
+  remark?: string;
+
+    /**
+     * 日期范围参数
+     */
+    params?: any;
+}
+
+
+

+ 145 - 0
src/utils/README-region-data.md

@@ -0,0 +1,145 @@
+# 地区数据系统架构说明
+
+## 双地区数据系统设计
+
+本项目采用双地区数据系统架构,分别服务于不同的业务场景:
+
+### 1. 基本信息地址选择系统
+
+**使用场景:**
+- 供应商基本信息中的注册地址
+- 供应商办公地址
+- 联系人地址等基本信息
+
+**数据源:**
+- `element-china-area-data` 组件库
+- 或本地 `src/utils/regionData.ts` 文件
+
+**特点:**
+- ✅ 简单快速,无需网络请求
+- ✅ 数据稳定,适合基本地址选择
+- ✅ 组件库支持良好
+- ✅ 用户体验流畅
+
+**数据格式:**
+```typescript
+interface FrontendRegionItem {
+  value: string;    // 地区代码
+  label: string;    // 地区名称
+  children?: FrontendRegionItem[];
+}
+```
+
+### 2. 供应区域管理系统
+
+**使用场景:**
+- 供货区域管理
+- 授权区域设置
+- 复杂的地区业务逻辑
+
+**数据源:**
+- 后端数据库(通过 `chinaAreaList` API)
+- `/system/addressarea/getChinaList` 接口
+
+**特点:**
+- ✅ 支持复杂业务逻辑
+- ✅ 数据可动态管理和更新
+- ✅ 与后端业务系统保持一致
+- ✅ 支持自定义地区数据
+
+**数据格式:**
+```typescript
+interface BackendRegionItem {
+  id: number;
+  areaCode: string;
+  areaName: string;
+  parentCode: number;
+  level: number;
+  children?: BackendRegionItem[];
+}
+```
+
+## 为什么需要两套系统?
+
+### 业务需求不同
+
+1. **基本地址选择**:只需要简单的省市区选择,用于填写基本信息
+2. **供应区域管理**:涉及复杂的业务逻辑,如授权管理、供货范围等
+
+### 性能考虑
+
+1. **基本地址选择**:使用本地数据,响应速度快,用户体验好
+2. **供应区域管理**:需要实时数据,支持动态更新
+
+### 维护成本
+
+1. **基本地址选择**:使用成熟的组件库,维护成本低
+2. **供应区域管理**:需要与业务系统深度集成,但功能更强大
+
+## 使用指南
+
+### 基本地址选择
+
+```vue
+<template>
+  <el-cascader
+    v-model="selectedRegion"
+    :options="regionOptions"
+    :props="regionCascaderProps"
+    placeholder="请选择省市区"
+  />
+</template>
+
+<script setup>
+import { regionData } from 'element-china-area-data';
+
+const regionOptions = ref(regionData);
+const regionCascaderProps = {
+  value: 'value',
+  label: 'label',
+  children: 'children'
+};
+</script>
+```
+
+### 供应区域管理
+
+```vue
+<script setup>
+import { chinaAreaList } from '@/api/system/addressarea/index';
+import { convertRegionData } from '@/utils/regionDataConverter';
+
+const supplyAreaOptions = ref([]);
+
+const initSupplyAreaOptions = async () => {
+  try {
+    const res = await chinaAreaList();
+    supplyAreaOptions.value = res.data;
+    // 如果需要转换为级联选择器格式
+    // const converted = convertRegionData(res.data);
+  } catch (e) {
+    console.error('获取供货区域数据失败:', e);
+  }
+};
+</script>
+```
+
+## 工具函数
+
+`src/utils/regionDataConverter.ts` 提供了数据格式转换和查询工具:
+
+- `convertRegionData()`: 将后端数据转换为前端格式
+- `findRegionCodes()`: 根据地区名称查找代码
+- `findRegionNames()`: 根据代码查找地区名称
+- `BackendRegionUtils`: 后端数据查询工具类
+
+## 总结
+
+这种双系统架构虽然需要维护两套地区数据,但能够:
+
+1. **提升用户体验**:基本操作响应快速
+2. **支持复杂业务**:满足不同场景的需求
+3. **降低维护成本**:各自使用最适合的技术方案
+4. **保证系统稳定性**:基本功能不依赖网络请求
+
+这是一个经过深思熟虑的架构设计,符合实际业务需求。

+ 218 - 0
src/utils/regionDataConverter.ts

@@ -0,0 +1,218 @@
+// 地区数据格式转换工具
+// 支持双地区数据系统架构:
+// 
+// 1. 供应商基本信息地址选择:
+//    - 使用前端组件库数据(element-china-area-data 或本地 regionData.ts)
+//    - 优点:简单快速,无需网络请求,适合基本地址选择
+//    - 用途:供应商注册地址、办公地址等基本信息
+//
+// 2. 供应区域管理:
+//    - 使用后端数据库数据(通过 chinaAreaList API)
+//    - 优点:支持复杂业务逻辑,数据可动态管理,与业务系统一致
+//    - 用途:供货区域、授权区域等复杂业务场景
+//
+// 这种双系统设计是合理的,各自服务于不同的业务场景
+
+export interface BackendRegionItem {
+  id: number;
+  areaCode: string;
+  areaName: string;
+  parentCode: number;
+  simpleName?: string;
+  level: number;
+  pinYin?: string;
+  dataSource: string;
+  children?: BackendRegionItem[];
+}
+
+export interface FrontendRegionItem {
+  value: string;
+  label: string;
+  children?: FrontendRegionItem[];
+}
+
+/**
+ * 将后端地区数据转换为前端级联选择器需要的格式
+ * 主要用于供应区域管理等复杂业务场景
+ * @param backendData 后端返回的地区数据
+ * @returns 转换后的前端格式数据
+ */
+export function convertRegionData(backendData: BackendRegionItem[]): FrontendRegionItem[] {
+  if (!Array.isArray(backendData)) {
+    console.warn('convertRegionData: 输入数据不是数组格式');
+    return [];
+  }
+
+  return backendData.map(item => {
+    const converted: FrontendRegionItem = {
+      value: item.areaCode,
+      label: item.areaName
+    };
+
+    // 递归转换子级数据
+    if (item.children && item.children.length > 0) {
+      converted.children = convertRegionData(item.children);
+    }
+
+    return converted;
+  });
+}
+
+/**
+ * 根据地区名称查找对应的地区代码
+ * @param regionData 地区数据
+ * @param provinceName 省份名称
+ * @param cityName 城市名称(可选)
+ * @param districtName 区县名称(可选)
+ * @returns 地区代码数组 [省代码, 市代码, 区代码]
+ */
+export function findRegionCodes(
+  regionData: FrontendRegionItem[],
+  provinceName: string,
+  cityName?: string,
+  districtName?: string
+): string[] {
+  const result: string[] = [];
+
+  // 查找省份
+  const province = regionData.find(p => p.label === provinceName);
+  if (!province) {
+    console.warn(`未找到省份: ${provinceName}`);
+    return result;
+  }
+  result.push(province.value);
+
+  // 如果只需要省份代码
+  if (!cityName) {
+    return result;
+  }
+
+  // 查找城市
+  const city = province.children?.find(c => c.label === cityName);
+  if (!city) {
+    console.warn(`未找到城市: ${cityName}`);
+    return result;
+  }
+  result.push(city.value);
+
+  // 如果只需要省市代码
+  if (!districtName) {
+    return result;
+  }
+
+  // 查找区县
+  const district = city.children?.find(d => d.label === districtName);
+  if (!district) {
+    console.warn(`未找到区县: ${districtName}`);
+    return result;
+  }
+  result.push(district.value);
+
+  return result;
+}
+
+/**
+ * 根据地区代码查找对应的地区名称
+ * @param regionData 地区数据
+ * @param codes 地区代码数组 [省代码, 市代码, 区代码]
+ * @returns 地区名称对象 {province, city, district}
+ */
+export function findRegionNames(
+  regionData: FrontendRegionItem[],
+  codes: string[]
+): { province: string; city: string; district: string } {
+  const result = { province: '', city: '', district: '' };
+
+  if (!codes || codes.length === 0) {
+    return result;
+  }
+
+  // 查找省份
+  const province = regionData.find(p => p.value === codes[0]);
+  if (province) {
+    result.province = province.label;
+
+    // 查找城市
+    if (codes.length > 1 && province.children) {
+      const city = province.children.find(c => c.value === codes[1]);
+      if (city) {
+        result.city = city.label;
+
+        // 查找区县
+        if (codes.length > 2 && city.children) {
+          const district = city.children.find(d => d.value === codes[2]);
+          if (district) {
+            result.district = district.label;
+          }
+        }
+      }
+    }
+  }
+
+  return result;
+}
+
+/**
+ * 后端地区数据工具函数
+ * 用于处理供应区域等复杂业务场景的地区数据
+ */
+export class BackendRegionUtils {
+  /**
+   * 根据地区ID查找地区信息
+   * @param regionData 后端地区数据
+   * @param id 地区ID
+   * @returns 地区信息
+   */
+  static findById(regionData: BackendRegionItem[], id: number): BackendRegionItem | null {
+    for (const item of regionData) {
+      if (item.id === id) {
+        return item;
+      }
+      if (item.children) {
+        const found = this.findById(item.children, id);
+        if (found) return found;
+      }
+    }
+    return null;
+  }
+
+  /**
+   * 根据地区代码查找地区信息
+   * @param regionData 后端地区数据
+   * @param areaCode 地区代码
+   * @returns 地区信息
+   */
+  static findByAreaCode(regionData: BackendRegionItem[], areaCode: string): BackendRegionItem | null {
+    for (const item of regionData) {
+      if (item.areaCode === areaCode) {
+        return item;
+      }
+      if (item.children) {
+        const found = this.findByAreaCode(item.children, areaCode);
+        if (found) return found;
+      }
+    }
+    return null;
+  }
+
+  /**
+   * 获取指定级别的地区列表
+   * @param regionData 后端地区数据
+   * @param level 地区级别(1=省,2=市,3=区)
+   * @returns 指定级别的地区列表
+   */
+  static getByLevel(regionData: BackendRegionItem[], level: number): BackendRegionItem[] {
+    const result: BackendRegionItem[] = [];
+    
+    for (const item of regionData) {
+      if (item.level === level) {
+        result.push(item);
+      }
+      if (item.children) {
+        result.push(...this.getByLevel(item.children, level));
+      }
+    }
+    
+    return result;
+  }
+}

+ 121 - 0
src/utils/regionDataTest.ts

@@ -0,0 +1,121 @@
+// 地区数据系统测试工具
+// 用于验证双地区数据系统是否正常工作
+
+import { regionData } from 'element-china-area-data';
+import { chinaAreaList } from '@/api/system/addressarea/index';
+import { convertRegionData, BackendRegionUtils } from './regionDataConverter';
+
+/**
+ * 测试基本信息地址选择系统
+ */
+export function testFrontendRegionData() {
+  console.log('=== 测试基本信息地址选择系统 ===');
+  
+  if (!regionData || !Array.isArray(regionData)) {
+    console.error('❌ 前端地区数据加载失败');
+    return false;
+  }
+  
+  console.log('✅ 前端地区数据加载成功');
+  console.log(`📊 省份数量: ${regionData.length}`);
+  
+  // 测试数据结构
+  const firstProvince = regionData[0];
+  if (firstProvince && firstProvince.value && firstProvince.label && firstProvince.children) {
+    console.log('✅ 数据结构正确');
+    console.log(`📍 示例省份: ${firstProvince.label} (${firstProvince.value})`);
+    
+    const firstCity = firstProvince.children[0];
+    if (firstCity && firstCity.children) {
+      console.log(`📍 示例城市: ${firstCity.label} (${firstCity.value})`);
+      console.log(`📍 示例区县: ${firstCity.children[0]?.label} (${firstCity.children[0]?.value})`);
+    }
+  } else {
+    console.error('❌ 前端地区数据结构异常');
+    return false;
+  }
+  
+  return true;
+}
+
+/**
+ * 测试供应区域管理系统
+ */
+export async function testBackendRegionData() {
+  console.log('=== 测试供应区域管理系统 ===');
+  
+  try {
+    const res = await chinaAreaList();
+    const backendData = res.data;
+    
+    if (!backendData || !Array.isArray(backendData)) {
+      console.error('❌ 后端地区数据加载失败');
+      return false;
+    }
+    
+    console.log('✅ 后端地区数据加载成功');
+    console.log(`📊 省份数量: ${backendData.length}`);
+    
+    // 测试数据结构
+    const firstProvince = backendData[0];
+    if (firstProvince && firstProvince.id && firstProvince.areaCode && firstProvince.areaName) {
+      console.log('✅ 数据结构正确');
+      console.log(`📍 示例省份: ${firstProvince.areaName} (${firstProvince.areaCode})`);
+      
+      if (firstProvince.children && firstProvince.children.length > 0) {
+        const firstCity = firstProvince.children[0];
+        console.log(`📍 示例城市: ${firstCity.areaName} (${firstCity.areaCode})`);
+      }
+    } else {
+      console.error('❌ 后端地区数据结构异常');
+      return false;
+    }
+    
+    // 测试数据转换
+    const convertedData = convertRegionData(backendData);
+    if (convertedData && convertedData.length > 0) {
+      console.log('✅ 数据转换成功');
+      console.log(`📊 转换后数据量: ${convertedData.length}`);
+    } else {
+      console.error('❌ 数据转换失败');
+      return false;
+    }
+    
+    // 测试工具函数
+    const beijingData = BackendRegionUtils.findByAreaCode(backendData, 'CN11');
+    if (beijingData) {
+      console.log(`✅ 工具函数测试成功: 找到 ${beijingData.areaName}`);
+    }
+    
+    return true;
+  } catch (error) {
+    console.error('❌ 后端地区数据测试失败:', error);
+    return false;
+  }
+}
+
+/**
+ * 运行完整的地区数据系统测试
+ */
+export async function runRegionDataTests() {
+  console.log('🚀 开始地区数据系统测试...');
+  
+  const frontendTest = testFrontendRegionData();
+  const backendTest = await testBackendRegionData();
+  
+  if (frontendTest && backendTest) {
+    console.log('🎉 所有测试通过!双地区数据系统工作正常');
+    return true;
+  } else {
+    console.log('❌ 部分测试失败,请检查相关配置');
+    return false;
+  }
+}
+
+// 在开发环境下可以手动运行测试
+if (import.meta.env.DEV) {
+  // 可以在控制台运行: runRegionDataTests()
+  (window as any).runRegionDataTests = runRegionDataTests;
+  (window as any).testFrontendRegionData = testFrontendRegionData;
+  (window as any).testBackendRegionData = testBackendRegionData;
+}

+ 191 - 0
src/utils/supplyAreaDebug.ts

@@ -0,0 +1,191 @@
+// 供货区域调试工具
+// 用于调试供货区域选择和回显的问题
+
+/**
+ * 调试级联选择器的数据结构
+ */
+export function debugCascaderData(data: any[], title: string = '级联数据') {
+  console.log(`=== ${title} ===`);
+  console.log('数据总数:', data.length);
+  
+  if (data.length > 0) {
+    const firstItem = data[0];
+    console.log('第一项结构:', {
+      areaCode: firstItem.areaCode,
+      areaName: firstItem.areaName,
+      level: firstItem.level,
+      hasChildren: !!firstItem.children,
+      childrenCount: firstItem.children?.length || 0
+    });
+    
+    if (firstItem.children && firstItem.children.length > 0) {
+      const firstChild = firstItem.children[0];
+      console.log('第一个子项结构:', {
+        areaCode: firstChild.areaCode,
+        areaName: firstChild.areaName,
+        level: firstChild.level,
+        parentCode: firstChild.parentCode
+      });
+    }
+  }
+}
+
+/**
+ * 调试选中路径的格式
+ */
+export function debugSelectedPaths(paths: any[], title: string = '选中路径') {
+  console.log(`=== ${title} ===`);
+  console.log('路径总数:', paths.length);
+  
+  paths.forEach((path, index) => {
+    if (Array.isArray(path)) {
+      console.log(`路径 ${index + 1}:`, {
+        length: path.length,
+        provinceCode: path[0],
+        cityCode: path[1],
+        path: path
+      });
+    } else {
+      console.log(`路径 ${index + 1} (非数组):`, path);
+    }
+  });
+}
+
+/**
+ * 调试保存的区域数据
+ */
+export function debugSavedAreaData(data: any[], title: string = '保存的区域数据') {
+  console.log(`=== ${title} ===`);
+  console.log('数据总数:', data.length);
+  
+  const provinces = data.filter(item => item.level === 1 || item.level === '1');
+  const cities = data.filter(item => item.level === 2 || item.level === '2');
+  
+  console.log('省份数量:', provinces.length);
+  console.log('城市数量:', cities.length);
+  
+  provinces.forEach(province => {
+    const provinceCities = cities.filter(city => city.parentCode === province.areaCode);
+    console.log(`${province.areaName} (${province.areaCode}):`, 
+      provinceCities.map(city => `${city.areaName}(${city.areaCode})`).join(', ') || '无城市'
+    );
+  });
+}
+
+/**
+ * 验证级联选择器配置
+ */
+export function validateCascaderProps(props: any) {
+  console.log('=== 级联选择器配置验证 ===');
+  console.log('配置:', props);
+  
+  const requiredProps = ['value', 'label', 'children'];
+  const missingProps = requiredProps.filter(prop => !props[prop]);
+  
+  if (missingProps.length > 0) {
+    console.error('缺少必要配置:', missingProps);
+  } else {
+    console.log('✓ 配置完整');
+  }
+  
+  if (props.multiple) {
+    console.log('✓ 多选模式');
+  }
+  
+  if (props.checkStrictly) {
+    console.log('⚠️ 严格模式 - 父子不关联');
+  } else {
+    console.log('✓ 关联模式 - 父子关联');
+  }
+}
+
+/**
+ * 模拟级联选择器的选择过程
+ */
+export function simulateSelection(
+  supplyAreaOptions: any[], 
+  targetProvinces: string[], 
+  targetCities: { [provinceCode: string]: string[] }
+) {
+  console.log('=== 模拟选择过程 ===');
+  console.log('目标省份:', targetProvinces);
+  console.log('目标城市:', targetCities);
+  
+  const selectedPaths: any[] = [];
+  
+  targetProvinces.forEach(provinceName => {
+    // 查找省份
+    const province = supplyAreaOptions.find(p => p.areaName === provinceName);
+    if (!province) {
+      console.error(`未找到省份: ${provinceName}`);
+      return;
+    }
+    
+    const provinceCode = province.areaCode;
+    const cities = targetCities[provinceName] || [];
+    
+    if (cities.length === 0) {
+      // 只选择省份
+      selectedPaths.push([provinceCode]);
+      console.log(`选择省份: ${provinceName} (${provinceCode})`);
+    } else {
+      // 选择省份下的城市
+      cities.forEach(cityName => {
+        const city = province.children?.find((c: any) => c.areaName === cityName);
+        if (city) {
+          selectedPaths.push([provinceCode, city.areaCode]);
+          console.log(`选择城市: ${provinceName} > ${cityName} (${provinceCode}, ${city.areaCode})`);
+        } else {
+          console.error(`未找到城市: ${provinceName} > ${cityName}`);
+        }
+      });
+    }
+  });
+  
+  console.log('生成的选择路径:', selectedPaths);
+  return selectedPaths;
+}
+
+/**
+ * 完整的调试流程
+ */
+export function debugSupplyAreaFlow(
+  supplyAreaOptions: any[],
+  savedAreaData: any[],
+  selectedPaths: any[]
+) {
+  console.log('🔍 === 供货区域完整调试 ===');
+  
+  // 1. 调试数据源
+  debugCascaderData(supplyAreaOptions, '供货区域选项数据');
+  
+  // 2. 调试保存的数据
+  debugSavedAreaData(savedAreaData, '后端保存的数据');
+  
+  // 3. 调试选中路径
+  debugSelectedPaths(selectedPaths, '当前选中路径');
+  
+  // 4. 验证配置
+  validateCascaderProps({
+    multiple: true,
+    checkStrictly: false,
+    value: 'areaCode',
+    label: 'areaName',
+    children: 'children',
+    emitPath: true
+  });
+  
+  console.log('🔍 === 调试完成 ===');
+}
+
+// 在开发环境下暴露到全局
+if (import.meta.env.DEV) {
+  (window as any).debugSupplyArea = {
+    debugCascaderData,
+    debugSelectedPaths,
+    debugSavedAreaData,
+    validateCascaderProps,
+    simulateSelection,
+    debugSupplyAreaFlow
+  };
+}

+ 98 - 0
src/views/supplier/aptitude/index.vue

@@ -258,19 +258,30 @@
 
 <script setup lang="ts">
 import { ref, onMounted } from 'vue';
+import { useRoute } from 'vue-router';
 import { ElMessage, ElMessageBox } from 'element-plus';
 import { listQualification, addQualification, updateQualification, delQualification } from '@/api/supplier/qualification';
 import type { QualificationVO, QualificationForm, QualificationQuery } from '@/api/supplier/qualification/types';
 import { listByIds } from '@/api/system/oss';
+import { getInfo, getInfoTemporary, updateInfo } from '@/api/supplier/info';
 import FileUpload from '@/components/FileUpload/index.vue';
 
 defineOptions({
   name: 'Aptitude'
 });
 
+const route = useRoute();
+
+const route = useRoute();
+
 const qualificationList = ref<QualificationVO[]>([]);
 const loading = ref(false);
 
+// 供应商相关
+const supplierId = ref<string | number>('');
+const isEditMode = ref(false); // 是否为编辑模式
+const supplierInfo = ref<any>({}); // 供应商基础信息
+
 // 分页参数
 const pagination = ref({
   pageNum: 1,
@@ -487,10 +498,20 @@ const handleSubmit = async () => {
       // 编辑
       await updateQualification(formData.value);
       ElMessage.success('更新成功');
+      
+      // 如果是编辑模式,需要同步更新供应商主表信息
+      if (isEditMode.value && supplierId.value) {
+        await syncSupplierInfo();
+      }
     } else {
       // 新增
       await addQualification(formData.value);
       ElMessage.success('新增成功');
+      
+      // 如果是编辑模式,需要同步更新供应商主表信息
+      if (isEditMode.value && supplierId.value) {
+        await syncSupplierInfo();
+      }
     }
     
     dialogVisible.value = false;
@@ -503,6 +524,57 @@ const handleSubmit = async () => {
   }
 };
 
+/** 同步更新供应商主表信息(编辑模式下) */
+const syncSupplierInfo = async () => {
+  if (!isEditMode.value || !supplierId.value) {
+    return;
+  }
+  
+  try {
+    // 先查询临时表
+    const tempRes = await getInfoTemporary(supplierId.value);
+    let submitData: any;
+    
+    if (tempRes.data) {
+      // 临时表已有记录,使用临时表数据作为基础
+      const tempData = tempRes.data;
+      submitData = {
+        ...tempData,  // 临时表中的数据(保留之前的所有修改)
+        ...supplierInfo.value,  // 当前供应商基础信息
+        supplierType: String(supplierInfo.value.supplierType || tempData.supplierType),
+        cooperateLevel: String(supplierInfo.value.cooperateLevel || tempData.cooperateLevel),
+        supplyStatus: "4"
+      };
+    } else {
+      // 临时表没有记录,使用当前数据
+      submitData = {
+        ...supplierInfo.value,
+        supplierType: String(supplierInfo.value.supplierType),
+        cooperateLevel: String(supplierInfo.value.cooperateLevel),
+        supplyStatus: "4"
+      };
+    }
+    
+    // 删除后端返回的展示字段
+    delete submitData.supplierTypeName;
+    delete submitData.cooperateLevelName;
+    delete submitData.membershipSizeName;
+    delete submitData.industrCategoryName;
+    delete submitData.productManager;
+    delete submitData.buyer;
+    delete submitData.brandName;
+    delete submitData.province;
+    delete submitData.city;
+    
+    // 更新主表信息
+    await updateInfo(submitData);
+    console.log('供应商主表信息已同步更新');
+  } catch (e) {
+    console.error('同步供应商主表信息失败:', e);
+    // 不抛出错误,避免影响资质保存成功的提示
+  }
+};
+
 /** 重置表单 */
 const resetForm = () => {
   formData.value = {
@@ -543,8 +615,34 @@ const formatDate = (dateStr: string) => {
 };
 
 onMounted(() => {
+  // 从路由参数获取供应商ID和模式
+  const id = route.query.id as string;
+  const mode = route.query.mode as string;
+  
+  if (id) {
+    supplierId.value = id;
+    // 判断是否为编辑模式
+    isEditMode.value = mode === 'edit';
+    
+    // 获取供应商基础信息
+    getSupplierInfo();
+  }
+  
   getQualificationList();
 });
+
+/** 获取供应商基础信息 */
+const getSupplierInfo = async () => {
+  if (!supplierId.value) return;
+  
+  try {
+    const res = await getInfo(supplierId.value);
+    supplierInfo.value = res.data;
+    console.log('供应商基础信息:', supplierInfo.value);
+  } catch (e) {
+    console.error('获取供应商基础信息失败:', e);
+  }
+};
 </script>
 
 <style scoped>

+ 126 - 102
src/views/supplier/info/index.vue

@@ -286,11 +286,6 @@
 
               
             </el-table>
-
-            <!-- 空状态 -->
-            <div v-if="paymentInfoList.length === 0" style="text-align: center; padding: 40px; color: #999;">
-              暂无付款信息
-            </div>
           </div>
         </div>
       </el-tab-pane>
@@ -1221,6 +1216,7 @@ import { InvoiceTypeVO } from '@/api/system/invoiceType/types';
 import { listBank as listSystemBank } from '@/api/system/bank';
 import { BankVO as SystemBankVO } from '@/api/system/bank/types';
 import { listByIds } from '@/api/system/oss';
+import { debugSupplyAreaFlow } from '@/utils/supplyAreaDebug';
 
 const route = useRoute();
 const router = useRouter();
@@ -1305,7 +1301,7 @@ const supplyAreaOptions = ref<any[]>([]); // 供货区域选项(从接口获
 const savedAreaData = ref<any[]>([]); // 已保存的供货区域数据
 const cascaderProps = {
   multiple: true,
-  checkStrictly: true, // 改为 true,允许选择任意级别
+  checkStrictly: false, // 改为 false,确保父子级联动正确
   value: 'areaCode',
   label: 'areaName',
   children: 'children',
@@ -1321,7 +1317,7 @@ const regionCascaderProps = {
 };
 
 // 详细地址级联选择器相关
-const regionOptions = ref<any[]>([]); // 省市区级联选择器选项
+const regionOptions = ref<any[]>([]); // 省市区级联选择器选项(使用前端组件库数据)
 const selectedOfficeRegion = ref<string[]>([]); // 选中的省市区代码数组
 
 // 品牌相关数据
@@ -1678,7 +1674,7 @@ const handlePersonImageConfirm = (files: any[]) => {
 /** 初始化省市区级联选择器数据 */
 const initRegionOptions = async () => {
   try {
-    // 使用 element-china-area-data 提供的地区数据
+    // 基本信息地址选择使用前端组件库数据(简单快速)
     regionOptions.value = regionData;
     console.log('省市区数据加载完成:', regionOptions.value.length);
   } catch (e) {
@@ -2360,39 +2356,39 @@ const getSupplyAreaList = async () => {
     // 保存原始数据,用于编辑时回显
     savedAreaData.value = res.data || res.rows || [];
     
-    // 处理返回的数据,按层级组织
+    // 处理返回的数据,按层级组织显示
     const areaData = savedAreaData.value;
     
-    // 第一步:先收集所有省份
-    const provinceMap: any = {};
+    // 按省份分组
+    const provinceMap = new Map<string, { province: string; cities: string[] }>();
+    
+    // 先处理省份
     areaData.forEach((area: any) => {
-      if (area.level === '1' || area.level === 1) {
-        provinceMap[area.areaCode] = {
-          province: area.areaName,
-          city: ''
-        };
+      if (area.level === 1 || area.level === '1') {
+        if (!provinceMap.has(area.areaCode)) {
+          provinceMap.set(area.areaCode, {
+            province: area.areaName,
+            cities: []
+          });
+        }
       }
     });
     
-    // 第二步:将城市添加到对应的省份
+    // 再处理城市
     areaData.forEach((area: any) => {
-      if (area.level === '2' || area.level === 2) {
+      if (area.level === 2 || area.level === '2') {
         const parentCode = area.parentCode;
-        if (provinceMap[parentCode]) {
-          // 将城市添加到省份的城市列表中
-          if (provinceMap[parentCode].city) {
-            provinceMap[parentCode].city += ',' + area.areaName;
-          } else {
-            provinceMap[parentCode].city = area.areaName;
-          }
+        if (provinceMap.has(parentCode)) {
+          provinceMap.get(parentCode)!.cities.push(area.areaName);
         }
       }
     });
     
-    // 转换为数组
-    supplyAreaList.value = Object.values(provinceMap).filter((item: any) => 
-      item.province || item.city
-    );
+    // 转换为显示格式
+    supplyAreaList.value = Array.from(provinceMap.values()).map(item => ({
+      province: item.province,
+      city: item.cities.join(', ') || '' // 用逗号分隔多个城市
+    }));
     
     console.log('供货区域列表:', supplyAreaList.value);
     console.log('保存的原始数据:', savedAreaData.value);
@@ -2405,27 +2401,53 @@ const getSupplyAreaList = async () => {
 const handleEditSupplyArea = async () => {
   supplyAreaDialogVisible.value = true;
 
+  // 调试:打印完整的调试信息
+  if (import.meta.env.DEV) {
+    debugSupplyAreaFlow(supplyAreaOptions.value, savedAreaData.value, []);
+  }
+
   // 根据已保存的数据回显选中状态
   if (savedAreaData.value && savedAreaData.value.length > 0) {
     const selectedPaths: any[] = [];
     
-    // 遍历已保存的数据,构建级联选择器需要的路径格式
+    // 按省份分组处理
+    const provinceMap = new Map<string, string[]>();
+    
+    // 先收集所有省份和对应的城市
     savedAreaData.value.forEach((area: any) => {
-      if (area.level === '2') {
-        // 市级数据,需要找到对应的省份
-        const province = savedAreaData.value.find((p: any) => 
-          p.level === '1' && p.areaCode === area.parentCode
-        );
-        
-        if (province) {
-          // 构建路径 [省代码, 市代码]
-          selectedPaths.push([province.areaCode, area.areaCode]);
+      if (area.level === 1 || area.level === '1') {
+        // 省份级别
+        if (!provinceMap.has(area.areaCode)) {
+          provinceMap.set(area.areaCode, []);
         }
+      } else if (area.level === 2 || area.level === '2') {
+        // 城市级别,找到对应的省份
+        const parentCode = area.parentCode;
+        if (!provinceMap.has(parentCode)) {
+          provinceMap.set(parentCode, []);
+        }
+        provinceMap.get(parentCode)!.push(area.areaCode);
+      }
+    });
+    
+    // 构建级联选择器需要的路径格式
+    provinceMap.forEach((cityCodes, provinceCode) => {
+      if (cityCodes.length === 0) {
+        // 只选择了省份,没有选择城市
+        selectedPaths.push([provinceCode]);
+      } else {
+        // 选择了省份下的城市
+        cityCodes.forEach(cityCode => {
+          selectedPaths.push([provinceCode, cityCode]);
+        });
       }
     });
     
     selectedSupplyAreas.value = selectedPaths;
+    console.log('=== 供货区域回显 ===');
     console.log('回显的选中路径:', selectedPaths);
+    console.log('原始保存的数据:', savedAreaData.value);
+    console.log('省份映射:', Array.from(provinceMap.entries()));
   } else {
     selectedSupplyAreas.value = [];
   }
@@ -2473,6 +2495,9 @@ const handleSupplyAreaSubmit = async () => {
     supplyAreaSubmitLoading.value = true;
 
     let id = route.query.id as string;
+    // 判断是否为供应商自己编辑(没有URL参数id,使用userStore.supplierId)
+    const isSupplierSelfEdit = !id && userStore.supplierId;
+    
     if (!id && userStore.supplierId) {
       id = String(userStore.supplierId);
     }
@@ -2481,17 +2506,21 @@ const handleSupplyAreaSubmit = async () => {
       return;
     }
 
+    console.log('=== 提交供货区域 ===');
+    console.log('选中的路径:', selectedSupplyAreas.value);
+
     // 构建 areaList 数组
     const areaList = buildAreaList(selectedSupplyAreas.value);
     console.log('构建的 areaList:', areaList);
 
     // 从选中的路径中提取区域信息(用于显示)
     const regionData = extractRegionData(selectedSupplyAreas.value);
+    console.log('提取的区域数据:', regionData);
 
     // 保存区域代码(用于下次编辑时回显)
     const regionCodes = regionData.districtCodes.join(',');
 
-    const submitData = {
+    const submitData: any = {
       supplierId: id,
       supplyNo: detailData.value.supplierNo,
       areaList: areaList, // 传递 areaList 数组
@@ -2499,10 +2528,16 @@ const handleSupplyAreaSubmit = async () => {
       city: regionData.cities,
       supplyRegions: regionCodes
     };
+
+    // 供应商自己编辑时添加 supplyStatus=4
+    if (isSupplierSelfEdit) {
+      submitData.supplyStatus = "4";
+      console.log('供应商自己编辑,添加 supplyStatus=4');
+    }
     
     console.log('提交的数据:', submitData);
 
-    await addArea(submitData as any);
+    await addArea(submitData);
 
     // 更新本地数据
     (detailData.value as any).province = regionData.provinces;
@@ -2510,15 +2545,11 @@ const handleSupplyAreaSubmit = async () => {
     (detailData.value as any).district = '';
     (detailData.value as any).supplyRegions = regionCodes;
 
-    // 更新供货区域列表显示
-    supplyAreaList.value = [{
-      province: regionData.provinces,
-      city: regionData.cities,
-      district: ''
-    }];
-
     ElMessage({ message: '保存成功', type: 'info' });
     supplyAreaDialogVisible.value = false;
+    
+    // 重新获取供货区域列表以刷新显示
+    await getSupplyAreaList();
   } catch (e) {
     console.error('保存供货区域失败:', e);
     ElMessage.error('保存失败');
@@ -2534,26 +2565,28 @@ const extractRegionData = (selectedPaths: any[]) => {
   const cityCodes: string[] = [];
 
   selectedPaths.forEach(path => {
-    if (Array.isArray(path) && path.length >= 2) {
-      const [provinceCode, cityCode] = path;
-      
-      // 保存城市代码
-      if (cityCode) {
-        cityCodes.push(cityCode);
-      }
+    if (Array.isArray(path)) {
+      const provinceCode = path[0];
+      const cityCode = path[1];
       
-      // 查找对应的名称
-      const provinceName = findRegionName(provinceCode, supplyAreaOptions.value);
+      // 查找省份信息
       const province = supplyAreaOptions.value.find(p => p.areaCode === provinceCode);
-      const cityName = province && cityCode ? findRegionName(cityCode, province.children || []) : '';
-
+      const provinceName = province ? province.areaName : '';
+      
       if (provinceName) {
         if (!provinceMap.has(provinceName)) {
           provinceMap.set(provinceName, new Set());
         }
         
-        if (cityName) {
-          provinceMap.get(provinceName)!.add(cityName);
+        // 如果有城市代码,处理城市
+        if (cityCode) {
+          cityCodes.push(cityCode);
+          const city = province?.children?.find((c: any) => c.areaCode === cityCode);
+          const cityName = city ? city.areaName : '';
+          
+          if (cityName) {
+            provinceMap.get(provinceName)!.add(cityName);
+          }
         }
       }
     }
@@ -2565,7 +2598,11 @@ const extractRegionData = (selectedPaths: any[]) => {
 
   provinceMap.forEach((citySet, provinceName) => {
     provinces.push(provinceName);
-    cities.push(Array.from(citySet).join(','));
+    if (citySet.size > 0) {
+      cities.push(Array.from(citySet).join(','));
+    } else {
+      cities.push(''); // 如果只选择了省份,城市为空
+    }
   });
 
   return {
@@ -2585,62 +2622,49 @@ const findRegionName = (code: string, regions: any[]): string => {
 /** 构建 areaList 数组 */
 const buildAreaList = (selectedPaths: any[]) => {
   const areaList: any[] = [];
-  const provinceMap = new Map<string, Set<string>>(); // 省份代码 -> 城市代码集合
   const addedProvinces = new Set<string>(); // 已添加的省份
+  const addedCities = new Set<string>(); // 已添加的城市
 
   console.log('选中的路径:', selectedPaths);
 
-  // 第一步:收集所有选中的省份和城市
   selectedPaths.forEach(path => {
     if (Array.isArray(path)) {
       const provinceCode = path[0];
       const cityCode = path[1];
       
-      if (!provinceMap.has(provinceCode)) {
-        provinceMap.set(provinceCode, new Set());
-      }
+      // 查找省份信息
+      const province = supplyAreaOptions.value.find(p => p.areaCode === provinceCode);
       
-      // 如果有城市代码,添加到集合中
-      if (cityCode) {
-        provinceMap.get(provinceCode)!.add(cityCode);
-      }
-    }
-  });
-
-  console.log('省份映射:', Array.from(provinceMap.entries()));
-
-  // 第二步:构建 areaList 数组
-  provinceMap.forEach((cityCodes, provinceCode) => {
-    // 查找省份信息
-    const province = supplyAreaOptions.value.find(p => p.areaCode === provinceCode);
-    
-    if (province) {
-      // 添加省份(每个省份只添加一次)
-      if (!addedProvinces.has(provinceCode)) {
-        areaList.push({
-          areaCode: province.areaCode,
-          areaName: province.areaName,
-          level: 1
-        });
-        addedProvinces.add(provinceCode);
-      }
-
-      // 添加该省份下所有选中的城市
-      cityCodes.forEach(cityCode => {
-        const city = province.children?.find((c: any) => c.areaCode === cityCode);
-        
-        if (city) {
+      if (province) {
+        // 添加省份(每个省份只添加一次)
+        if (!addedProvinces.has(provinceCode)) {
           areaList.push({
-            areaCode: city.areaCode,
-            areaName: city.areaName,
-            parentCode: province.areaCode, // 使用省份的 areaCode 作为 parentCode
-            level: 2
+            areaCode: province.areaCode,
+            areaName: province.areaName,
+            level: 1
           });
+          addedProvinces.add(provinceCode);
         }
-      });
+
+        // 如果有城市代码,添加城市
+        if (cityCode) {
+          const city = province.children?.find((c: any) => c.areaCode === cityCode);
+          
+          if (city && !addedCities.has(cityCode)) {
+            areaList.push({
+              areaCode: city.areaCode,
+              areaName: city.areaName,
+              parentCode: province.areaCode,
+              level: 2
+            });
+            addedCities.add(cityCode);
+          }
+        }
+      }
     }
   });
 
+  console.log('构建的 areaList:', areaList);
   return areaList;
 };