From 40a28f38cba90645d13b8f43e0ebd9a238c08c5a Mon Sep 17 00:00:00 2001 From: Zzz1zz Date: Thu, 31 Jul 2025 23:43:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=A4=A7=E5=8C=85?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=BC=95=E5=85=A5=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/business.ts | 46 +++-- src/api/setting.ts | 3 +- src/types/business.ts | 161 ++++++++++-------- src/types/comm.ts | 32 ++++ src/types/setting.ts | 49 ++---- src/utils/constant.ts | 7 + .../project/drawer/project-form-drawer.vue | 122 +++++++++++++ src/views/business/project/index.vue | 118 ++++--------- .../contract-settings/contract-number.vue | 3 +- .../contract-settings/contract-terms.vue | 3 +- .../drawer/contract-terms-form-drawer.vue | 7 +- .../components/label-form-modal.vue | 3 +- .../components/project-card.vue | 7 +- .../data-dictionary/components/room-card.vue | 3 +- .../components/tenant-card.vue | 5 +- .../finance-settings/fee-management-table.vue | 3 +- src/views/setting/user/list.vue | 8 +- 17 files changed, 351 insertions(+), 229 deletions(-) create mode 100644 src/types/comm.ts create mode 100644 src/views/business/project/drawer/project-form-drawer.vue diff --git a/src/api/business.ts b/src/api/business.ts index 79cd2c5..9fb62f5 100644 --- a/src/api/business.ts +++ b/src/api/business.ts @@ -1,4 +1,12 @@ import axios from 'axios'; +import { + AllProjectListRes, + ProjectListRes, + CreateProjectParam, + ProjectDetailRes, +} from '@/types/business'; +import { PaginationParams } from '@/types/comm'; +import { HttpResponse } from './interceptor'; // import type { RouteRecordNormalized } from 'vue-router'; // import { UserState } from '@/store/modules/user/types'; @@ -8,21 +16,29 @@ export interface ProjectRecord { type: string; } -export interface ProjectParams extends Partial { - current: number; - pageSize: number; -} - -// 全部项目列表 -export function getAllProjectList() { - return axios.get('/project/getAllProjectList'); -} - -// 项目信息 -export function getProjectDetail(id: string) { - return axios.get(`/project/getProject?id=${id}`); +// 全部项目列表(包含楼栋) +export function getAllProjectList(): Promise { + return axios.get(`project/getProjectBuildingList`); } // 项目列表(分页) -export function queryPolicyList(params: ProjectParams) { - return axios.post('/project/getProjectList', { params }); +export function getProjectList( + params: PaginationParams +): Promise { + return axios.post('project/getProjectList', params); +} +// 创建项目 +export function createProject( + params: CreateProjectParam +): Promise { + return axios.post('project/createProject', params); +} +// 项目信息 +export function getProjectDetail(id: number): Promise { + return axios.get(`project/getProject?id=${id}`); +} +// 更新项目 +export function updateProject( + params: CreateProjectParam +): Promise { + return axios.post('project/updateProject', params); } diff --git a/src/api/setting.ts b/src/api/setting.ts index 5606fee..59407a4 100644 --- a/src/api/setting.ts +++ b/src/api/setting.ts @@ -4,7 +4,6 @@ import { DepartmentFormRes, DepartmentListRes, DepartmentDetailRes, - PaginationParams, AllUserListRes, FormUserItem, UserInfoRes, @@ -27,7 +26,6 @@ import { SettingRoomTagsRes, SettingRoomTagRes, SettingTenantDictionaryRes, - TenantDictionaryType, SettingContractNumbeRes, CreateCodeSettingParam, FeeManagementListRes, @@ -38,6 +36,7 @@ import { SettingContractTermListRes, SettingContractTermInfo, } from '@/types/setting'; +import { PaginationParams, TenantDictionaryType } from '@/types/comm'; import { HttpResponse } from './interceptor'; // ==================== 部门相关 API ==================== diff --git a/src/types/business.ts b/src/types/business.ts index 767018d..ee02374 100644 --- a/src/types/business.ts +++ b/src/types/business.ts @@ -1,75 +1,96 @@ -// 项目类型常量定义 -export const PROJECT_TYPE = { - COMMERCIAL_COMPLEX: '1', - OFFICE_BUILDING: '2', - INDUSTRIAL_PARK: '3', -} as const; +import { HttpResponse } from '@/api/interceptor'; +import { + PaginationParams, + PaginationResult, + BaseEntity, + DeleteStatus, + UserStatus, + ProjectType, +} from './comm'; -// 租户状态常量 -export const TENANT_STATUS = { - ACTIVE: 'active', - EXPIRED: 'expired', - PENDING: 'pending', -} as const; - -// 合同状态常量 -export const CONTRACT_STATUS = { - DRAFT: 'draft', - ACTIVE: 'active', - EXPIRED: 'expired', - TERMINATED: 'terminated', -} as const; - -// 类型定义 -export type ProjectType = (typeof PROJECT_TYPE)[keyof typeof PROJECT_TYPE]; -export type TenantStatus = (typeof TENANT_STATUS)[keyof typeof TENANT_STATUS]; -export type ContractStatus = - (typeof CONTRACT_STATUS)[keyof typeof CONTRACT_STATUS]; - -// 项目相关类型定义 -export interface ProjectRecord { - id?: string; - name: string; - type: ProjectType; - size: string; - kezu: string; - rate: number; - count: string; - create_time: string; +export interface BuildingItem { + id?: string; // 楼栋id + name: string; // 楼栋名称 + up_floor?: number; // 地上层数 + down_floor?: number; // 地下层数 +} +export interface AllProjectsItem { + id: number; // 项目id + name: string; // 项目名称 + buildings: BuildingItem[]; +} +export interface ProjectItem extends BaseEntity { + systemTenantId?: number; + name: string; // 项目名称 + type: number; + provinceId: number; + cityId: number; + districtId: number; + address: string; + images: string[]; + createUserId: number; + isDelete: DeleteStatus; + status: UserStatus; + imageUrls: string[]; + typeName: string; // 类型名称 + district: string; + province: string; + city: string; + roomNum: number; + roomArea: number; + rentArea: number; + useArea: number; + rentRate: number; + RoomAreaStr: string; // 列表显示的计租面积 + RentAreaStr: string; // 列表显示的招商面积 + RentRateStr: string; // 列表显示的出租率 } -export const PROJECT_TYPE_COLORS: Record = { - [PROJECT_TYPE.COMMERCIAL_COMPLEX]: 'orangered', - [PROJECT_TYPE.OFFICE_BUILDING]: 'green', - [PROJECT_TYPE.INDUSTRIAL_PARK]: 'gold', -}; - -export const PROJECT_TYPE_LABELS: Record = { - [PROJECT_TYPE.COMMERCIAL_COMPLEX]: '商业综合体', - [PROJECT_TYPE.OFFICE_BUILDING]: '写字楼', - [PROJECT_TYPE.INDUSTRIAL_PARK]: '园区', -}; - -// 租户相关类型 -export interface TenantRecord { - id: string; - name: string; - phone: string; - email?: string; - contractStartDate: string; - contractEndDate: string; - projectId: string; - status: TenantStatus; +export type AllProjectListRes = HttpResponse<{ + projectsList: AllProjectsItem[]; +}>; +export type ProjectListRes = HttpResponse<{ + page: PaginationParams & PaginationResult; + projectsList?: ProjectItem[]; +}>; +export interface CreateProjectParam { + id?: number; + type: ProjectType; // 项目类型:1写字楼,2商业综合体,3园区 + name: string; // 楼栋名称 + province_id: number; // 省份id + city_id: number; // 城市id + district_id: number; // 区域id + address: string; // 详细地址 + images: string[]; // 图片数组 + buildings: BuildingItem[]; // 楼栋数据 +} +export interface BuildingInfo extends BaseEntity { + projectId: number; // 项目id + name: string; // 楼栋名称 + upfloor: number; // 地上层数 + downFloor: number; // 地下层数 + createUserId: number; + isDelete: DeleteStatus; + status: UserStatus; // 状态:1启用,2禁用 +} +export interface ProjectInfo extends BaseEntity { + systemTenantId: 17; // 租户id + name: string; // 项目名称 + type: ProjectType; // 类型:1写字楼,2商业综合体,3园区 + provinceId: number; // 省份id + cityId: number; // 城市id + districtId: number; // 区id + address: string; // 详细地址 + images: string[]; + createUserId: number; // 创建人id + isDelete: DeleteStatus; + status: UserStatus; // 状态:1 启用,2 禁用 + imagesUrl: string[]; // 图片数组 + typeName: string; // 类型名称 + province: string; // 省份 + city: string; // 城市 + district: string; // 区 + buildings: BuildingInfo[]; // 楼栋数组 } -// 合同相关类型 -export interface ContractRecord { - id: string; - contractNo: string; - tenantId: string; - projectId: string; - startDate: string; - endDate: string; - rentAmount: number; - status: ContractStatus; -} +export type ProjectDetailRes = ProjectInfo; diff --git a/src/types/comm.ts b/src/types/comm.ts new file mode 100644 index 0000000..8e2e4de --- /dev/null +++ b/src/types/comm.ts @@ -0,0 +1,32 @@ +// ==================== 通用类型定义 ==================== +export interface BaseEntity { + id: number; + createdAt: string; + updatedAt: string; +} +export interface PaginationParams { + keyword?: string; + role_id?: number | null; + page?: number; + page_size?: number; +} + +export interface PaginationResult { + total?: number; + total_pages?: number; +} + +export type UserStatus = 1 | 2; // 1: 启用, 2: 禁用 +export type DataType = 1 | 2 | 3; // 1: 全部数据权限, 2: 自定义数据权限, 3: 仅本人数据 +export type CheckedStatus = 1 | 2; // 是否选择:1是,2否 +export type DeleteStatus = 0 | 1; // 是否选择:1是 0否 +export type ManagerStatus = 1 | 2; // 1: 是主管, 2: 否 +export type ProjectTypeChecked = 0 | 1; // 是否选择:1是 0否 +export type TenantDictionaryType = 1 | 2 | 3 | 4; // 类型:1租客类型,2租客来源,3租客行业分类,4租客企业规模 +export type ContractSettingStatus = 0 | 1; // 0不回收,1回收 +export type delCodeRecycling = 0 | 1; // 删除合同编号回收:0不回收,1回收 +export type cancelCodeRecycling = 0 | 1; // 作废合同编号回收:0不回收,1回收 +export type CommStatus = 1 | 2; // 1:是 2否 +export type FeeManagementType = 1 | 2; // 费项属性:1收入费项,2支出费项 +export type FeeType = 1 | 2 | 3 | 4; // 费项类型:1租赁类,2物业类,3特殊类,4其他类 +export type ProjectType = 1 | 2 | 3; // 项目类型:1写字楼,2商业综合体,3园区 diff --git a/src/types/setting.ts b/src/types/setting.ts index 9d4e737..7603dd8 100644 --- a/src/types/setting.ts +++ b/src/types/setting.ts @@ -1,37 +1,22 @@ import type { UserPermission } from '@/types/api'; import { HttpResponse } from '@/api/interceptor'; -// ==================== 通用类型定义 ==================== -export interface BaseEntity { - id: number; - createdAt: string; - updatedAt: string; -} - -export interface PaginationParams { - keyword?: string; - role_id?: number | null; - page?: number; - page_size?: number; -} - -export interface PaginationResult { - total?: number; - total_pages?: number; -} - -export type UserStatus = 1 | 2; // 1: 启用, 2: 禁用 -export type ManagerStatus = 1 | 2; // 1: 是主管, 2: 否 -export type DataType = 1 | 2 | 3; // 1: 全部数据权限, 2: 自定义数据权限, 3: 仅本人数据 -export type CheckedStatus = 1 | 2; // 是否选择:1是,2否 -export type DeleteStatus = 0 | 1; // 是否选择:1是 0否 -export type ProjectTypeChecked = 0 | 1; // 是否选择:1是 0否 -export type TenantDictionaryType = 1 | 2 | 3 | 4; // 类型:1租客类型,2租客来源,3租客行业分类,4租客企业规模 -export type ContractSettingStatus = 0 | 1; // 0不回收,1回收 -export type delCodeRecycling = 0 | 1; // 删除合同编号回收:0不回收,1回收 -export type cancelCodeRecycling = 0 | 1; // 作废合同编号回收:0不回收,1回收 -export type CommStatus = 1 | 2; // 1:是 2否 -export type FeeManagementType = 1 | 2; // 费项属性:1收入费项,2支出费项 -export type FeeType = 1 | 2 | 3 | 4; // 费项类型:1租赁类,2物业类,3特殊类,4其他类 +import { + BaseEntity, + PaginationParams, + PaginationResult, + UserStatus, + DataType, + CheckedStatus, + DeleteStatus, + ContractSettingStatus, + delCodeRecycling, + CommStatus, + FeeManagementType, + FeeType, + ManagerStatus, + ProjectTypeChecked, + TenantDictionaryType, +} from './comm'; // ==================== 部门相关类型 ==================== export interface DepartmentFormParams { diff --git a/src/utils/constant.ts b/src/utils/constant.ts index 5d42701..f0839fa 100644 --- a/src/utils/constant.ts +++ b/src/utils/constant.ts @@ -8,4 +8,11 @@ export const financeFeeFeriodicityList = [ { value: 1, label: '周期性付款' }, { value: 2, label: '一次性付款' }, ]; + +export const projectTypeList = [ + { value: 1, label: '写字楼' }, + { value: 2, label: '商业综合体' }, + { value: 3, label: '园区' }, +]; + export default {}; diff --git a/src/views/business/project/drawer/project-form-drawer.vue b/src/views/business/project/drawer/project-form-drawer.vue new file mode 100644 index 0000000..3dceef6 --- /dev/null +++ b/src/views/business/project/drawer/project-form-drawer.vue @@ -0,0 +1,122 @@ + + + + + diff --git a/src/views/business/project/index.vue b/src/views/business/project/index.vue index 4358a9f..ee59832 100644 --- a/src/views/business/project/index.vue +++ b/src/views/business/project/index.vue @@ -1,7 +1,7 @@