fix:更新机构
This commit is contained in:
parent
5c244d1a72
commit
ede8af0d1f
@ -1,5 +1,4 @@
|
||||
{
|
||||
"url": "http://10.39.13.80:8003/api/docs/openapi",
|
||||
// "url": "http://we6f9c65.natappfree.cc/api/docs/openapi",
|
||||
"module": "Admin"
|
||||
}
|
||||
|
||||
113
src/gen/ApiTypes.d.ts
vendored
113
src/gen/ApiTypes.d.ts
vendored
@ -22,6 +22,10 @@ declare namespace ApiTypes {
|
||||
type Delete = {
|
||||
"id": number; // id
|
||||
};
|
||||
type Select = {
|
||||
"asset_projects_id"?: number; // 所属项目id,[ref:asset_projects]
|
||||
"keywords"?: string; // 关键词
|
||||
};
|
||||
}
|
||||
namespace AssetHouses {
|
||||
type List = {
|
||||
@ -35,7 +39,6 @@ declare namespace ApiTypes {
|
||||
"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; // 套内面积
|
||||
@ -81,13 +84,14 @@ declare namespace ApiTypes {
|
||||
}
|
||||
namespace AssetProjects {
|
||||
type List = {
|
||||
"companies_id"?: number; // 所属机构id,[ref:companies]
|
||||
"name"?: string; // 模糊搜索:名称
|
||||
};
|
||||
type Store = {
|
||||
"name": string; // 项目名称
|
||||
"alias_name"?: string; // 项目别名
|
||||
"code"?: string; // 项目编码
|
||||
"companies_id": number; // 所属机构id,[ref:companies]
|
||||
"companies_id"?: number; // 所属机构id,[ref:companies]
|
||||
"province"?: string; // 省
|
||||
"city"?: string; // 市
|
||||
"area"?: string; // 区
|
||||
@ -111,7 +115,7 @@ declare namespace ApiTypes {
|
||||
"name": string; // 项目名称
|
||||
"alias_name"?: string; // 项目别名
|
||||
"code"?: string; // 项目编码
|
||||
"companies_id": number; // 所属机构id,[ref:companies]
|
||||
"companies_id"?: number; // 所属机构id,[ref:companies]
|
||||
"province"?: string; // 省
|
||||
"city"?: string; // 市
|
||||
"area"?: string; // 区
|
||||
@ -142,6 +146,9 @@ declare namespace ApiTypes {
|
||||
type Delete = {
|
||||
"id": number; // id
|
||||
};
|
||||
type Select = {
|
||||
"keywords"?: string; // 关键词
|
||||
};
|
||||
}
|
||||
namespace AssetUnits {
|
||||
type List = {
|
||||
@ -178,6 +185,11 @@ declare namespace ApiTypes {
|
||||
type Delete = {
|
||||
"id": number; // id
|
||||
};
|
||||
type Select = {
|
||||
"asset_projects_id"?: number; // 所属项目id,[ref:asset_projects]
|
||||
"asset_buildings_id"?: number; // 所属楼栋id,[ref:asset_buildings]
|
||||
"keywords"?: string; // 关键词
|
||||
};
|
||||
}
|
||||
}
|
||||
namespace Common {
|
||||
@ -249,7 +261,7 @@ declare namespace ApiTypes {
|
||||
"business_license_image"?: string[]; // 营业执照图片
|
||||
"_lft"?: number; //
|
||||
"_rgt"?: number; //
|
||||
"parent_id"?: number; //
|
||||
"parent_id"?: number; // 上级 ID
|
||||
};
|
||||
type Update = {
|
||||
"id": number; // id
|
||||
@ -273,11 +285,7 @@ declare namespace ApiTypes {
|
||||
"business_license_image"?: string[]; // 营业执照图片
|
||||
"_lft"?: number; //
|
||||
"_rgt"?: number; //
|
||||
"parent_id"?: number; //
|
||||
};
|
||||
type Move = {
|
||||
"id": number; // ID
|
||||
"type": string; // 类型:up 升级,down 降级
|
||||
"parent_id"?: number; // 上级 ID
|
||||
};
|
||||
type Show = {
|
||||
"id": number; // id
|
||||
@ -294,9 +302,90 @@ declare namespace ApiTypes {
|
||||
type Select = {
|
||||
"keywords"?: string; // 关键词
|
||||
};
|
||||
type SelectTree = {
|
||||
"keywords"?: string; // -
|
||||
"parent_id"?: number; // -
|
||||
}
|
||||
namespace CompanyReceiptAccounts {
|
||||
type List = {
|
||||
"name"?: string; // 模糊搜索:名称
|
||||
};
|
||||
type Store = {
|
||||
"companies_id": number; // 所属机构id,[ref:companies]
|
||||
"company_name": string; // 企业名称
|
||||
"company_bank": string; // 企业开户行
|
||||
"company_account": string; // 企业账户
|
||||
"pay_channel": string; // 收款渠道,[enum:CompanyReceiptAccountsPayChannelEnum]
|
||||
"merchant_id"?: string; // 第三方支付的商户ID
|
||||
"is_default"?: number; // 是否默认收款账号
|
||||
};
|
||||
type Update = {
|
||||
"id": number; // id
|
||||
"companies_id": number; // 所属机构id,[ref:companies]
|
||||
"company_name": string; // 企业名称
|
||||
"company_bank": string; // 企业开户行
|
||||
"company_account": string; // 企业账户
|
||||
"pay_channel": string; // 收款渠道,[enum:CompanyReceiptAccountsPayChannelEnum]
|
||||
"merchant_id"?: string; // 第三方支付的商户ID
|
||||
"is_default"?: number; // 是否默认收款账号
|
||||
};
|
||||
type Show = {
|
||||
"id": number; // id
|
||||
};
|
||||
type SoftDelete = {
|
||||
"id": number; // id
|
||||
};
|
||||
type Restore = {
|
||||
"id": number; // id
|
||||
};
|
||||
type Delete = {
|
||||
"id": number; // id
|
||||
};
|
||||
}
|
||||
namespace Organizations {
|
||||
type List = {
|
||||
"name"?: string; // 模糊搜索:名称
|
||||
"companies_id"?: number; // 机构ID[ref:companies]
|
||||
};
|
||||
type Store = {
|
||||
"companies_id": number; // 所属机构id,[ref:companies]
|
||||
"type": string; // 类型,[enum:OrganizationsTypeEnum]
|
||||
"name": string; // 名称
|
||||
"managers_id": number; // 负责人IDid,[ref:company_employees]
|
||||
"manager_phone"?: string; // 负责人电话
|
||||
"manager_email"?: string; // 负责人邮箱
|
||||
"status"?: number; // 状态
|
||||
"sort"?: number; // 排序
|
||||
"_lft"?: number; //
|
||||
"_rgt"?: number; //
|
||||
"parent_id"?: number; //
|
||||
};
|
||||
type Update = {
|
||||
"id": number; // id
|
||||
"companies_id": number; // 所属机构id,[ref:companies]
|
||||
"type": string; // 类型,[enum:OrganizationsTypeEnum]
|
||||
"name": string; // 名称
|
||||
"managers_id": number; // 负责人IDid,[ref:company_employees]
|
||||
"manager_phone"?: string; // 负责人电话
|
||||
"manager_email"?: string; // 负责人邮箱
|
||||
"status"?: number; // 状态
|
||||
"sort"?: number; // 排序
|
||||
"_lft"?: number; //
|
||||
"_rgt"?: number; //
|
||||
"parent_id"?: number; // 上级 ID
|
||||
};
|
||||
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
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,6 +19,9 @@ export const Apis = {
|
||||
Delete(data: ApiTypes.Asset.AssetBuildings.Delete): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_buildings/delete', { data });
|
||||
},
|
||||
Select(data?: ApiTypes.Asset.AssetBuildings.Select): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_buildings/select', { data });
|
||||
},
|
||||
},
|
||||
AssetHouses: {
|
||||
List(data?: ApiTypes.Asset.AssetHouses.List): Promise<MyResponseType> {
|
||||
@ -59,6 +62,9 @@ export const Apis = {
|
||||
Delete(data: ApiTypes.Asset.AssetProjects.Delete): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_projects/delete', { data });
|
||||
},
|
||||
Select(data?: ApiTypes.Asset.AssetProjects.Select): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_projects/select', { data });
|
||||
},
|
||||
},
|
||||
AssetUnits: {
|
||||
List(data?: ApiTypes.Asset.AssetUnits.List): Promise<MyResponseType> {
|
||||
@ -76,6 +82,9 @@ export const Apis = {
|
||||
Delete(data: ApiTypes.Asset.AssetUnits.Delete): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_units/delete', { data });
|
||||
},
|
||||
Select(data?: ApiTypes.Asset.AssetUnits.Select): Promise<MyResponseType> {
|
||||
return request('admin/asset/asset_units/select', { data });
|
||||
},
|
||||
},
|
||||
},
|
||||
Common: {
|
||||
@ -131,9 +140,6 @@ export const Apis = {
|
||||
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 });
|
||||
},
|
||||
@ -149,8 +155,54 @@ export const Apis = {
|
||||
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 });
|
||||
},
|
||||
CompanyReceiptAccounts: {
|
||||
List(data?: ApiTypes.Company.CompanyReceiptAccounts.List): Promise<MyResponseType> {
|
||||
return request('admin/company/company_receipt_accounts/list', { data });
|
||||
},
|
||||
Store(data: ApiTypes.Company.CompanyReceiptAccounts.Store): Promise<MyResponseType> {
|
||||
return request('admin/company/company_receipt_accounts/store', { data });
|
||||
},
|
||||
Update(data: ApiTypes.Company.CompanyReceiptAccounts.Update): Promise<MyResponseType> {
|
||||
return request('admin/company/company_receipt_accounts/update', { data });
|
||||
},
|
||||
Show(data: ApiTypes.Company.CompanyReceiptAccounts.Show): Promise<MyResponseType> {
|
||||
return request('admin/company/company_receipt_accounts/show', { data });
|
||||
},
|
||||
SoftDelete(data: ApiTypes.Company.CompanyReceiptAccounts.SoftDelete): Promise<MyResponseType> {
|
||||
return request('admin/company/company_receipt_accounts/soft_delete', { data });
|
||||
},
|
||||
Restore(data: ApiTypes.Company.CompanyReceiptAccounts.Restore): Promise<MyResponseType> {
|
||||
return request('admin/company/company_receipt_accounts/restore', { data });
|
||||
},
|
||||
Delete(data: ApiTypes.Company.CompanyReceiptAccounts.Delete): Promise<MyResponseType> {
|
||||
return request('admin/company/company_receipt_accounts/delete', { data });
|
||||
},
|
||||
},
|
||||
Organizations: {
|
||||
List(data?: ApiTypes.Company.Organizations.List): Promise<MyResponseType> {
|
||||
return request('admin/company/organizations/list', { data });
|
||||
},
|
||||
Store(data: ApiTypes.Company.Organizations.Store): Promise<MyResponseType> {
|
||||
return request('admin/company/organizations/store', { data });
|
||||
},
|
||||
Update(data: ApiTypes.Company.Organizations.Update): Promise<MyResponseType> {
|
||||
return request('admin/company/organizations/update', { data });
|
||||
},
|
||||
Move(data: ApiTypes.Company.Organizations.Move): Promise<MyResponseType> {
|
||||
return request('admin/company/organizations/move', { data });
|
||||
},
|
||||
Show(data: ApiTypes.Company.Organizations.Show): Promise<MyResponseType> {
|
||||
return request('admin/company/organizations/show', { data });
|
||||
},
|
||||
SoftDelete(data: ApiTypes.Company.Organizations.SoftDelete): Promise<MyResponseType> {
|
||||
return request('admin/company/organizations/soft_delete', { data });
|
||||
},
|
||||
Restore(data: ApiTypes.Company.Organizations.Restore): Promise<MyResponseType> {
|
||||
return request('admin/company/organizations/restore', { data });
|
||||
},
|
||||
Delete(data: ApiTypes.Company.Organizations.Delete): Promise<MyResponseType> {
|
||||
return request('admin/company/organizations/delete', { data });
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@ -53,7 +53,7 @@ export const AssetProjectsChargeEnum= {
|
||||
|
||||
// AssetProjectsEntrustTypeEnum
|
||||
export const AssetProjectsEntrustTypeEnum= {
|
||||
'DeveloperJointEntrust': {"text":"开发商合委","color":"#007bff","value":"DeveloperJointEntrust"},
|
||||
'DeveloperJointEntrust': {"text":"开发商全委","color":"#007bff","value":"DeveloperJointEntrust"},
|
||||
'OwnersFullEntrust': {"text":"业委会全委","color":"#28a745","value":"OwnersFullEntrust"},
|
||||
'GovernmentFullEntrust': {"text":"政府类全委","color":"#ffc107","value":"GovernmentFullEntrust"},
|
||||
};
|
||||
@ -100,6 +100,22 @@ export const CompaniesMerchantTypeEnum= {
|
||||
'ServiceProvider': {"text":"服务商","color":"#28a745","value":"ServiceProvider"},
|
||||
};
|
||||
|
||||
// CompanyReceiptAccountsPayChannelEnum
|
||||
export const CompanyReceiptAccountsPayChannelEnum= {
|
||||
'WeChat': {"text":"微信","color":"#07c160","value":"WeChat"},
|
||||
'Alipay': {"text":"支付宝","color":"#1677ff","value":"Alipay"},
|
||||
'BankTransfer': {"text":"银行转账","color":"#6c757d","value":"BankTransfer"},
|
||||
'TongLian': {"text":"通联支付","color":"#ff9f0a","value":"TongLian"},
|
||||
};
|
||||
|
||||
// OrganizationsTypeEnum
|
||||
export const OrganizationsTypeEnum= {
|
||||
'Group': {"text":"集团","color":"#007bff","value":"Group"},
|
||||
'Company': {"text":"公司","color":"#28a745","value":"Company"},
|
||||
'ManagementOffice': {"text":"管理处","color":"#ffc107","value":"ManagementOffice"},
|
||||
'Department': {"text":"部门","color":"#dc3545","value":"Department"},
|
||||
};
|
||||
|
||||
// SysModuleEnum
|
||||
export const SysModuleEnum= {
|
||||
'Admin': {"text":"管理员","color":"#cf1322","value":"Admin"},
|
||||
|
||||
38
src/pages/company/companies/$id.tsx
Normal file
38
src/pages/company/companies/$id.tsx
Normal file
@ -0,0 +1,38 @@
|
||||
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 Organizations from './components/Organizations';
|
||||
|
||||
export default function Show({ title = '机构详情' }) {
|
||||
const { id } = useParams<{ id: string }>();
|
||||
const [data, setShow] = useState<any>({});
|
||||
|
||||
const loadShow = () => {
|
||||
let paramsId: any = { id: id ?? 0 };
|
||||
Apis.Company.Companies.Show(paramsId).then((res) => {
|
||||
setShow(res?.data);
|
||||
});
|
||||
};
|
||||
useEffect(() => {
|
||||
loadShow();
|
||||
}, [id]);
|
||||
|
||||
let items = [
|
||||
{
|
||||
label: '组织',
|
||||
key: '1',
|
||||
closable: false,
|
||||
children: <Organizations item={data} />,
|
||||
},
|
||||
];
|
||||
return (
|
||||
<MyPageContainer title={title}>
|
||||
<ProCard>
|
||||
<Tabs type="card" items={data?.id ? items : []} />
|
||||
</ProCard>
|
||||
</MyPageContainer>
|
||||
);
|
||||
}
|
||||
38
src/pages/company/companies/components/Organizations.tsx
Normal file
38
src/pages/company/companies/components/Organizations.tsx
Normal file
@ -0,0 +1,38 @@
|
||||
import { MyBetaModalFormProps, MyColumns, MyProTableProps } from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import OrganizationsCreate from '../modals/OrganizationsCreate';
|
||||
|
||||
export default function Organizations(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<>
|
||||
<ProTable
|
||||
{...MyProTableProps.props}
|
||||
search={false}
|
||||
request={async (params, sort) =>
|
||||
MyProTableProps.request(
|
||||
{ ...params, companies_id: props?.item?.id },
|
||||
sort,
|
||||
Apis.Company.Organizations.List,
|
||||
)
|
||||
}
|
||||
toolBarRender={(action) => [
|
||||
<OrganizationsCreate
|
||||
key="Create"
|
||||
reload={action?.reload}
|
||||
title="组织"
|
||||
/>,
|
||||
]}
|
||||
options={false}
|
||||
columns={[
|
||||
MyColumns.ID(),
|
||||
{
|
||||
title: '楼栋',
|
||||
width: '250px',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@ -7,11 +7,12 @@ import {
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { CompaniesMerchantTypeEnum } from '@/gen/Enums';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import { useNavigate } from '@umijs/max';
|
||||
import { Space } from 'antd';
|
||||
import Create from './modals/Create';
|
||||
import Update from './modals/Update';
|
||||
|
||||
export default function Index({ title = '机构管理' }) {
|
||||
const navigate = useNavigate();
|
||||
return (
|
||||
<MyPageContainer title={title}>
|
||||
<ProTable
|
||||
@ -59,7 +60,13 @@ export default function Index({ title = '机构管理' }) {
|
||||
MyColumns.Option({
|
||||
render: (_, item: any, index, action) => (
|
||||
<Space key={index}>
|
||||
<Update item={item} reload={action?.reload} title={title} />
|
||||
{/* <Update item={item} reload={action?.reload} title={title} /> */}
|
||||
<MyButtons.View
|
||||
title="详情"
|
||||
onClick={() => {
|
||||
navigate(`/company/companies/${item.id}`);
|
||||
}}
|
||||
/>
|
||||
<MyButtons.Delete
|
||||
onConfirm={() =>
|
||||
Apis.Common.Admins.Delete({ id: item.id }).then(() =>
|
||||
|
||||
98
src/pages/company/companies/modals/OrganizationsCreate.tsx
Normal file
98
src/pages/company/companies/modals/OrganizationsCreate.tsx
Normal file
@ -0,0 +1,98 @@
|
||||
import {
|
||||
MyBetaModalFormProps,
|
||||
MyButtons,
|
||||
MyFormItems,
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Address } from '@/components/Address';
|
||||
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={[
|
||||
{
|
||||
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