Merge branch 'develop' of ssh://code.juyouwu.cn:2222/pay/pay-admin into develop
# Conflicts: # .umirc.ts # gencode.json
This commit is contained in:
commit
0fcdf6e00f
@ -16,6 +16,7 @@ export default defineConfig({
|
||||
'/api/': {
|
||||
// target: 'http://yt:8003',
|
||||
target: 'http://10.39.13.80:8003',
|
||||
// target: 'http://we6f9c65.natappfree.cc',
|
||||
// target: 'https://loanos-test.nchl.net/',
|
||||
changeOrigin: true,
|
||||
pathRewrite: { '^': '' },
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
{
|
||||
"url": "http://10.39.13.80:8003/api/docs/openapi",
|
||||
// "url": "http://we6f9c65.natappfree.cc/api/docs/openapi",
|
||||
"module": "Admin"
|
||||
}
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
import { MyButtons } from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import {
|
||||
LogoutOutlined,
|
||||
MenuFoldOutlined,
|
||||
UnlockOutlined,
|
||||
UserOutlined,
|
||||
} from '@ant-design/icons';
|
||||
@ -56,15 +54,6 @@ export default function AvatarProps({ user }: { user: any }) {
|
||||
return (
|
||||
<>
|
||||
<Space>
|
||||
<MyButtons.Default
|
||||
type="link"
|
||||
icon={<MenuFoldOutlined />}
|
||||
size="middle"
|
||||
onClick={() => {
|
||||
showDrawer();
|
||||
}}
|
||||
title="任务"
|
||||
/>
|
||||
<Dropdown menu={{ items }} placement="bottomRight">
|
||||
<Space>
|
||||
<Avatar
|
||||
|
||||
1
src/common/typings.d.ts
vendored
1
src/common/typings.d.ts
vendored
@ -58,6 +58,7 @@ export type MyBetaModalFormProps = {
|
||||
// action: ActionType | undefined;
|
||||
reload?: () => void;
|
||||
item?: Record<string, any>;
|
||||
extra?: React.ReactNode;
|
||||
};
|
||||
|
||||
export type MyProEnumItemProps = {
|
||||
|
||||
127
src/components/Address.tsx
Normal file
127
src/components/Address.tsx
Normal file
@ -0,0 +1,127 @@
|
||||
import { rulesHelper } from '@/common';
|
||||
import {
|
||||
ProColumns,
|
||||
ProFormCascader,
|
||||
ProFormColumnsType,
|
||||
ProFormText,
|
||||
} from '@ant-design/pro-components';
|
||||
|
||||
import { DefaultOptionType } from 'antd/es/cascader';
|
||||
import data from './city.json';
|
||||
const request = async () => Promise.resolve(data as Record<string, any>[]);
|
||||
type ReturnAddressType = ProColumns<Record<string, any>, 'text'>;
|
||||
type ReturnType = ProFormColumnsType<any, 'text'>;
|
||||
type PropsType = { required?: boolean } & ReturnType;
|
||||
const filter = (inputValue: string, path: DefaultOptionType[]) =>
|
||||
path.some(
|
||||
(option) =>
|
||||
(option.label as string).toLowerCase().indexOf(inputValue.toLowerCase()) >
|
||||
-1,
|
||||
);
|
||||
export const Address = {
|
||||
Cascader: (
|
||||
props: { keys: string[]; max?: number } & PropsType,
|
||||
): PropsType => {
|
||||
const { required, ...rest } = props;
|
||||
return {
|
||||
valueType: 'cascader',
|
||||
request,
|
||||
transform: (value: string[]) => {
|
||||
// console.log('transform', value);
|
||||
let root = data as Record<string, any> | undefined;
|
||||
return props.keys.reduce((accumulator, currentKey, index) => {
|
||||
if (root) {
|
||||
const node = root.find(
|
||||
(item: { value: number | string }) =>
|
||||
item.value === value?.[index],
|
||||
);
|
||||
if (node) {
|
||||
accumulator[currentKey] = node.label;
|
||||
root = node.children;
|
||||
} else {
|
||||
root = undefined;
|
||||
}
|
||||
}
|
||||
accumulator[currentKey + '_id'] = value?.[index];
|
||||
return accumulator;
|
||||
}, {} as Record<string, string>);
|
||||
},
|
||||
formItemProps: {
|
||||
...(required ? rulesHelper.array : {}),
|
||||
},
|
||||
fieldProps: {
|
||||
showSearch: true,
|
||||
changeOnSelect: true,
|
||||
placeholder: '请选择 / 输入名称搜索',
|
||||
fieldNames: {
|
||||
label: 'label',
|
||||
value: 'value',
|
||||
children: 'children',
|
||||
},
|
||||
},
|
||||
...rest,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
export function FormAddress(props: any) {
|
||||
let root = data as any;
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
style={{
|
||||
position: 'relative',
|
||||
zIndex: 10,
|
||||
}}
|
||||
>
|
||||
<ProFormCascader
|
||||
name="city_ids"
|
||||
fieldProps={{
|
||||
options: root,
|
||||
changeOnSelect: true,
|
||||
showSearch: { filter },
|
||||
onChange: (value: string, selectedOptions: { label: string }[]) => {
|
||||
props?.form?.setFieldsValue({
|
||||
province: selectedOptions?.[0]?.label || '',
|
||||
city: selectedOptions?.[1]?.label || '',
|
||||
area: selectedOptions?.[2]?.label || '',
|
||||
});
|
||||
},
|
||||
}}
|
||||
label="所在城市"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
zIndex: 1,
|
||||
opacity: 0,
|
||||
}}
|
||||
>
|
||||
<ProFormText name="province" />
|
||||
<ProFormText name="city" />
|
||||
<ProFormText name="area" />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export const MyAddressColumns = {
|
||||
Address({ ...rest }: ReturnAddressType): ReturnAddressType {
|
||||
let root = data as any;
|
||||
return {
|
||||
title: '所在城市',
|
||||
valueType: 'cascader',
|
||||
...rest,
|
||||
fieldProps: {
|
||||
options: root,
|
||||
changeOnSelect: true,
|
||||
showSearch: { filter },
|
||||
...rest?.fieldProps,
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
41
src/components/Select.tsx
Normal file
41
src/components/Select.tsx
Normal file
@ -0,0 +1,41 @@
|
||||
import { rulesHelper } from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { ProColumns, ProFormColumnsType } from '@ant-design/pro-components';
|
||||
|
||||
type ReturnType = ProColumns<any, 'text'> & ProFormColumnsType<any, 'text'>;
|
||||
type PropsType = { required?: boolean } & ReturnType;
|
||||
|
||||
export const SysSelects = {
|
||||
Companies(props?: PropsType): ReturnType {
|
||||
const {
|
||||
title = '机构',
|
||||
key = 'parent_id',
|
||||
required = false,
|
||||
hideInTable = true,
|
||||
...rest
|
||||
} = props ?? {};
|
||||
|
||||
return {
|
||||
title: title,
|
||||
key: key,
|
||||
valueType: 'select',
|
||||
hideInTable: hideInTable,
|
||||
formItemProps: { ...(required ? rulesHelper.number : {}) },
|
||||
fieldProps: {
|
||||
showSearch: true,
|
||||
fieldNames: {
|
||||
label: 'label',
|
||||
value: 'value',
|
||||
},
|
||||
},
|
||||
request: async (params) =>
|
||||
(
|
||||
await Apis.Company.Companies.Select({
|
||||
keywords: params?.KeyWords,
|
||||
...params,
|
||||
})
|
||||
).data,
|
||||
...rest,
|
||||
};
|
||||
},
|
||||
};
|
||||
222935
src/components/city.json
Normal file
222935
src/components/city.json
Normal file
File diff suppressed because it is too large
Load Diff
259
src/gen/ApiTypes.d.ts
vendored
259
src/gen/ApiTypes.d.ts
vendored
@ -1,4 +1,185 @@
|
||||
declare namespace ApiTypes {
|
||||
namespace Asset {
|
||||
namespace AssetBuildings {
|
||||
type List = {
|
||||
"asset_projects_id"?: number; // 所属项目id,[ref:asset_projects]
|
||||
"name"?: string; // 模糊搜索:名称
|
||||
};
|
||||
type Store = {
|
||||
"asset_projects_id": number; // 所属项目id,[ref:asset_projects]
|
||||
"name": string; // 楼栋名称
|
||||
"alias_name"?: string; // 楼栋别名
|
||||
};
|
||||
type Update = {
|
||||
"id": number; // id
|
||||
"asset_projects_id": number; // 所属项目id,[ref:asset_projects]
|
||||
"name": string; // 楼栋名称
|
||||
"alias_name"?: string; // 楼栋别名
|
||||
};
|
||||
type Show = {
|
||||
"id": number; // id
|
||||
};
|
||||
type Delete = {
|
||||
"id": number; // id
|
||||
};
|
||||
}
|
||||
namespace AssetHouses {
|
||||
type List = {
|
||||
"asset_projects_id"?: number; // 所属项目id,[ref:asset_projects]
|
||||
"asset_buildings_id"?: number; // 所属楼栋id,[ref:asset_buildings]
|
||||
"asset_units_id"?: number; // 所属单元id,[ref:asset_units]
|
||||
"name"?: string; // 模糊搜索:名称
|
||||
};
|
||||
type Store = {
|
||||
"asset_projects_id": number; // 所属项目id,[ref:asset_projects]
|
||||
"asset_buildings_id": number; // 所属楼栋id,[ref:asset_buildings]
|
||||
"asset_units_id": number; // 所属单元id,[ref:asset_units]
|
||||
"name": string; // 房屋名称
|
||||
"full_name": string; // 房屋全称
|
||||
"floor"?: number; // 楼层
|
||||
"built_area"?: number; // 建筑面积
|
||||
"inside_area"?: number; // 套内面积
|
||||
"chargeable_area"?: number; // 计费面积
|
||||
"ownership_type"?: string; // 产权性质,[enum:AssetHousesOwnershipTypeEnum]
|
||||
"ownership_term"?: string; // 产权年限
|
||||
"orientation"?: string; // 朝向,[enum:AssetHousesOrientationEnum]
|
||||
"usage"?: string; // 用途,[enum:AssetHousesUsageEnum]
|
||||
"status"?: string; // 房屋状态,[enum:AssetHousesStatusEnum]
|
||||
"room"?: number; // 房
|
||||
"hall"?: number; // 厅
|
||||
"kitchen"?: number; // 厨
|
||||
"bathroom"?: number; // 卫
|
||||
"balcony"?: number; // 阳台
|
||||
};
|
||||
type Update = {
|
||||
"id": number; // id
|
||||
"asset_projects_id": number; // 所属项目id,[ref:asset_projects]
|
||||
"asset_buildings_id": number; // 所属楼栋id,[ref:asset_buildings]
|
||||
"asset_units_id": number; // 所属单元id,[ref:asset_units]
|
||||
"name": string; // 房屋名称
|
||||
"floor"?: number; // 楼层
|
||||
"built_area"?: number; // 建筑面积
|
||||
"inside_area"?: number; // 套内面积
|
||||
"chargeable_area"?: number; // 计费面积
|
||||
"ownership_type"?: string; // 产权性质,[enum:AssetHousesOwnershipTypeEnum]
|
||||
"ownership_term"?: string; // 产权年限
|
||||
"orientation"?: string; // 朝向,[enum:AssetHousesOrientationEnum]
|
||||
"usage"?: string; // 用途,[enum:AssetHousesUsageEnum]
|
||||
"status"?: string; // 房屋状态,[enum:AssetHousesStatusEnum]
|
||||
"room"?: number; // 房
|
||||
"hall"?: number; // 厅
|
||||
"kitchen"?: number; // 厨
|
||||
"bathroom"?: number; // 卫
|
||||
"balcony"?: number; // 阳台
|
||||
};
|
||||
type Show = {
|
||||
"id": number; // id
|
||||
};
|
||||
type Delete = {
|
||||
"id": number; // id
|
||||
};
|
||||
}
|
||||
namespace AssetProjects {
|
||||
type List = {
|
||||
"name"?: string; // 模糊搜索:名称
|
||||
};
|
||||
type Store = {
|
||||
"name": string; // 项目名称
|
||||
"alias_name"?: string; // 项目别名
|
||||
"code"?: string; // 项目编码
|
||||
"companies_id": number; // 所属机构id,[ref:companies]
|
||||
"province"?: string; // 省
|
||||
"city"?: string; // 市
|
||||
"area"?: string; // 区
|
||||
"street"?: string; // 街道
|
||||
"province_id"?: number; // 省ID[ref:cities]
|
||||
"city_id"?: number; // 市ID[ref:cities]
|
||||
"area_id"?: number; // 区ID[ref:cities]
|
||||
"street_id"?: number; // 街道ID[ref:cities]
|
||||
"address"?: string; // 地址
|
||||
"longitude"?: string; // 经度
|
||||
"latitude"?: string; // 纬度
|
||||
"property_type"?: string; // 物业类型,[enum:AssetProjectsPropertyTypeEnum]
|
||||
"status"?: string; // 状态,[enum:AssetProjectsStatusEnum]
|
||||
"entrust_type"?: string; // 委托类型,[enum:AssetProjectsEntrustTypeEnum]
|
||||
"charge"?: string; // 收费方式,[enum:AssetProjectsChargeEnum]
|
||||
"takeover_date"?: Date; // 接管日期
|
||||
"closure_date"?: Date; // 封园日期
|
||||
};
|
||||
type Update = {
|
||||
"id": number; // id
|
||||
"name": string; // 项目名称
|
||||
"alias_name"?: string; // 项目别名
|
||||
"code"?: string; // 项目编码
|
||||
"companies_id": number; // 所属机构id,[ref:companies]
|
||||
"province"?: string; // 省
|
||||
"city"?: string; // 市
|
||||
"area"?: string; // 区
|
||||
"street"?: string; // 街道
|
||||
"province_id"?: number; // 省ID[ref:cities]
|
||||
"city_id"?: number; // 市ID[ref:cities]
|
||||
"area_id"?: number; // 区ID[ref:cities]
|
||||
"street_id"?: number; // 街道ID[ref:cities]
|
||||
"address"?: string; // 地址
|
||||
"longitude"?: string; // 经度
|
||||
"latitude"?: string; // 纬度
|
||||
"property_type"?: string; // 物业类型,[enum:AssetProjectsPropertyTypeEnum]
|
||||
"status"?: string; // 状态,[enum:AssetProjectsStatusEnum]
|
||||
"entrust_type"?: string; // 委托类型,[enum:AssetProjectsEntrustTypeEnum]
|
||||
"charge"?: string; // 收费方式,[enum:AssetProjectsChargeEnum]
|
||||
"takeover_date"?: Date; // 接管日期
|
||||
"closure_date"?: Date; // 封园日期
|
||||
};
|
||||
type Show = {
|
||||
"id": number; // id
|
||||
};
|
||||
type SoftDelete = {
|
||||
"id": number; // id
|
||||
};
|
||||
type Restore = {
|
||||
"id": number; // id
|
||||
};
|
||||
type Delete = {
|
||||
"id": number; // id
|
||||
};
|
||||
}
|
||||
namespace AssetUnits {
|
||||
type List = {
|
||||
"asset_projects_id"?: number; // 所属项目id,[ref:asset_projects]
|
||||
"asset_buildings_id"?: number; // 所属楼栋id,[ref:asset_buildings]
|
||||
"name"?: string; // 模糊搜索:名称
|
||||
};
|
||||
type Store = {
|
||||
"asset_projects_id": number; // 所属项目id,[ref:asset_projects]
|
||||
"asset_buildings_id": number; // 所属楼栋id,[ref:asset_buildings]
|
||||
"name": string; // 单元名称
|
||||
"alias_name"?: string; // 单元别名
|
||||
"building_structure"?: string; // 建筑结构,[enum:AssetUnitsBuildingStructureEnum]
|
||||
"building_type"?: string; // 建筑类型,[enum:AssetUnitsBuildingTypeEnum]
|
||||
"elevator_count"?: number; // 电梯数量
|
||||
"units_per_building"?: number; // 单元户数
|
||||
"highest_floor"?: number; // 最高楼层
|
||||
};
|
||||
type Update = {
|
||||
"id": number; // id
|
||||
"asset_projects_id": number; // 所属项目id,[ref:asset_projects]
|
||||
"asset_buildings_id": number; // 所属楼栋id,[ref:asset_buildings]
|
||||
"name": string; // 单元名称
|
||||
"alias_name"?: string; // 单元别名
|
||||
"building_structure"?: string; // 建筑结构,[enum:AssetUnitsBuildingStructureEnum]
|
||||
"building_type"?: string; // 建筑类型,[enum:AssetUnitsBuildingTypeEnum]
|
||||
"elevator_count"?: number; // 电梯数量
|
||||
"units_per_building"?: number; // 单元户数
|
||||
"highest_floor"?: number; // 最高楼层
|
||||
};
|
||||
type Show = {
|
||||
"id": number; // id
|
||||
};
|
||||
type Delete = {
|
||||
"id": number; // id
|
||||
};
|
||||
}
|
||||
}
|
||||
namespace Common {
|
||||
namespace Admins {
|
||||
type List = {
|
||||
@ -41,6 +222,84 @@ declare namespace ApiTypes {
|
||||
};
|
||||
}
|
||||
}
|
||||
namespace Company {
|
||||
namespace Companies {
|
||||
type List = {
|
||||
"name"?: string; // 模糊搜索:名称
|
||||
"parent_id"?: number; // 父级ID
|
||||
};
|
||||
type Store = {
|
||||
"name": string; // 组织名称
|
||||
"short_name"?: string; // 组织简称
|
||||
"business_license_number": string; // 营业执照号
|
||||
"merchant_type"?: string; // 商户类型,[enum:CompaniesMerchantTypeEnum]
|
||||
"contact_name": string; // 联系人姓名
|
||||
"contact_phone": string; // 联系人手机
|
||||
"contact_email"?: string; // 联系人邮箱
|
||||
"contact_address"?: string; // 联系人地址
|
||||
"province"?: string; // 省
|
||||
"city"?: string; // 市
|
||||
"area"?: string; // 区
|
||||
"street"?: string; // 街道
|
||||
"province_id"?: number; // 省ID[ref:cities]
|
||||
"city_id"?: number; // 市ID[ref:cities]
|
||||
"area_id"?: number; // 区ID[ref:cities]
|
||||
"street_id"?: number; // 街道ID[ref:cities]
|
||||
"address"?: string; // 地址
|
||||
"business_license_image"?: string[]; // 营业执照图片
|
||||
"_lft"?: number; //
|
||||
"_rgt"?: number; //
|
||||
"parent_id"?: number; //
|
||||
};
|
||||
type Update = {
|
||||
"id": number; // id
|
||||
"name": string; // 组织名称
|
||||
"short_name"?: string; // 组织简称
|
||||
"business_license_number": string; // 营业执照号
|
||||
"merchant_type"?: string; // 商户类型,[enum:CompaniesMerchantTypeEnum]
|
||||
"contact_name": string; // 联系人姓名
|
||||
"contact_phone": string; // 联系人手机
|
||||
"contact_email"?: string; // 联系人邮箱
|
||||
"contact_address"?: string; // 联系人地址
|
||||
"province"?: string; // 省
|
||||
"city"?: string; // 市
|
||||
"area"?: string; // 区
|
||||
"street"?: string; // 街道
|
||||
"province_id"?: number; // 省ID[ref:cities]
|
||||
"city_id"?: number; // 市ID[ref:cities]
|
||||
"area_id"?: number; // 区ID[ref:cities]
|
||||
"street_id"?: number; // 街道ID[ref:cities]
|
||||
"address"?: string; // 地址
|
||||
"business_license_image"?: string[]; // 营业执照图片
|
||||
"_lft"?: number; //
|
||||
"_rgt"?: number; //
|
||||
"parent_id"?: number; //
|
||||
};
|
||||
type Move = {
|
||||
"id": number; // ID
|
||||
"type": string; // 类型:up 升级,down 降级
|
||||
};
|
||||
type Show = {
|
||||
"id": number; // id
|
||||
};
|
||||
type SoftDelete = {
|
||||
"id": number; // id
|
||||
};
|
||||
type Restore = {
|
||||
"id": number; // id
|
||||
};
|
||||
type Delete = {
|
||||
"id": number; // id
|
||||
};
|
||||
type Select = {
|
||||
"keywords"?: string; // 关键词
|
||||
};
|
||||
type SelectTree = {
|
||||
"keywords"?: string; // -
|
||||
"parent_id"?: number; // -
|
||||
};
|
||||
}
|
||||
}
|
||||
namespace Permission {
|
||||
namespace SysPermissions {
|
||||
type List = {
|
||||
|
||||
110
src/gen/Apis.ts
110
src/gen/Apis.ts
@ -2,6 +2,82 @@ import { MyResponseType } from '@/common';
|
||||
import { request } from '@umijs/max';
|
||||
|
||||
export const Apis = {
|
||||
Asset: {
|
||||
AssetBuildings: {
|
||||
List(data?: ApiTypes.Asset.AssetBuildings.List): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_buildings/list', { data });
|
||||
},
|
||||
Store(data: ApiTypes.Asset.AssetBuildings.Store): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_buildings/store', { data });
|
||||
},
|
||||
Update(data: ApiTypes.Asset.AssetBuildings.Update): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_buildings/update', { data });
|
||||
},
|
||||
Show(data: ApiTypes.Asset.AssetBuildings.Show): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_buildings/show', { data });
|
||||
},
|
||||
Delete(data: ApiTypes.Asset.AssetBuildings.Delete): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_buildings/delete', { data });
|
||||
},
|
||||
},
|
||||
AssetHouses: {
|
||||
List(data?: ApiTypes.Asset.AssetHouses.List): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_houses/list', { data });
|
||||
},
|
||||
Store(data: ApiTypes.Asset.AssetHouses.Store): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_houses/store', { data });
|
||||
},
|
||||
Update(data: ApiTypes.Asset.AssetHouses.Update): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_houses/update', { data });
|
||||
},
|
||||
Show(data: ApiTypes.Asset.AssetHouses.Show): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_houses/show', { data });
|
||||
},
|
||||
Delete(data: ApiTypes.Asset.AssetHouses.Delete): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_houses/delete', { data });
|
||||
},
|
||||
},
|
||||
AssetProjects: {
|
||||
List(data?: ApiTypes.Asset.AssetProjects.List): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_projects/list', { data });
|
||||
},
|
||||
Store(data: ApiTypes.Asset.AssetProjects.Store): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_projects/store', { data });
|
||||
},
|
||||
Update(data: ApiTypes.Asset.AssetProjects.Update): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_projects/update', { data });
|
||||
},
|
||||
Show(data: ApiTypes.Asset.AssetProjects.Show): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_projects/show', { data });
|
||||
},
|
||||
SoftDelete(data: ApiTypes.Asset.AssetProjects.SoftDelete): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_projects/soft_delete', { data });
|
||||
},
|
||||
Restore(data: ApiTypes.Asset.AssetProjects.Restore): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_projects/restore', { data });
|
||||
},
|
||||
Delete(data: ApiTypes.Asset.AssetProjects.Delete): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_projects/delete', { data });
|
||||
},
|
||||
},
|
||||
AssetUnits: {
|
||||
List(data?: ApiTypes.Asset.AssetUnits.List): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_units/list', { data });
|
||||
},
|
||||
Store(data: ApiTypes.Asset.AssetUnits.Store): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_units/store', { data });
|
||||
},
|
||||
Update(data: ApiTypes.Asset.AssetUnits.Update): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_units/update', { data });
|
||||
},
|
||||
Show(data: ApiTypes.Asset.AssetUnits.Show): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_units/show', { data });
|
||||
},
|
||||
Delete(data: ApiTypes.Asset.AssetUnits.Delete): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_units/delete', { data });
|
||||
},
|
||||
},
|
||||
},
|
||||
Common: {
|
||||
Admins: {
|
||||
List(data?: ApiTypes.Common.Admins.List): Promise<MyResponseType> {
|
||||
@ -44,6 +120,40 @@ export const Apis = {
|
||||
},
|
||||
},
|
||||
},
|
||||
Company: {
|
||||
Companies: {
|
||||
List(data?: ApiTypes.Company.Companies.List): Promise<MyResponseType> {
|
||||
return request('admin/company/companies/list', { data });
|
||||
},
|
||||
Store(data: ApiTypes.Company.Companies.Store): Promise<MyResponseType> {
|
||||
return request('admin/company/companies/store', { data });
|
||||
},
|
||||
Update(data: ApiTypes.Company.Companies.Update): Promise<MyResponseType> {
|
||||
return request('admin/company/companies/update', { data });
|
||||
},
|
||||
Move(data: ApiTypes.Company.Companies.Move): Promise<MyResponseType> {
|
||||
return request('admin/company/companies/move', { data });
|
||||
},
|
||||
Show(data: ApiTypes.Company.Companies.Show): Promise<MyResponseType> {
|
||||
return request('admin/company/companies/show', { data });
|
||||
},
|
||||
SoftDelete(data: ApiTypes.Company.Companies.SoftDelete): Promise<MyResponseType> {
|
||||
return request('admin/company/companies/soft_delete', { data });
|
||||
},
|
||||
Restore(data: ApiTypes.Company.Companies.Restore): Promise<MyResponseType> {
|
||||
return request('admin/company/companies/restore', { data });
|
||||
},
|
||||
Delete(data: ApiTypes.Company.Companies.Delete): Promise<MyResponseType> {
|
||||
return request('admin/company/companies/delete', { data });
|
||||
},
|
||||
Select(data?: ApiTypes.Company.Companies.Select): Promise<MyResponseType> {
|
||||
return request('admin/company/companies/select', { data });
|
||||
},
|
||||
SelectTree(data?: ApiTypes.Company.Companies.SelectTree): Promise<MyResponseType> {
|
||||
return request('admin/company/companies/select_tree', { data });
|
||||
},
|
||||
},
|
||||
},
|
||||
Permission: {
|
||||
SysPermissions: {
|
||||
List(data: ApiTypes.Permission.SysPermissions.List): Promise<MyResponseType> {
|
||||
|
||||
@ -1,21 +1,48 @@
|
||||
// AssetHousesOrientationEnum
|
||||
export const AssetHousesOrientationEnum= {
|
||||
'Value': {"text":"Label","color":"#ff0000","value":"Value"},
|
||||
'East': {"text":"东","color":"#007bff","value":"East"},
|
||||
'South': {"text":"南","color":"#28a745","value":"South"},
|
||||
'West': {"text":"西","color":"#ffc107","value":"West"},
|
||||
'North': {"text":"北","color":"#dc3545","value":"North"},
|
||||
'Southeast': {"text":"东南","color":"#20c997","value":"Southeast"},
|
||||
'Northeast': {"text":"东北","color":"#6f42c1","value":"Northeast"},
|
||||
'Southwest': {"text":"西南","color":"#fd7e14","value":"Southwest"},
|
||||
'Northwest': {"text":"西北","color":"#17a2b8","value":"Northwest"},
|
||||
'EastWest': {"text":"东西","color":"#6610f2","value":"EastWest"},
|
||||
'SouthNorth': {"text":"南北","color":"#e83e8c","value":"SouthNorth"},
|
||||
};
|
||||
|
||||
// AssetHousesOwnershipTypeEnum
|
||||
export const AssetHousesOwnershipTypeEnum= {
|
||||
'Value': {"text":"Label","color":"#ff0000","value":"Value"},
|
||||
'CommodityHousing': {"text":"商品房","color":"#007bff","value":"CommodityHousing"},
|
||||
'FundedHousing': {"text":"集资房","color":"#28a745","value":"FundedHousing"},
|
||||
'MilitaryHousing': {"text":"军产房","color":"#17a2b8","value":"MilitaryHousing"},
|
||||
'AffordableHousing': {"text":"保障房","color":"#ffc107","value":"AffordableHousing"},
|
||||
'RuralHousing': {"text":"农民房","color":"#6f42c1","value":"RuralHousing"},
|
||||
'CommercialOffice': {"text":"商业写字楼","color":"#fd7e14","value":"CommercialOffice"},
|
||||
'CommercialComplex': {"text":"商业综合体","color":"#dc3545","value":"CommercialComplex"},
|
||||
'ResettlementHousing': {"text":"回迁房","color":"#20c997","value":"ResettlementHousing"},
|
||||
};
|
||||
|
||||
// AssetHousesStatusEnum
|
||||
export const AssetHousesStatusEnum= {
|
||||
'Value': {"text":"Label","color":"#ff0000","value":"Value"},
|
||||
'Unsold': {"text":"未售","color":"#6c757d","value":"Unsold"},
|
||||
'SoldNotDelivered': {"text":"已售未交房","color":"#ffc107","value":"SoldNotDelivered"},
|
||||
'SelfOccupied': {"text":"自住","color":"#28a745","value":"SelfOccupied"},
|
||||
'Rented': {"text":"出租","color":"#007bff","value":"Rented"},
|
||||
'Vacant': {"text":"空置","color":"#dc3545","value":"Vacant"},
|
||||
};
|
||||
|
||||
// AssetHousesUsageEnum
|
||||
export const AssetHousesUsageEnum= {
|
||||
'Value': {"text":"Label","color":"#ff0000","value":"Value"},
|
||||
'Residence': {"text":"住宅","color":"#007bff","value":"Residence"},
|
||||
'Apartment': {"text":"公寓","color":"#28a745","value":"Apartment"},
|
||||
'Villa': {"text":"别墅","color":"#17a2b8","value":"Villa"},
|
||||
'Shop': {"text":"商铺","color":"#ffc107","value":"Shop"},
|
||||
'ParkingSpace': {"text":"车位","color":"#6c757d","value":"ParkingSpace"},
|
||||
'Office': {"text":"写字楼","color":"#6610f2","value":"Office"},
|
||||
'Clubhouse': {"text":"会所","color":"#fd7e14","value":"Clubhouse"},
|
||||
'PropertyRoom': {"text":"物业用房","color":"#dc3545","value":"PropertyRoom"},
|
||||
};
|
||||
|
||||
// AssetProjectsChargeEnum
|
||||
@ -67,6 +94,12 @@ export const AssetUnitsBuildingTypeEnum= {
|
||||
'Tower': {"text":"塔楼","color":"#ffc107","value":"Tower"},
|
||||
};
|
||||
|
||||
// CompaniesMerchantTypeEnum
|
||||
export const CompaniesMerchantTypeEnum= {
|
||||
'PropertyManagement': {"text":"物业公司","color":"#007bff","value":"PropertyManagement"},
|
||||
'ServiceProvider': {"text":"服务商","color":"#28a745","value":"ServiceProvider"},
|
||||
};
|
||||
|
||||
// SysModuleEnum
|
||||
export const SysModuleEnum= {
|
||||
'Admin': {"text":"管理员","color":"#cf1322","value":"Admin"},
|
||||
|
||||
43
src/pages/asset/asset_projects/$id.tsx
Normal file
43
src/pages/asset/asset_projects/$id.tsx
Normal file
@ -0,0 +1,43 @@
|
||||
import { MyPageContainer } from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { ProCard } from '@ant-design/pro-components';
|
||||
import { useParams } from '@umijs/max';
|
||||
import { Tabs } from 'antd';
|
||||
import { useEffect, useState } from 'react';
|
||||
import MyAssetBuildings from './components/AssetBuildings';
|
||||
import MyInfo from './components/info';
|
||||
import Update from './modals/Update';
|
||||
export default function Show({ title = '项目详情' }) {
|
||||
const { id } = useParams<{ id: string }>();
|
||||
const [data, setShow] = useState<any>({});
|
||||
|
||||
const loadShow = () => {
|
||||
let paramsId: any = { id: id ?? 0 };
|
||||
Apis.Asset.AssetProjects.Show(paramsId).then((res) => {
|
||||
setShow(res?.data);
|
||||
});
|
||||
};
|
||||
useEffect(() => {
|
||||
loadShow();
|
||||
}, [id]);
|
||||
|
||||
let items = [
|
||||
{
|
||||
label: '楼栋管理',
|
||||
key: 'asset_buildings',
|
||||
closable: false,
|
||||
children: <MyAssetBuildings item={data} />,
|
||||
},
|
||||
];
|
||||
return (
|
||||
<MyPageContainer title={title}>
|
||||
<MyInfo
|
||||
item={data}
|
||||
extra={<Update item={data} reload={() => loadShow()} title="项目" />}
|
||||
/>
|
||||
<ProCard>
|
||||
<Tabs type="card" items={data?.id ? items : []} />
|
||||
</ProCard>
|
||||
</MyPageContainer>
|
||||
);
|
||||
}
|
||||
220
src/pages/asset/asset_projects/components/AssetBuildings.tsx
Normal file
220
src/pages/asset/asset_projects/components/AssetBuildings.tsx
Normal file
@ -0,0 +1,220 @@
|
||||
import { MyBetaModalFormProps, MyColumns, MyProTableProps } from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import {
|
||||
AssetHousesOrientationEnum,
|
||||
AssetHousesOwnershipTypeEnum,
|
||||
AssetHousesStatusEnum,
|
||||
AssetHousesUsageEnum,
|
||||
} from '@/gen/Enums';
|
||||
import { ProCard, ProTable } from '@ant-design/pro-components';
|
||||
import { Space } from 'antd';
|
||||
import { useRef, useState } from 'react';
|
||||
import BuildingsCreate from '../modals/AssetBuildingsCreate';
|
||||
import AssetHousesCreate from '../modals/AssetHousesCreate';
|
||||
import AssetUnitsCreate from '../modals/AssetUnitsCreate';
|
||||
|
||||
export default function AssetBuildings(props: MyBetaModalFormProps) {
|
||||
const actionBuildingsRef: any = useRef();
|
||||
const actionUnitsRef: any = useRef();
|
||||
const actionHousesRef: any = useRef();
|
||||
const [selectKey, setSelectkey] = useState<any>({});
|
||||
const [selectKeyUnits, setSelectKeyUnits] = useState<any>({});
|
||||
return (
|
||||
<ProCard
|
||||
extra={
|
||||
<Space>
|
||||
<BuildingsCreate
|
||||
key="BuildingsCreate"
|
||||
item={props?.item}
|
||||
reload={() => actionBuildingsRef?.current?.reload()}
|
||||
title="楼栋"
|
||||
/>
|
||||
<AssetUnitsCreate
|
||||
key="UnitsCreate"
|
||||
item={{
|
||||
...props?.item,
|
||||
asset_buildings_id: selectKey?.id || undefined,
|
||||
}}
|
||||
reload={() => actionUnitsRef?.current?.reload()}
|
||||
title="单元"
|
||||
/>
|
||||
<AssetHousesCreate
|
||||
key="HousesCreate"
|
||||
item={{
|
||||
...props?.item,
|
||||
asset_buildings_id: selectKey?.id || undefined,
|
||||
asset_units_id: selectKeyUnits?.id || undefined,
|
||||
}}
|
||||
reload={() => actionHousesRef?.current?.reload()}
|
||||
title="房源"
|
||||
/>
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
<Space align="start" size="large">
|
||||
<ProTable
|
||||
{...MyProTableProps.props}
|
||||
search={false}
|
||||
actionRef={actionBuildingsRef}
|
||||
rowClassName={(record: any) => {
|
||||
console.log(selectKey?.id, 'key', record?.id);
|
||||
return selectKey?.id === record?.id ? 'ant-table-row-selected' : '';
|
||||
}}
|
||||
onRow={(record: any) => {
|
||||
return {
|
||||
onClick: () => {
|
||||
setSelectkey(record);
|
||||
setSelectKeyUnits({});
|
||||
actionUnitsRef?.current?.reload();
|
||||
actionHousesRef?.current?.reload();
|
||||
},
|
||||
style: {
|
||||
cursor: 'pointer',
|
||||
},
|
||||
};
|
||||
}}
|
||||
request={async (params, sort) =>
|
||||
MyProTableProps.request(
|
||||
{ ...params, asset_projects_id: props?.item?.id },
|
||||
sort,
|
||||
Apis.Asset.AssetBuildings.List,
|
||||
)
|
||||
}
|
||||
options={false}
|
||||
columns={[
|
||||
MyColumns.ID(),
|
||||
{
|
||||
title: '楼栋',
|
||||
width: '250px',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
<ProTable
|
||||
{...MyProTableProps.props}
|
||||
search={false}
|
||||
actionRef={actionUnitsRef}
|
||||
request={async (params, sort) =>
|
||||
MyProTableProps.request(
|
||||
{
|
||||
...params,
|
||||
asset_projects_id: props?.item?.id,
|
||||
asset_buildings_id: selectKey?.id,
|
||||
},
|
||||
sort,
|
||||
Apis.Asset.AssetUnits.List,
|
||||
)
|
||||
}
|
||||
rowClassName={(record: any) => {
|
||||
return selectKeyUnits?.id === record?.id
|
||||
? 'ant-table-row-selected'
|
||||
: '';
|
||||
}}
|
||||
onRow={(record: any) => {
|
||||
return {
|
||||
onClick: () => {
|
||||
setSelectKeyUnits(record);
|
||||
actionHousesRef?.current?.reload();
|
||||
},
|
||||
style: {
|
||||
cursor: 'pointer',
|
||||
},
|
||||
};
|
||||
}}
|
||||
options={false}
|
||||
columns={[
|
||||
MyColumns.ID(),
|
||||
{
|
||||
title: '单元',
|
||||
width: '250px',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
<ProTable
|
||||
{...MyProTableProps.props}
|
||||
search={false}
|
||||
actionRef={actionHousesRef}
|
||||
request={async (params, sort) =>
|
||||
MyProTableProps.request(
|
||||
{
|
||||
...params,
|
||||
asset_projects_id: props?.item?.id,
|
||||
asset_buildings_id: selectKey?.id,
|
||||
asset_units_id: selectKeyUnits?.id,
|
||||
},
|
||||
sort,
|
||||
Apis.Asset.AssetHouses.List,
|
||||
)
|
||||
}
|
||||
options={false}
|
||||
columns={[
|
||||
MyColumns.ID(),
|
||||
MyColumns.EnumTag({
|
||||
title: '用途',
|
||||
dataIndex: 'usage',
|
||||
valueEnum: AssetHousesUsageEnum,
|
||||
}),
|
||||
{
|
||||
title: '房号',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
MyColumns.EnumTag({
|
||||
title: '产权性质',
|
||||
dataIndex: 'ownership_type',
|
||||
valueEnum: AssetHousesOwnershipTypeEnum,
|
||||
}),
|
||||
MyColumns.EnumTag({
|
||||
title: '朝向',
|
||||
dataIndex: 'orientation',
|
||||
valueEnum: AssetHousesOrientationEnum,
|
||||
}),
|
||||
MyColumns.EnumTag({
|
||||
title: '房屋状态',
|
||||
dataIndex: 'status',
|
||||
valueEnum: AssetHousesStatusEnum,
|
||||
}),
|
||||
{
|
||||
title: '房',
|
||||
dataIndex: 'room',
|
||||
},
|
||||
{
|
||||
title: '厅',
|
||||
dataIndex: 'hall',
|
||||
},
|
||||
{
|
||||
title: '厨',
|
||||
dataIndex: 'kitchen',
|
||||
},
|
||||
{
|
||||
title: '卫',
|
||||
dataIndex: 'bathroom',
|
||||
},
|
||||
{
|
||||
title: '阳台',
|
||||
dataIndex: 'balcony',
|
||||
},
|
||||
{
|
||||
title: '产权年限',
|
||||
dataIndex: 'ownership_term',
|
||||
},
|
||||
{
|
||||
title: '建筑面积',
|
||||
dataIndex: 'built_area',
|
||||
},
|
||||
{
|
||||
title: '套内面积',
|
||||
dataIndex: 'inside_area',
|
||||
},
|
||||
{
|
||||
title: '计费面积',
|
||||
dataIndex: 'chargeable_area',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</Space>
|
||||
</ProCard>
|
||||
);
|
||||
}
|
||||
67
src/pages/asset/asset_projects/components/info.tsx
Normal file
67
src/pages/asset/asset_projects/components/info.tsx
Normal file
@ -0,0 +1,67 @@
|
||||
import { MyBetaModalFormProps, renderTextHelper } from '@/common';
|
||||
import {
|
||||
AssetProjectsChargeEnum,
|
||||
AssetProjectsEntrustTypeEnum,
|
||||
AssetProjectsPropertyTypeEnum,
|
||||
AssetProjectsStatusEnum,
|
||||
} from '@/gen/Enums';
|
||||
import { ProCard, ProDescriptions } from '@ant-design/pro-components';
|
||||
|
||||
export default function info(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<ProCard extra={props.extra}>
|
||||
<ProDescriptions bordered>
|
||||
<ProDescriptions.Item label="项目名称">
|
||||
{props?.item?.name}
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="项目别名">
|
||||
{props?.item?.alias_name}
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="项目编码">
|
||||
{props?.item?.code}
|
||||
</ProDescriptions.Item>
|
||||
|
||||
<ProDescriptions.Item label="状态">
|
||||
<renderTextHelper.Tag
|
||||
Enums={AssetProjectsStatusEnum}
|
||||
value={props?.item?.status}
|
||||
key="status"
|
||||
/>
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="物业类型">
|
||||
<renderTextHelper.Tag
|
||||
Enums={AssetProjectsPropertyTypeEnum}
|
||||
value={props?.item?.property_type}
|
||||
key="property_type"
|
||||
/>
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="收费方式">
|
||||
<renderTextHelper.Tag
|
||||
Enums={AssetProjectsChargeEnum}
|
||||
value={props?.item?.charge}
|
||||
key="charge"
|
||||
/>
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="委托类型">
|
||||
<renderTextHelper.Tag
|
||||
Enums={AssetProjectsEntrustTypeEnum}
|
||||
value={props?.item?.entrust_type}
|
||||
key="entrust_type"
|
||||
/>
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="接管日期">
|
||||
{props?.item?.takeover_date}
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="封园日期">
|
||||
{props?.item?.closure_date}
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="地址">
|
||||
{props?.item?.province || ''}
|
||||
{props?.item?.city || ''}
|
||||
{props?.item?.district || ''}
|
||||
{props?.item?.address || ''}
|
||||
</ProDescriptions.Item>
|
||||
</ProDescriptions>
|
||||
</ProCard>
|
||||
);
|
||||
}
|
||||
106
src/pages/asset/asset_projects/index.tsx
Normal file
106
src/pages/asset/asset_projects/index.tsx
Normal file
@ -0,0 +1,106 @@
|
||||
import {
|
||||
MyButtons,
|
||||
MyColumns,
|
||||
MyPageContainer,
|
||||
MyProTableProps,
|
||||
} from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import {
|
||||
AssetProjectsChargeEnum,
|
||||
AssetProjectsEntrustTypeEnum,
|
||||
AssetProjectsPropertyTypeEnum,
|
||||
AssetProjectsStatusEnum,
|
||||
} from '@/gen/Enums';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import { Space } from 'antd';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import Create from './modals/Create';
|
||||
|
||||
export default function Index({ title = '项目管理' }) {
|
||||
const navigate = useNavigate();
|
||||
return (
|
||||
<MyPageContainer title={title}>
|
||||
<ProTable
|
||||
{...MyProTableProps.props}
|
||||
search={false}
|
||||
request={async (params, sort) =>
|
||||
MyProTableProps.request(params, sort, Apis.Asset.AssetProjects.List)
|
||||
}
|
||||
toolBarRender={(action) => [
|
||||
<Create key="Create" reload={action?.reload} title={title} />,
|
||||
]}
|
||||
columns={[
|
||||
MyColumns.ID(),
|
||||
{
|
||||
title: '项目名称',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
{
|
||||
title: '项目别名',
|
||||
dataIndex: 'alias_name',
|
||||
},
|
||||
{
|
||||
title: '项目编码',
|
||||
dataIndex: 'code',
|
||||
},
|
||||
MyColumns.EnumTag({
|
||||
title: '类型',
|
||||
dataIndex: 'property_type',
|
||||
valueEnum: AssetProjectsPropertyTypeEnum,
|
||||
}),
|
||||
MyColumns.EnumTag({
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
valueEnum: AssetProjectsStatusEnum,
|
||||
}),
|
||||
MyColumns.EnumTag({
|
||||
title: '收费方式',
|
||||
dataIndex: 'charge',
|
||||
valueEnum: AssetProjectsChargeEnum,
|
||||
}),
|
||||
MyColumns.EnumTag({
|
||||
title: '委托类型',
|
||||
dataIndex: 'entrust_type',
|
||||
valueEnum: AssetProjectsEntrustTypeEnum,
|
||||
}),
|
||||
{
|
||||
title: '地址',
|
||||
render: (_, i: any) => {
|
||||
return `${i?.province || ''}${i?.city || ''}${i?.district || ''}${
|
||||
i?.address || ''
|
||||
}`;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '接管日期',
|
||||
dataIndex: 'takeover_date',
|
||||
},
|
||||
{
|
||||
title: '封园日期',
|
||||
dataIndex: 'closure_date',
|
||||
},
|
||||
MyColumns.CreatedAt(),
|
||||
MyColumns.Option({
|
||||
render: (_, item: any, index, action) => (
|
||||
<Space key={index}>
|
||||
<MyButtons.View
|
||||
title="详情"
|
||||
onClick={() => {
|
||||
navigate(`/asset/asset_projects/${item.id}`);
|
||||
}}
|
||||
/>
|
||||
<MyButtons.Delete
|
||||
onConfirm={() =>
|
||||
Apis.Common.Admins.Delete({ id: item.id }).then(() =>
|
||||
action?.reload(),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Space>
|
||||
),
|
||||
}),
|
||||
]}
|
||||
/>
|
||||
</MyPageContainer>
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
import {
|
||||
MyBetaModalFormProps,
|
||||
MyButtons,
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||
import { message } from 'antd';
|
||||
|
||||
|
||||
export default function Create(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.Asset.AssetBuildings.Store>
|
||||
{...MyModalFormProps.props}
|
||||
title={`添加${props.title}`}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="500px"
|
||||
trigger={<MyButtons.Create title={`添加${props.title}`} />}
|
||||
onFinish={async (values) =>
|
||||
Apis.Asset.AssetBuildings.Store({
|
||||
...values,
|
||||
asset_projects_id: props?.item?.id,
|
||||
})
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
return true;
|
||||
})
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
{
|
||||
key: 'name',
|
||||
title: '楼栋名称',
|
||||
colProps: { span: 24 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'alias_name',
|
||||
title: '楼栋别名',
|
||||
colProps: { span: 24 },
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
186
src/pages/asset/asset_projects/modals/AssetHousesCreate.tsx
Normal file
186
src/pages/asset/asset_projects/modals/AssetHousesCreate.tsx
Normal file
@ -0,0 +1,186 @@
|
||||
import {
|
||||
MyBetaModalFormProps,
|
||||
MyButtons,
|
||||
MyFormItems,
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import {
|
||||
AssetHousesOrientationEnum,
|
||||
AssetHousesOwnershipTypeEnum,
|
||||
AssetHousesStatusEnum,
|
||||
AssetHousesUsageEnum,
|
||||
} from '@/gen/Enums';
|
||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||
import { message } from 'antd';
|
||||
|
||||
export default function Create(props: MyBetaModalFormProps) {
|
||||
console.log(props?.item, 'item');
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.Asset.AssetHouses.Store>
|
||||
{...MyModalFormProps.props}
|
||||
title={`添加${props.title}`}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="800px"
|
||||
trigger={
|
||||
<MyButtons.Create
|
||||
title={`添加${props.title}`}
|
||||
disabled={
|
||||
!(props?.item?.asset_units_id && props?.item?.asset_buildings_id)
|
||||
}
|
||||
/>
|
||||
}
|
||||
onFinish={async (values) =>
|
||||
Apis.Asset.AssetHouses.Store({
|
||||
...values,
|
||||
asset_projects_id: props?.item?.id,
|
||||
asset_buildings_id: props?.item?.asset_buildings_id,
|
||||
asset_units_id: props?.item?.asset_units_id,
|
||||
})
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
return true;
|
||||
})
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
{
|
||||
key: 'name',
|
||||
title: '房号',
|
||||
colProps: { span: 12 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'full_name',
|
||||
title: '房屋全称',
|
||||
colProps: { span: 12 },
|
||||
},
|
||||
MyFormItems.EnumRadio({
|
||||
key: 'ownership_type',
|
||||
title: '产权性质',
|
||||
colProps: { span: 24 },
|
||||
valueEnum: AssetHousesOwnershipTypeEnum,
|
||||
required: true,
|
||||
}),
|
||||
MyFormItems.EnumRadio({
|
||||
key: 'orientation',
|
||||
title: '朝向',
|
||||
colProps: { span: 24 },
|
||||
valueEnum: AssetHousesOrientationEnum,
|
||||
required: true,
|
||||
}),
|
||||
MyFormItems.EnumRadio({
|
||||
key: 'usage',
|
||||
title: '用途',
|
||||
colProps: { span: 24 },
|
||||
valueEnum: AssetHousesUsageEnum,
|
||||
required: true,
|
||||
}),
|
||||
MyFormItems.EnumRadio({
|
||||
key: 'status',
|
||||
title: '房屋状态',
|
||||
colProps: { span: 24 },
|
||||
valueEnum: AssetHousesStatusEnum,
|
||||
required: true,
|
||||
}),
|
||||
|
||||
{
|
||||
key: 'built_area',
|
||||
title: '建筑面积',
|
||||
valueType: 'digit',
|
||||
fieldProps: {
|
||||
addonAfter: '㎡',
|
||||
},
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
{
|
||||
key: 'inside_area',
|
||||
title: '套内面积',
|
||||
valueType: 'digit',
|
||||
fieldProps: {
|
||||
addonAfter: '㎡',
|
||||
},
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
{
|
||||
key: 'chargeable_area',
|
||||
title: '计费面积',
|
||||
valueType: 'digit',
|
||||
fieldProps: {
|
||||
addonAfter: '㎡',
|
||||
},
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
{
|
||||
key: 'floor',
|
||||
title: '楼层',
|
||||
valueType: 'digit',
|
||||
fieldProps: {
|
||||
addonAfter: '楼',
|
||||
},
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
{
|
||||
key: 'ownership_term',
|
||||
title: '产权年限',
|
||||
fieldProps: {
|
||||
addonAfter: '年',
|
||||
},
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
{
|
||||
valueType: 'group',
|
||||
columns: [
|
||||
{
|
||||
key: 'room',
|
||||
title: '房',
|
||||
valueType: 'digit',
|
||||
fieldProps: {
|
||||
addonAfter: '房',
|
||||
},
|
||||
colProps: { span: 4 },
|
||||
},
|
||||
{
|
||||
key: 'hall',
|
||||
title: '厅',
|
||||
valueType: 'digit',
|
||||
fieldProps: {
|
||||
addonAfter: '厅',
|
||||
},
|
||||
colProps: { span: 4 },
|
||||
},
|
||||
{
|
||||
key: 'kitchen',
|
||||
title: '厨',
|
||||
valueType: 'digit',
|
||||
fieldProps: {
|
||||
addonAfter: '厨',
|
||||
},
|
||||
colProps: { span: 4 },
|
||||
},
|
||||
{
|
||||
key: 'bathroom',
|
||||
title: '卫',
|
||||
valueType: 'digit',
|
||||
fieldProps: {
|
||||
addonAfter: '卫',
|
||||
},
|
||||
colProps: { span: 4 },
|
||||
},
|
||||
{
|
||||
key: 'balcony',
|
||||
title: '阳台',
|
||||
valueType: 'digit',
|
||||
fieldProps: {
|
||||
addonAfter: '阳台',
|
||||
},
|
||||
colProps: { span: 4 },
|
||||
},
|
||||
],
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
86
src/pages/asset/asset_projects/modals/AssetUnitsCreate.tsx
Normal file
86
src/pages/asset/asset_projects/modals/AssetUnitsCreate.tsx
Normal file
@ -0,0 +1,86 @@
|
||||
import {
|
||||
MyBetaModalFormProps,
|
||||
MyButtons,
|
||||
MyFormItems,
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import {
|
||||
AssetUnitsBuildingStructureEnum,
|
||||
AssetUnitsBuildingTypeEnum,
|
||||
} from '@/gen/Enums';
|
||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||
import { message } from 'antd';
|
||||
|
||||
export default function Create(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.Asset.AssetUnits.Store>
|
||||
{...MyModalFormProps.props}
|
||||
title={`添加${props.title}`}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="700px"
|
||||
trigger={
|
||||
<MyButtons.Create
|
||||
title={`添加${props.title}`}
|
||||
disabled={!props?.item?.asset_buildings_id}
|
||||
/>
|
||||
}
|
||||
onFinish={async (values) =>
|
||||
Apis.Asset.AssetUnits.Store({
|
||||
...values,
|
||||
asset_projects_id: props?.item?.id,
|
||||
asset_buildings_id: props?.item?.asset_buildings_id,
|
||||
})
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
return true;
|
||||
})
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
{
|
||||
key: 'name',
|
||||
title: '单元名称',
|
||||
colProps: { span: 12 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'alias_name',
|
||||
title: '单元别名',
|
||||
colProps: { span: 12 },
|
||||
},
|
||||
MyFormItems.EnumRadio({
|
||||
key: 'building_structure',
|
||||
title: '建筑结构',
|
||||
colProps: { span: 12 },
|
||||
valueEnum: AssetUnitsBuildingStructureEnum,
|
||||
required: true,
|
||||
}),
|
||||
MyFormItems.EnumRadio({
|
||||
key: 'building_type',
|
||||
title: '建筑类型',
|
||||
colProps: { span: 12 },
|
||||
valueEnum: AssetUnitsBuildingTypeEnum,
|
||||
required: true,
|
||||
}),
|
||||
{
|
||||
key: 'elevator_count',
|
||||
title: '电梯数量',
|
||||
colProps: { span: 12 },
|
||||
},
|
||||
{
|
||||
key: 'units_per_building',
|
||||
title: '单元户数',
|
||||
colProps: { span: 12 },
|
||||
},
|
||||
{
|
||||
key: 'highest_floor',
|
||||
title: '最高楼层',
|
||||
colProps: { span: 12 },
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
138
src/pages/asset/asset_projects/modals/Create.tsx
Normal file
138
src/pages/asset/asset_projects/modals/Create.tsx
Normal file
@ -0,0 +1,138 @@
|
||||
import {
|
||||
MyBetaModalFormProps,
|
||||
MyButtons,
|
||||
MyFormItems,
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Address } from '@/components/Address';
|
||||
import { SysSelects } from '@/components/Select';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import {
|
||||
AssetProjectsChargeEnum,
|
||||
AssetProjectsEntrustTypeEnum,
|
||||
AssetProjectsPropertyTypeEnum,
|
||||
AssetProjectsStatusEnum,
|
||||
} from '@/gen/Enums';
|
||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||
import { message } from 'antd';
|
||||
|
||||
export default function Create(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.Asset.AssetProjects.Store>
|
||||
{...MyModalFormProps.props}
|
||||
title={`添加${props.title}`}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="800px"
|
||||
trigger={<MyButtons.Create title={`添加${props.title}`} />}
|
||||
onFinish={async (values) =>
|
||||
Apis.Asset.AssetProjects.Store(values)
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
return true;
|
||||
})
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
SysSelects?.Companies({
|
||||
key: 'companies_id',
|
||||
title: '所属机构',
|
||||
colProps: { span: 24 },
|
||||
formItemProps: { ...rulesHelper.number },
|
||||
}),
|
||||
{
|
||||
key: 'name',
|
||||
title: '项目名称',
|
||||
colProps: { span: 8 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'alias_name',
|
||||
title: '项目别名',
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
{
|
||||
key: 'code',
|
||||
title: '项目编码',
|
||||
colProps: { span: 8 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
MyFormItems.EnumRadio({
|
||||
key: 'property_type',
|
||||
title: '物业类型',
|
||||
colProps: { span: 24 },
|
||||
valueEnum: AssetProjectsPropertyTypeEnum,
|
||||
required: true,
|
||||
}),
|
||||
MyFormItems.EnumRadio({
|
||||
key: 'status',
|
||||
title: '状态',
|
||||
colProps: { span: 12 },
|
||||
valueEnum: AssetProjectsStatusEnum,
|
||||
required: true,
|
||||
}),
|
||||
MyFormItems.EnumRadio({
|
||||
key: 'charge',
|
||||
title: '收费方式',
|
||||
colProps: { span: 12 },
|
||||
valueEnum: AssetProjectsChargeEnum,
|
||||
required: true,
|
||||
}),
|
||||
|
||||
MyFormItems.EnumRadio({
|
||||
key: 'entrust_type',
|
||||
title: '委托类型',
|
||||
colProps: { span: 24 },
|
||||
valueEnum: AssetProjectsEntrustTypeEnum,
|
||||
required: true,
|
||||
}),
|
||||
|
||||
Address.Cascader({
|
||||
key: 'casacader',
|
||||
title: '选择地址',
|
||||
colProps: { span: 24 },
|
||||
keys: ['province', 'city', 'area', 'street'],
|
||||
required: true,
|
||||
}),
|
||||
{
|
||||
key: 'address',
|
||||
title: '详细地址',
|
||||
colProps: { span: 24 },
|
||||
},
|
||||
{
|
||||
key: 'longitude',
|
||||
title: '经度',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
key: 'latitude',
|
||||
title: '纬度',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
key: 'takeover_date',
|
||||
title: '接管日期',
|
||||
valueType: 'date',
|
||||
fieldProps: {
|
||||
style: {
|
||||
width: '100%',
|
||||
},
|
||||
},
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
key: 'closure_date',
|
||||
title: '封园日期',
|
||||
valueType: 'date',
|
||||
fieldProps: {
|
||||
style: {
|
||||
width: '100%',
|
||||
},
|
||||
},
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
139
src/pages/asset/asset_projects/modals/Update.tsx
Normal file
139
src/pages/asset/asset_projects/modals/Update.tsx
Normal file
@ -0,0 +1,139 @@
|
||||
import {
|
||||
MyBetaModalFormProps,
|
||||
MyButtons,
|
||||
MyFormItems,
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Address } from '@/components/Address';
|
||||
import { SysSelects } from '@/components/Select';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import {
|
||||
AssetProjectsChargeEnum,
|
||||
AssetProjectsEntrustTypeEnum,
|
||||
AssetProjectsPropertyTypeEnum,
|
||||
AssetProjectsStatusEnum,
|
||||
} from '@/gen/Enums';
|
||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||
import { message } from 'antd';
|
||||
|
||||
export default function Update(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.Asset.AssetProjects.Update>
|
||||
{...MyModalFormProps.props}
|
||||
title={`编辑${props.title}`}
|
||||
trigger={<MyButtons.Default title="编辑" type="primary" size="middle" />}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="800px"
|
||||
request={() =>
|
||||
Promise.resolve({
|
||||
...props.item,
|
||||
casacader: [
|
||||
props.item?.province_id || '',
|
||||
props.item?.city_id || '',
|
||||
props.item?.area_id || '',
|
||||
props.item?.street_id || '',
|
||||
],
|
||||
})
|
||||
}
|
||||
onFinish={async (values) =>
|
||||
Apis.Asset.AssetProjects.Update({ ...values, id: props.item?.id ?? 0 })
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
return true;
|
||||
})
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
SysSelects?.Companies({
|
||||
key: 'companies_id',
|
||||
title: '所属机构',
|
||||
colProps: { span: 24 },
|
||||
formItemProps: { ...rulesHelper.number },
|
||||
}),
|
||||
{
|
||||
key: 'name',
|
||||
title: '项目名称',
|
||||
colProps: { span: 8 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'alias_name',
|
||||
title: '项目别名',
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
{
|
||||
key: 'code',
|
||||
title: '项目编码',
|
||||
colProps: { span: 8 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
MyFormItems.EnumRadio({
|
||||
key: 'property_type',
|
||||
title: '物业类型',
|
||||
colProps: { span: 24 },
|
||||
valueEnum: AssetProjectsPropertyTypeEnum,
|
||||
required: true,
|
||||
}),
|
||||
MyFormItems.EnumRadio({
|
||||
key: 'status',
|
||||
title: '状态',
|
||||
colProps: { span: 12 },
|
||||
valueEnum: AssetProjectsStatusEnum,
|
||||
required: true,
|
||||
}),
|
||||
MyFormItems.EnumRadio({
|
||||
key: 'charge',
|
||||
title: '收费方式',
|
||||
colProps: { span: 12 },
|
||||
valueEnum: AssetProjectsChargeEnum,
|
||||
required: true,
|
||||
}),
|
||||
|
||||
MyFormItems.EnumRadio({
|
||||
key: 'entrust_type',
|
||||
title: '委托类型',
|
||||
colProps: { span: 24 },
|
||||
valueEnum: AssetProjectsEntrustTypeEnum,
|
||||
required: true,
|
||||
}),
|
||||
|
||||
Address.Cascader({
|
||||
key: 'casacader',
|
||||
title: '选择地址',
|
||||
colProps: { span: 24 },
|
||||
keys: ['province', 'city', 'area', 'street'],
|
||||
required: true,
|
||||
}),
|
||||
{
|
||||
key: 'address',
|
||||
title: '详细地址',
|
||||
colProps: { span: 24 },
|
||||
},
|
||||
{
|
||||
key: 'longitude',
|
||||
title: '经度',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
key: 'latitude',
|
||||
title: '纬度',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
key: 'takeover_date',
|
||||
title: '接管日期',
|
||||
valueType: 'date',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
key: 'closure_date',
|
||||
title: '封园日期',
|
||||
valueType: 'date',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
77
src/pages/company/companies/index.tsx
Normal file
77
src/pages/company/companies/index.tsx
Normal file
@ -0,0 +1,77 @@
|
||||
import {
|
||||
MyButtons,
|
||||
MyColumns,
|
||||
MyPageContainer,
|
||||
MyProTableProps,
|
||||
} from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { CompaniesMerchantTypeEnum } from '@/gen/Enums';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import { Space } from 'antd';
|
||||
import Create from './modals/Create';
|
||||
import Update from './modals/Update';
|
||||
|
||||
export default function Index({ title = '机构管理' }) {
|
||||
return (
|
||||
<MyPageContainer title={title}>
|
||||
<ProTable
|
||||
{...MyProTableProps.props}
|
||||
search={false}
|
||||
request={async (params, sort) =>
|
||||
MyProTableProps.request(params, sort, Apis.Company.Companies.List)
|
||||
}
|
||||
toolBarRender={(action) => [
|
||||
<Create key="Create" reload={action?.reload} title={title} />,
|
||||
]}
|
||||
columns={[
|
||||
MyColumns.ID(),
|
||||
{
|
||||
title: '组织名称',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
{
|
||||
title: '组织简称',
|
||||
dataIndex: 'short_name',
|
||||
},
|
||||
MyColumns.EnumTag({
|
||||
title: '类型',
|
||||
dataIndex: 'merchant_type',
|
||||
valueEnum: CompaniesMerchantTypeEnum,
|
||||
}),
|
||||
{
|
||||
title: '营业执照号',
|
||||
dataIndex: 'business_license_number',
|
||||
},
|
||||
{
|
||||
title: '联系人',
|
||||
dataIndex: 'contact_name',
|
||||
},
|
||||
{
|
||||
title: '手机号',
|
||||
dataIndex: 'contact_phone',
|
||||
},
|
||||
{
|
||||
title: '联系人邮箱',
|
||||
dataIndex: 'contact_email',
|
||||
},
|
||||
MyColumns.UpdatedAt(),
|
||||
MyColumns.CreatedAt(),
|
||||
MyColumns.Option({
|
||||
render: (_, item: any, index, action) => (
|
||||
<Space key={index}>
|
||||
<Update item={item} reload={action?.reload} title={title} />
|
||||
<MyButtons.Delete
|
||||
onConfirm={() =>
|
||||
Apis.Common.Admins.Delete({ id: item.id }).then(() =>
|
||||
action?.reload(),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Space>
|
||||
),
|
||||
}),
|
||||
]}
|
||||
/>
|
||||
</MyPageContainer>
|
||||
);
|
||||
}
|
||||
104
src/pages/company/companies/modals/Create.tsx
Normal file
104
src/pages/company/companies/modals/Create.tsx
Normal file
@ -0,0 +1,104 @@
|
||||
import {
|
||||
MyBetaModalFormProps,
|
||||
MyButtons,
|
||||
MyFormItems,
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Address } from '@/components/Address';
|
||||
import { SysSelects } from '@/components/Select';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { CompaniesMerchantTypeEnum } from '@/gen/Enums';
|
||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||
import { message } from 'antd';
|
||||
|
||||
export default function Create(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.Company.Companies.Store>
|
||||
{...MyModalFormProps.props}
|
||||
title={`添加${props.title}`}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="800px"
|
||||
trigger={<MyButtons.Create title={`添加${props.title}`} />}
|
||||
onFinish={async (values) =>
|
||||
Apis.Company.Companies.Store(values)
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
return true;
|
||||
})
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
SysSelects?.Companies({
|
||||
key: 'parent_id',
|
||||
title: '上级组织',
|
||||
colProps: { span: 24 },
|
||||
}),
|
||||
{
|
||||
key: 'name',
|
||||
title: '组织名称',
|
||||
colProps: { span: 8 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'short_name',
|
||||
title: '组织简称',
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
{
|
||||
key: 'business_license_number',
|
||||
title: '营业执照号',
|
||||
colProps: { span: 8 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
|
||||
{
|
||||
key: 'contact_name',
|
||||
title: '联系人姓名',
|
||||
colProps: { span: 8 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'contact_phone',
|
||||
title: '联系人手机',
|
||||
colProps: { span: 8 },
|
||||
valueType: 'number',
|
||||
fieldProps: {
|
||||
maxLength: 11,
|
||||
},
|
||||
formItemProps: { ...rulesHelper.number },
|
||||
},
|
||||
{
|
||||
key: 'contact_email',
|
||||
title: '联系人邮箱',
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
{
|
||||
key: 'contact_address',
|
||||
title: '联系人地址',
|
||||
colProps: { span: 24 },
|
||||
},
|
||||
MyFormItems.EnumRadio({
|
||||
key: 'merchant_type',
|
||||
title: '商户类型',
|
||||
colProps: { span: 24 },
|
||||
valueEnum: CompaniesMerchantTypeEnum,
|
||||
required: true,
|
||||
}),
|
||||
Address.Cascader({
|
||||
key: 'casacader',
|
||||
title: '选择地址',
|
||||
colProps: { span: 24 },
|
||||
keys: ['province', 'city', 'area', 'street'],
|
||||
required: true,
|
||||
}),
|
||||
{
|
||||
key: 'address',
|
||||
title: '机构地址',
|
||||
colProps: { span: 24 },
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
115
src/pages/company/companies/modals/Update.tsx
Normal file
115
src/pages/company/companies/modals/Update.tsx
Normal file
@ -0,0 +1,115 @@
|
||||
import {
|
||||
MyBetaModalFormProps,
|
||||
MyButtons,
|
||||
MyFormItems,
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Address } from '@/components/Address';
|
||||
import { SysSelects } from '@/components/Select';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { CompaniesMerchantTypeEnum } from '@/gen/Enums';
|
||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||
import { message } from 'antd';
|
||||
|
||||
export default function Update(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.Company.Companies.Update>
|
||||
{...MyModalFormProps.props}
|
||||
title={`编辑${props.title}`}
|
||||
trigger={<MyButtons.Edit />}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="800px"
|
||||
request={() =>
|
||||
Promise.resolve({
|
||||
...props.item,
|
||||
casacader: [
|
||||
props.item?.province_id || '',
|
||||
props.item?.city_id || '',
|
||||
props.item?.area_id || '',
|
||||
props.item?.street_id || '',
|
||||
],
|
||||
})
|
||||
}
|
||||
onFinish={async (values) =>
|
||||
Apis.Company.Companies.Update({ ...values, id: props.item?.id ?? 0 })
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
return true;
|
||||
})
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
SysSelects?.Companies({
|
||||
key: 'parent_id',
|
||||
title: '上级组织',
|
||||
colProps: { span: 24 },
|
||||
}),
|
||||
{
|
||||
key: 'name',
|
||||
title: '组织名称',
|
||||
colProps: { span: 8 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'short_name',
|
||||
title: '组织简称',
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
{
|
||||
key: 'business_license_number',
|
||||
title: '营业执照号',
|
||||
colProps: { span: 8 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
|
||||
{
|
||||
key: 'contact_name',
|
||||
title: '联系人姓名',
|
||||
colProps: { span: 8 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'contact_phone',
|
||||
title: '联系人手机',
|
||||
colProps: { span: 8 },
|
||||
valueType: 'number',
|
||||
fieldProps: {
|
||||
maxLength: 11,
|
||||
},
|
||||
formItemProps: { ...rulesHelper.number },
|
||||
},
|
||||
{
|
||||
key: 'contact_email',
|
||||
title: '联系人邮箱',
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
{
|
||||
key: 'contact_address',
|
||||
title: '联系人地址',
|
||||
colProps: { span: 24 },
|
||||
},
|
||||
MyFormItems.EnumRadio({
|
||||
key: 'merchant_type',
|
||||
title: '商户类型',
|
||||
colProps: { span: 24 },
|
||||
valueEnum: CompaniesMerchantTypeEnum,
|
||||
required: true,
|
||||
}),
|
||||
Address.Cascader({
|
||||
key: 'casacader',
|
||||
title: '选择地址',
|
||||
colProps: { span: 24 },
|
||||
keys: ['province', 'city', 'area', 'street'],
|
||||
required: true,
|
||||
}),
|
||||
{
|
||||
key: 'address',
|
||||
title: '机构地址',
|
||||
colProps: { span: 24 },
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user