fix: 修复大包文件引入报错

This commit is contained in:
Zzz1zz
2025-07-31 23:43:28 +08:00
parent ff528ae7ef
commit 40a28f38cb
17 changed files with 351 additions and 229 deletions
+31 -15
View File
@@ -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<ProjectRecord> {
current: number;
pageSize: number;
}
// 全部项目列表
export function getAllProjectList() {
return axios.get<any>('/project/getAllProjectList');
}
// 项目信息
export function getProjectDetail(id: string) {
return axios.get<any>(`/project/getProject?id=${id}`);
// 全部项目列表(包含楼栋)
export function getAllProjectList(): Promise<AllProjectListRes> {
return axios.get(`project/getProjectBuildingList`);
}
// 项目列表(分页)
export function queryPolicyList(params: ProjectParams) {
return axios.post<any>('/project/getProjectList', { params });
export function getProjectList(
params: PaginationParams
): Promise<ProjectListRes> {
return axios.post('project/getProjectList', params);
}
// 创建项目
export function createProject(
params: CreateProjectParam
): Promise<HttpResponse> {
return axios.post('project/createProject', params);
}
// 项目信息
export function getProjectDetail(id: number): Promise<ProjectDetailRes> {
return axios.get(`project/getProject?id=${id}`);
}
// 更新项目
export function updateProject(
params: CreateProjectParam
): Promise<HttpResponse> {
return axios.post('project/updateProject', params);
}
+1 -2
View File
@@ -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 ====================
+91 -70
View File
@@ -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<ProjectType, string> = {
[PROJECT_TYPE.COMMERCIAL_COMPLEX]: 'orangered',
[PROJECT_TYPE.OFFICE_BUILDING]: 'green',
[PROJECT_TYPE.INDUSTRIAL_PARK]: 'gold',
};
export const PROJECT_TYPE_LABELS: Record<ProjectType, string> = {
[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;
+32
View File
@@ -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园区
+17 -32
View File
@@ -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 {
+7
View File
@@ -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 {};
@@ -0,0 +1,122 @@
<template>
<a-drawer
:width="670"
:visible="visible"
:title="isEdit ? '编辑条款设置' : '编辑条款设置'"
unmount-on-close
@ok="handleOk"
@cancel="handleCancel"
>
<a-form
ref="formRef"
:model="form"
:rules="rules"
auto-label-width
layout="vertical"
>
<a-row>
<a-col :span="12">
<!-- 项目名称 -->
<a-form-item label="条款名称" field="name" required>
<a-input
v-model="form.name"
:placeholder="$t('please.enter', { placeholder: '项目名称' })"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<!-- 项目类型 -->
<a-form-item label="项目类型" field="name" required>
<a-select v-model="form.type" placeholder="请选择项目类型">
<a-option
v-for="item in projectTypeList"
:key="item.value"
:value="item.value"
>
{{ item.label }}
</a-option>
</a-select>
</a-form-item>
</a-col>
</a-row>
<!-- 项目地址 -->
<a-form-item label="项目地址" field="type" required>
<!-- <a-space>
<a-select v-model="form.finance_fee_id" :style="{ width: '200px' }" placeholder="请选择省份...">
<a-option v-for="item in financeFeeList" :key="item.id" :value="item.id">
{{ item.name }}
</a-option>
</a-select>
<a-select v-model="form.finance_fee_periodicity" :style="{ width: '200px' }"
:options="financeFeeFeriodicityList" placeholder="请选择..." />
</a-space> -->
</a-form-item>
</a-form>
</a-drawer>
</template>
<script lang="ts" setup>
import { ref, watch, reactive, onMounted } from 'vue';
import type { FormInstance } from '@arco-design/web-vue';
// import { Message } from '@arco-design/web-vue';
import { projectTypeList } from '@/utils/constant';
// import { CreateTermSettingParam, FeeManagement } from '@/types/setting';
// import { FeeManagementType } from '@/types/comm';
const props = defineProps<{
visible: boolean;
isEdit: boolean;
record?: any | null;
}>();
const emit = defineEmits<{
(e: 'update:visible', val: boolean): void;
(e: 'submitted'): void;
}>();
// 表单数据
const formRef = ref<FormInstance>();
const defaultForm: any = {
name: '', // 名称
type: 1, // 条款类型:1租赁类,2物业类,3特殊类,4其他类
is_fee: 1, // 是否勾选费项:1是,2否
finance_fee_id: null, // 财务费项id(除保证金外
finance_fee_periodicity: 1, // 周期性:1周期性付款,2一次性付款
is_bond: 2, // 是否勾选保证金:1是,2否
finance_bond_fee_id: null, // 财务保证金费项id
is_incremental: 2, // 是否勾选递增项:1是,2否
is_discount: 2, // 是否勾选优惠项:1是,2否
is_late_fee: 2, // 是否勾选滞纳金:1是,2否
};
const form = reactive<any>({ ...defaultForm });
// 校验规则
const rules = reactive({
name: [{ required: true, message: '请输入条款名称' }],
type: [{ required: true, message: '请选择条款类别' }],
});
watch(
() => props.visible,
(val) => {
if (val) {
if (props.isEdit && props.record) {
Object.assign(form, props.record);
} else {
Object.assign(form, defaultForm);
}
}
},
{ immediate: true }
);
const handleOk = async () => {};
const handleCancel = () => {
emit('update:visible', false);
};
onMounted(() => {});
</script>
<style lang="less" scoped>
:deep(label.arco-form-item-label) {
width: 100% !important;
}
</style>
+30 -84
View File
@@ -1,7 +1,7 @@
<template>
<div class="business_project_wrap">
<Breadcrumb :items="['menu.business', 'menu.business.project']" />
<a-card class="general-card">
<a-card class="general-card full_height">
<template #title>
<div class="card-title_between">
<p class="title">{{ t('menu.business.project') }}</p>
@@ -33,7 +33,6 @@
</div>
</div>
</template>
<!-- 使用新的 DataTable 组件 -->
<DataTable
:data="renderData"
@@ -45,18 +44,14 @@
@page-change="onPageChange"
@page-size-change="onPageSizeChange"
>
<template #type="{ record }">
<!-- <template #type="{ record }">
<a-tag checkable :color="getTypeColor(record.type)">{{
getTypeText(record.type)
}}</a-tag>
</template>
<template #rate="{ record }">
<a-progress
:percent="record.rate"
color="green"
:style="{ width: '100px' }"
/>
</template>
<a-progress :percent="record.rate" color="green" :style="{ width: '100px' }" />
</template> -->
<template #operate>
<a-space>
<a-button>查看</a-button>
@@ -70,25 +65,19 @@
</template>
<script lang="ts" setup>
import { onMounted } from 'vue';
import { ref, onMounted } from 'vue';
import useLoading from '@/hooks/loading';
import { useI18n } from 'vue-i18n';
import type { TableColumnData } from '@arco-design/web-vue';
import {
ProjectRecord,
ProjectType,
PROJECT_TYPE,
PROJECT_TYPE_COLORS,
PROJECT_TYPE_LABELS,
} from '@/types/business';
// import { getAllProjectList } from '@/api/business';
import useDataTable from '@/composables/useDataTable';
import { ProjectItem } from '@/types/business';
import { getProjectList } from '@/api/business';
const { t } = useI18n();
const { loading } = useLoading(false);
// setLoading
// 使用 DataTable composable
const projectList = ref<ProjectItem[]>([]);
const {
data: renderData,
columns: projectColumn,
@@ -100,46 +89,13 @@
setTotal,
setCurrent,
setPageSize,
setLoading,
} = useDataTable({
initialPage: 1,
initialPageSize: 10,
pageSizeOptions: [10, 20, 50, 100],
});
// 模拟数据
const mockData: ProjectRecord[] = [
{
id: '1',
name: '星河商务中心',
type: PROJECT_TYPE.COMMERCIAL_COMPLEX,
size: '1200m²',
kezu: '1000m²',
rate: 0.2,
count: '90',
create_time: '2025-06-24 00:51',
},
{
id: '2',
name: '南山科学科学院',
type: PROJECT_TYPE.OFFICE_BUILDING,
size: '120m²',
kezu: '100m²',
rate: 0.6,
count: '10',
create_time: '2025-06-24 00:58',
},
{
id: '3',
name: '前海科学科学院',
type: PROJECT_TYPE.INDUSTRIAL_PARK,
size: '1520m²',
kezu: '1500m²',
rate: 0.91,
count: '120',
create_time: '2025-06-24 01:16',
},
];
// 列配置
const columns: TableColumnData[] = [
{ title: '项目信息', dataIndex: 'name', key: 'name' },
@@ -152,42 +108,32 @@
{ title: '操作', key: 'operate', slotName: 'operate', width: 200 },
];
// 初始化数据
onMounted(() => {
setColumns(columns);
setData(mockData);
setTotal(mockData.length);
});
const getTypeColor = (type: ProjectType): string => {
return PROJECT_TYPE_COLORS[type] || 'default';
const getProjectListData = async () => {
const params = {
page: current.value,
page_size: pageSize.value,
};
const getTypeText = (type: ProjectType): string => {
return PROJECT_TYPE_LABELS[type] || '未知';
setLoading(true);
const { code, data } = await getProjectList(params);
if (code === 200 && data) {
const { projectsList, page } = data;
projectList.value = Array.isArray(projectsList) ? projectsList : [];
setTotal(page?.total ? page.total : 0);
}
setLoading(false);
};
// 分页事件处理
const onPageChange = (page: number) => {
setCurrent(page);
// TODO: 这里应该调用API获取对应页码的数据
current.value = page;
};
const onPageSizeChange = (newPageSize: number) => {
setPageSize(newPageSize);
// TODO: 这里应该调用API获取对应页码的数据
const onPageSizeChange = (size: number) => {
setPageSize(size);
pageSize.value = size;
};
// const getAllProjectListData = async () => {
// setLoading(true);
// try {
// await getAllProjectList();
// // 处理数据
// } catch (err) {
// // you can report use errorHandler or other
// } finally {
// setLoading(false);
// }
// };
// getAllProjectListData()
onMounted(() => {
setColumns(columns);
getProjectListData();
});
</script>
@@ -66,7 +66,8 @@
disableCodeSetting,
delCodeSetting,
} from '@/api/setting';
import { ContractTermInfo, UserStatus } from '@/types/setting';
import { ContractTermInfo } from '@/types/setting';
import { UserStatus } from '@/types/comm';
import { camelToSnake } from '@/utils/caseConvert';
import contractNumberFormDrawer from './drawer/contract-number-form-drawer.vue';
@@ -66,7 +66,8 @@
disableTermsSetting,
delTermsSetting,
} from '@/api/setting';
import { TermSettingItem, UserStatus } from '@/types/setting';
import { TermSettingItem } from '@/types/setting';
import { UserStatus } from '@/types/comm';
import contractNumberFormDrawer from './drawer/contract-terms-form-drawer.vue';
const {
@@ -108,11 +108,8 @@
getUseFeeList,
} from '@/api/setting';
import { feeTypeList, financeFeeFeriodicityList } from '@/utils/constant';
import {
FeeManagementType,
CreateTermSettingParam,
FeeManagement,
} from '@/types/setting';
import { CreateTermSettingParam, FeeManagement } from '@/types/setting';
import { FeeManagementType } from '@/types/comm';
const props = defineProps<{
visible: boolean;
@@ -69,7 +69,8 @@
<script setup lang="ts">
import { ref, reactive, watch } from 'vue';
import type { FormInstance } from '@arco-design/web-vue';
import { DictionaryForm, TenantDictionaryType } from '@/types/setting';
import { DictionaryForm } from '@/types/setting';
import { TenantDictionaryType } from '@/types/comm';
import { HttpResponse } from '@/api/interceptor';
import { Message } from '@arco-design/web-vue';
@@ -105,11 +105,8 @@
updateProjectType,
delProjectType,
} from '@/api/setting';
import {
projectTypeInfo,
ProvinceItem,
ProjectTypeChecked,
} from '@/types/setting';
import { projectTypeInfo, ProvinceItem } from '@/types/setting';
import { ProjectTypeChecked } from '@/types/comm';
import useLoading from '@/hooks/loading';
import { Message } from '@arco-design/web-vue';
import labelFormModal from './label-form-modal.vue';
@@ -72,7 +72,8 @@
updateRoomTag,
delRoomTag,
} from '@/api/setting';
import { projectTypeInfo, ProjectTypeChecked } from '@/types/setting';
import { projectTypeInfo } from '@/types/setting';
import { ProjectTypeChecked } from '@/types/comm';
import useLoading from '@/hooks/loading';
import { Message } from '@arco-design/web-vue';
import labelFormModal from './label-form-modal.vue';
@@ -197,15 +197,14 @@
import { ref, onMounted } from 'vue';
import {
getAllTenantDictionaryList,
projectTypeInfo,
checkTenantDictionary,
checkAllTenantDictionary,
ProjectTypeChecked,
TenantDictionaryType,
createTenantDictionary,
updateTenantDictionary,
delTenantDictionary,
} from '@/api/setting';
import { ProjectTypeChecked, TenantDictionaryType } from '@/types/comm';
import { projectTypeInfo } from '@/types/setting';
import useLoading from '@/hooks/loading';
import { Message } from '@arco-design/web-vue';
import labelFormModal from './label-form-modal.vue';
@@ -44,7 +44,8 @@
import useDataTable from '@/composables/useDataTable';
import type { TableColumnData } from '@arco-design/web-vue';
import { getFeeList, disableFee, delFee } from '@/api/setting';
import { FeeType, FeeManagement, UserStatus } from '@/types/setting';
import { FeeManagement } from '@/types/setting';
import { FeeType, UserStatus } from '@/types/comm';
import { Message } from '@arco-design/web-vue';
const props = defineProps<{
+2 -6
View File
@@ -126,12 +126,8 @@
disableUser,
delUser,
} from '@/api/setting';
import {
UserList,
RoleItem,
FormUserItem,
UserStatus,
} from '@/types/setting';
import { UserList, RoleItem, FormUserItem } from '@/types/setting';
import { UserStatus } from '@/types/comm';
import useDepartmentList from '@/composables/useDepartmentList';
import useDataTable from '@/composables/useDataTable';
import { Message } from '@arco-design/web-vue';