Merge branch 'develop' of ssh://code.juyouwu.cn:2222/pay/pay-admin into develop
# Conflicts: # src/gen/ApiTypes.d.ts # src/gen/Apis.ts
This commit is contained in:
commit
1cdddded82
@ -5,7 +5,7 @@ import { ProColumns, ProFormColumnsType } from '@ant-design/pro-components';
|
||||
type ReturnType = ProColumns<any, 'text'> & ProFormColumnsType<any, 'text'>;
|
||||
type PropsType = { required?: boolean } & ReturnType;
|
||||
|
||||
export const SysSelects = {
|
||||
export const Selects = {
|
||||
Companies(props?: PropsType): ReturnType {
|
||||
const {
|
||||
title = '机构',
|
||||
@ -21,13 +21,6 @@ export const SysSelects = {
|
||||
valueType: 'select',
|
||||
hideInTable: hideInTable,
|
||||
formItemProps: { ...(required ? rulesHelper.number : {}) },
|
||||
fieldProps: {
|
||||
showSearch: true,
|
||||
fieldNames: {
|
||||
label: 'label',
|
||||
value: 'value',
|
||||
},
|
||||
},
|
||||
request: async (params) =>
|
||||
(
|
||||
await Apis.Company.Companies.Select({
|
||||
@ -36,6 +29,14 @@ export const SysSelects = {
|
||||
})
|
||||
).data,
|
||||
...rest,
|
||||
fieldProps: {
|
||||
showSearch: true,
|
||||
fieldNames: {
|
||||
label: 'label',
|
||||
value: 'value',
|
||||
},
|
||||
...rest?.fieldProps,
|
||||
},
|
||||
};
|
||||
},
|
||||
// 楼栋下拉框
|
||||
@ -54,13 +55,6 @@ export const SysSelects = {
|
||||
valueType: 'select',
|
||||
hideInTable: hideInTable,
|
||||
formItemProps: { ...(required ? rulesHelper.number : {}) },
|
||||
fieldProps: {
|
||||
showSearch: true,
|
||||
fieldNames: {
|
||||
label: 'label',
|
||||
value: 'value',
|
||||
},
|
||||
},
|
||||
request: async (params) =>
|
||||
(
|
||||
await Apis.Asset.AssetBuildings.Select({
|
||||
@ -70,6 +64,14 @@ export const SysSelects = {
|
||||
})
|
||||
).data,
|
||||
...rest,
|
||||
fieldProps: {
|
||||
showSearch: true,
|
||||
fieldNames: {
|
||||
label: 'label',
|
||||
value: 'value',
|
||||
},
|
||||
...rest?.fieldProps,
|
||||
},
|
||||
};
|
||||
},
|
||||
// 单元下拉框
|
||||
@ -88,13 +90,6 @@ export const SysSelects = {
|
||||
valueType: 'select',
|
||||
hideInTable: hideInTable,
|
||||
formItemProps: { ...(required ? rulesHelper.number : {}) },
|
||||
fieldProps: {
|
||||
showSearch: true,
|
||||
fieldNames: {
|
||||
label: 'label',
|
||||
value: 'value',
|
||||
},
|
||||
},
|
||||
request: async (params) =>
|
||||
(
|
||||
await Apis.Asset.AssetUnits.Select({
|
||||
@ -105,6 +100,82 @@ export const SysSelects = {
|
||||
})
|
||||
).data,
|
||||
...rest,
|
||||
fieldProps: {
|
||||
showSearch: true,
|
||||
fieldNames: {
|
||||
label: 'label',
|
||||
value: 'value',
|
||||
},
|
||||
...rest?.fieldProps,
|
||||
},
|
||||
};
|
||||
},
|
||||
//组织
|
||||
Organizations(props?: PropsType): ReturnType {
|
||||
const {
|
||||
title = '组织',
|
||||
key = 'organizations_id',
|
||||
required = false,
|
||||
hideInTable = true,
|
||||
...rest
|
||||
} = props ?? {};
|
||||
|
||||
return {
|
||||
title: title,
|
||||
key: key,
|
||||
valueType: 'select',
|
||||
hideInTable: hideInTable,
|
||||
formItemProps: { ...(required ? rulesHelper.number : {}) },
|
||||
request: async (params) =>
|
||||
(
|
||||
await Apis.Company.Organizations.Select({
|
||||
keywords: params?.KeyWords,
|
||||
...params,
|
||||
})
|
||||
).data,
|
||||
...rest,
|
||||
fieldProps: {
|
||||
showSearch: true,
|
||||
fieldNames: {
|
||||
label: 'label',
|
||||
value: 'value',
|
||||
},
|
||||
...rest?.fieldProps,
|
||||
},
|
||||
};
|
||||
},
|
||||
//员工
|
||||
Employees(props?: PropsType): ReturnType {
|
||||
const {
|
||||
title = '员工',
|
||||
key = 'managers_id',
|
||||
required = false,
|
||||
hideInTable = true,
|
||||
...rest
|
||||
} = props ?? {};
|
||||
|
||||
return {
|
||||
title: title,
|
||||
key: key,
|
||||
valueType: 'select',
|
||||
hideInTable: hideInTable,
|
||||
formItemProps: { ...(required ? rulesHelper.number : {}) },
|
||||
request: async (params) =>
|
||||
(
|
||||
await Apis.Company.CompanyEmployees.Select({
|
||||
keywords: params?.KeyWords,
|
||||
...params,
|
||||
})
|
||||
).data,
|
||||
...rest,
|
||||
fieldProps: {
|
||||
showSearch: true,
|
||||
fieldNames: {
|
||||
label: 'label',
|
||||
value: 'value',
|
||||
},
|
||||
...rest?.fieldProps,
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
1
src/gen/ApiTypes.d.ts
vendored
1
src/gen/ApiTypes.d.ts
vendored
@ -433,7 +433,6 @@ declare namespace ApiTypes {
|
||||
};
|
||||
type Update = {
|
||||
"id": number; // id
|
||||
"companies_id": number; // 所属机构id,[ref:companies]
|
||||
"type": string; // 类型,[enum:OrganizationsTypeEnum]
|
||||
"name": string; // 名称
|
||||
"managers_id"?: number; // 负责人IDid,[ref:company_employees]
|
||||
|
||||
@ -5,7 +5,7 @@ import {
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { SysSelects } from '@/components/Select';
|
||||
import { Selects } from '@/components/Select';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import {
|
||||
AssetHousesOrientationEnum,
|
||||
@ -53,7 +53,7 @@ export default function Create(props: MyBetaModalFormProps) {
|
||||
{
|
||||
valueType: 'group',
|
||||
columns: [
|
||||
SysSelects?.AssetBuildings({
|
||||
Selects?.AssetBuildings({
|
||||
key: 'asset_buildings_id',
|
||||
title: '选择楼栋',
|
||||
params: {
|
||||
@ -71,7 +71,7 @@ export default function Create(props: MyBetaModalFormProps) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
SysSelects?.AssetUnits({
|
||||
Selects?.AssetUnits({
|
||||
key: 'asset_units_id',
|
||||
title: '选择单元',
|
||||
params: {
|
||||
|
||||
@ -5,7 +5,7 @@ import {
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { SysSelects } from '@/components/Select';
|
||||
import { Selects } from '@/components/Select';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import {
|
||||
AssetHousesOrientationEnum,
|
||||
@ -57,7 +57,7 @@ export default function Update(props: MyBetaModalFormProps) {
|
||||
{
|
||||
valueType: 'group',
|
||||
columns: [
|
||||
SysSelects?.AssetBuildings({
|
||||
Selects?.AssetBuildings({
|
||||
key: 'asset_buildings_id',
|
||||
title: '选择楼栋',
|
||||
params: {
|
||||
@ -75,7 +75,7 @@ export default function Update(props: MyBetaModalFormProps) {
|
||||
},
|
||||
},
|
||||
}),
|
||||
SysSelects?.AssetUnits({
|
||||
Selects?.AssetUnits({
|
||||
key: 'asset_units_id',
|
||||
title: '选择单元',
|
||||
params: {
|
||||
|
||||
@ -5,7 +5,7 @@ import {
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { SysSelects } from '@/components/Select';
|
||||
import { Selects } from '@/components/Select';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import {
|
||||
AssetUnitsBuildingStructureEnum,
|
||||
@ -47,7 +47,7 @@ export default function Create(props: MyBetaModalFormProps) {
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
SysSelects?.AssetBuildings({
|
||||
Selects?.AssetBuildings({
|
||||
key: 'asset_buildings_id',
|
||||
title: '选择楼栋',
|
||||
params:{
|
||||
|
||||
@ -5,7 +5,7 @@ import {
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { SysSelects } from '@/components/Select';
|
||||
import { Selects } from '@/components/Select';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import {
|
||||
AssetUnitsBuildingStructureEnum,
|
||||
@ -22,11 +22,7 @@ export default function Update(props: MyBetaModalFormProps) {
|
||||
title={`编辑`}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="700px"
|
||||
trigger={
|
||||
<MyButtons.Default
|
||||
title={`编辑` } size='small' type='link'
|
||||
/>
|
||||
}
|
||||
trigger={<MyButtons.Default title={`编辑`} size="small" type="link" />}
|
||||
form={form}
|
||||
onOpenChange={(open: any) => {
|
||||
if (open) {
|
||||
@ -38,7 +34,6 @@ export default function Update(props: MyBetaModalFormProps) {
|
||||
...values,
|
||||
asset_projects_id: props?.item?.asset_projects_id,
|
||||
id: props?.item?.id,
|
||||
|
||||
})
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
@ -48,13 +43,13 @@ export default function Update(props: MyBetaModalFormProps) {
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
SysSelects?.AssetBuildings({
|
||||
Selects?.AssetBuildings({
|
||||
key: 'asset_buildings_id',
|
||||
title: '选择楼栋',
|
||||
params:{
|
||||
params: {
|
||||
asset_projects_id: props?.item?.id,
|
||||
},
|
||||
colProps: { span:24 },
|
||||
colProps: { span: 24 },
|
||||
formItemProps: { ...rulesHelper.number },
|
||||
}),
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@ import {
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Address } from '@/components/Address';
|
||||
import { SysSelects } from '@/components/Select';
|
||||
import { Selects } from '@/components/Select';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import {
|
||||
AssetProjectsChargeEnum,
|
||||
@ -64,7 +64,7 @@ export default function Update(props: MyBetaModalFormProps) {
|
||||
title: '项目别名',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
SysSelects?.Companies({
|
||||
Selects?.Companies({
|
||||
key: 'companies_id',
|
||||
title: '所属机构',
|
||||
colProps: { span: 6 },
|
||||
|
||||
@ -6,7 +6,7 @@ import {
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Address } from '@/components/Address';
|
||||
import { SysSelects } from '@/components/Select';
|
||||
import { Selects } from '@/components/Select';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import {
|
||||
AssetProjectsChargeEnum,
|
||||
@ -35,7 +35,6 @@ export default function Create(props: MyBetaModalFormProps) {
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
|
||||
{
|
||||
key: 'name',
|
||||
title: '项目名称',
|
||||
@ -47,7 +46,7 @@ export default function Create(props: MyBetaModalFormProps) {
|
||||
title: '项目别名',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
SysSelects?.Companies({
|
||||
Selects?.Companies({
|
||||
key: 'companies_id',
|
||||
title: '所属机构',
|
||||
colProps: { span: 6 },
|
||||
@ -92,7 +91,7 @@ export default function Create(props: MyBetaModalFormProps) {
|
||||
MyFormItems.EnumSelect({
|
||||
key: 'status',
|
||||
title: '项目状态',
|
||||
colProps: { span:6 },
|
||||
colProps: { span: 6 },
|
||||
valueEnum: AssetProjectsStatusEnum,
|
||||
// required: true,
|
||||
}),
|
||||
|
||||
@ -1,7 +1,15 @@
|
||||
import { MyBetaModalFormProps, MyColumns, MyProTableProps } from '@/common';
|
||||
import {
|
||||
MyBetaModalFormProps,
|
||||
MyButtons,
|
||||
MyColumns,
|
||||
MyProTableProps,
|
||||
} from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { OrganizationsTypeEnum } from '@/gen/Enums';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import { Space } from 'antd';
|
||||
import OrganizationsCreate from '../modals/OrganizationsCreate';
|
||||
import OrganizationsUpdate from '../modals/OrganizationsUpdate';
|
||||
|
||||
export default function Organizations(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
@ -20,6 +28,7 @@ export default function Organizations(props: MyBetaModalFormProps) {
|
||||
<OrganizationsCreate
|
||||
key="Create"
|
||||
reload={action?.reload}
|
||||
item={props?.item}
|
||||
title="组织"
|
||||
/>,
|
||||
]}
|
||||
@ -27,10 +36,45 @@ export default function Organizations(props: MyBetaModalFormProps) {
|
||||
columns={[
|
||||
MyColumns.ID(),
|
||||
{
|
||||
title: '楼栋',
|
||||
width: '250px',
|
||||
title: '上级组织',
|
||||
dataIndex: ['organization_parent', 'name'],
|
||||
},
|
||||
{
|
||||
title: '组织',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
MyColumns.EnumTag({
|
||||
title: '类型',
|
||||
dataIndex: 'type',
|
||||
valueEnum: OrganizationsTypeEnum,
|
||||
}),
|
||||
{
|
||||
title: '负责人',
|
||||
dataIndex: ['manager', 'name'],
|
||||
},
|
||||
{
|
||||
title: '联系电话',
|
||||
dataIndex: 'manager_phone',
|
||||
},
|
||||
|
||||
MyColumns.Option({
|
||||
render: (_, item: any, index, action) => (
|
||||
<Space key={index}>
|
||||
<OrganizationsUpdate
|
||||
item={{ ...item, companies_id: props?.item?.id }}
|
||||
reload={action?.reload}
|
||||
title="组织"
|
||||
/>
|
||||
<MyButtons.Delete
|
||||
onConfirm={() =>
|
||||
Apis.Company.Organizations.Delete({ id: item.id }).then(
|
||||
() => action?.reload(),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Space>
|
||||
),
|
||||
}),
|
||||
]}
|
||||
/>
|
||||
</>
|
||||
|
||||
@ -5,22 +5,25 @@ import {
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Address } from '@/components/Address';
|
||||
import { Selects } from '@/components/Select';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { CompaniesMerchantTypeEnum } from '@/gen/Enums';
|
||||
import { OrganizationsTypeEnum } 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>
|
||||
<BetaSchemaForm<ApiTypes.Company.Organizations.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)
|
||||
Apis.Company.Organizations.Store({
|
||||
...values,
|
||||
companies_id: props?.item?.id,
|
||||
})
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
@ -29,69 +32,43 @@ export default function Create(props: MyBetaModalFormProps) {
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
Selects?.Organizations({
|
||||
title: '上级组织',
|
||||
key: 'parent_id',
|
||||
params: { companies_id: props?.item?.id },
|
||||
colProps: { span: 24 },
|
||||
}),
|
||||
{
|
||||
key: 'name',
|
||||
title: '机构名称',
|
||||
colProps: { span: 8 },
|
||||
title: '组织名称',
|
||||
colProps: { span: 24 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'short_name',
|
||||
title: '机构简称',
|
||||
MyFormItems.EnumRadio({
|
||||
key: 'type',
|
||||
title: '类型',
|
||||
colProps: { span: 24 },
|
||||
valueEnum: OrganizationsTypeEnum,
|
||||
required: true,
|
||||
}),
|
||||
Selects?.Employees({
|
||||
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: '联系人手机',
|
||||
key: 'manager_phone',
|
||||
title: '负责人手机',
|
||||
colProps: { span: 8 },
|
||||
valueType: 'number',
|
||||
fieldProps: {
|
||||
maxLength: 11,
|
||||
},
|
||||
formItemProps: { ...rulesHelper.number },
|
||||
},
|
||||
{
|
||||
key: 'contact_email',
|
||||
title: '联系人邮箱',
|
||||
key: 'manager_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 },
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
|
||||
82
src/pages/company/companies/modals/OrganizationsUpdate.tsx
Normal file
82
src/pages/company/companies/modals/OrganizationsUpdate.tsx
Normal file
@ -0,0 +1,82 @@
|
||||
import {
|
||||
MyBetaModalFormProps,
|
||||
MyButtons,
|
||||
MyFormItems,
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Selects } from '@/components/Select';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { OrganizationsTypeEnum } from '@/gen/Enums';
|
||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||
import { Form, message } from 'antd';
|
||||
|
||||
export default function Update(props: MyBetaModalFormProps) {
|
||||
const [form] = Form.useForm();
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.Company.Organizations.Update>
|
||||
{...MyModalFormProps.props}
|
||||
title={`编辑${props.title}`}
|
||||
form={form}
|
||||
trigger={<MyButtons.Edit />}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="800px"
|
||||
onOpenChange={(open: any) => {
|
||||
if (open && props.item) {
|
||||
form.setFieldsValue(props.item);
|
||||
}
|
||||
}}
|
||||
onFinish={async (values) =>
|
||||
Apis.Company.Organizations.Update({
|
||||
...values,
|
||||
id: props.item?.id ?? 0,
|
||||
})
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
return true;
|
||||
})
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
Selects?.Organizations({
|
||||
title: '上级组织',
|
||||
key: 'parent_id',
|
||||
params: { companies_id: props?.item?.companies_id },
|
||||
colProps: { span: 24 },
|
||||
}),
|
||||
{
|
||||
key: 'name',
|
||||
title: '组织名称',
|
||||
colProps: { span: 24 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
MyFormItems.EnumRadio({
|
||||
key: 'type',
|
||||
title: '类型',
|
||||
colProps: { span: 24 },
|
||||
valueEnum: OrganizationsTypeEnum,
|
||||
required: true,
|
||||
}),
|
||||
Selects?.Employees({
|
||||
title: '负责人',
|
||||
colProps: { span: 8 },
|
||||
}),
|
||||
{
|
||||
key: 'manager_phone',
|
||||
title: '负责人手机',
|
||||
colProps: { span: 8 },
|
||||
valueType: 'number',
|
||||
fieldProps: {
|
||||
maxLength: 11,
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'manager_email',
|
||||
title: '负责人邮箱',
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
67
src/pages/company/employees/index.tsx
Normal file
67
src/pages/company/employees/index.tsx
Normal file
@ -0,0 +1,67 @@
|
||||
import {
|
||||
MyButtons,
|
||||
MyColumns,
|
||||
MyPageContainer,
|
||||
MyProTableProps,
|
||||
} from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
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.CompanyEmployees.List,
|
||||
)
|
||||
}
|
||||
toolBarRender={(action) => [
|
||||
<Create key="Create" reload={action?.reload} title={title} />,
|
||||
]}
|
||||
columns={[
|
||||
MyColumns.ID(),
|
||||
{
|
||||
title: '姓名',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
{
|
||||
title: '手机号',
|
||||
dataIndex: 'phone',
|
||||
},
|
||||
{
|
||||
title: '机构',
|
||||
dataIndex: ['company', 'name'],
|
||||
},
|
||||
{
|
||||
title: '组织',
|
||||
dataIndex: ['organization', 'name'],
|
||||
},
|
||||
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>
|
||||
);
|
||||
}
|
||||
88
src/pages/company/employees/modals/Create.tsx
Normal file
88
src/pages/company/employees/modals/Create.tsx
Normal file
@ -0,0 +1,88 @@
|
||||
import {
|
||||
MyBetaModalFormProps,
|
||||
MyButtons,
|
||||
MyFormItems,
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Selects } from '@/components/Select';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { SexEnum } from '@/gen/Enums';
|
||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||
import { message } from 'antd';
|
||||
|
||||
export default function Create(props: MyBetaModalFormProps) {
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.Company.CompanyEmployees.Store>
|
||||
{...MyModalFormProps.props}
|
||||
title={`添加${props.title}`}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="500px"
|
||||
trigger={<MyButtons.Create title={`添加${props.title}`} />}
|
||||
onFinish={async (values) =>
|
||||
Apis.Company.CompanyEmployees.Store(values)
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
return true;
|
||||
})
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
Selects?.Companies({
|
||||
title: '机构',
|
||||
key: 'companies_id',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
}),
|
||||
{
|
||||
valueType: 'dependency',
|
||||
name: ['companies_id'],
|
||||
columns: ({ companies_id }) => [
|
||||
Selects?.Organizations({
|
||||
title: '所属组织',
|
||||
params: { companies_id: companies_id },
|
||||
key: 'organizations_id',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'name',
|
||||
title: '姓名',
|
||||
colProps: { span: 12 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'phone',
|
||||
title: '手机号',
|
||||
valueType: 'number',
|
||||
fieldProps: {
|
||||
maxLength: 11,
|
||||
},
|
||||
colProps: { span: 12 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
MyFormItems.EnumRadio({
|
||||
key: 'sex',
|
||||
title: '性别',
|
||||
colProps: { span: 24 },
|
||||
valueEnum: SexEnum,
|
||||
required: true,
|
||||
}),
|
||||
|
||||
{
|
||||
key: 'password',
|
||||
title: '密码',
|
||||
colProps: { span: 24 },
|
||||
valueType: 'password',
|
||||
},
|
||||
{
|
||||
key: 'remark',
|
||||
title: '备注',
|
||||
colProps: { span: 24 },
|
||||
valueType: 'textarea',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
101
src/pages/company/employees/modals/Update.tsx
Normal file
101
src/pages/company/employees/modals/Update.tsx
Normal file
@ -0,0 +1,101 @@
|
||||
import {
|
||||
MyBetaModalFormProps,
|
||||
MyButtons,
|
||||
MyFormItems,
|
||||
MyModalFormProps,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
|
||||
import { Selects } from '@/components/Select';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { SexEnum } from '@/gen/Enums';
|
||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||
import { Form, message } from 'antd';
|
||||
export default function Update(props: MyBetaModalFormProps) {
|
||||
const [form] = Form.useForm();
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.Company.CompanyEmployees.Update>
|
||||
{...MyModalFormProps.props}
|
||||
title={`编辑${props.title}`}
|
||||
trigger={<MyButtons.Edit />}
|
||||
wrapperCol={{ span: 24 }}
|
||||
width="500px"
|
||||
form={form}
|
||||
onOpenChange={(open: any) => {
|
||||
if (open && props.item) {
|
||||
form.setFieldsValue({
|
||||
...props.item,
|
||||
roles_id: props.item?.roles?.map((item: any) => item.value),
|
||||
});
|
||||
}
|
||||
}}
|
||||
onFinish={async (values) =>
|
||||
Apis.Company.CompanyEmployees.Update({
|
||||
...values,
|
||||
id: props.item?.id ?? 0,
|
||||
})
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success(props.title + '成功');
|
||||
return true;
|
||||
})
|
||||
.catch(() => false)
|
||||
}
|
||||
columns={[
|
||||
Selects?.Companies({
|
||||
title: '机构',
|
||||
key: 'companies_id',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
}),
|
||||
{
|
||||
valueType: 'dependency',
|
||||
name: ['companies_id'],
|
||||
columns: ({ companies_id }) => [
|
||||
Selects?.Organizations({
|
||||
title: '所属组织',
|
||||
params: { companies_id: companies_id },
|
||||
key: 'organizations_id',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'name',
|
||||
title: '姓名',
|
||||
colProps: { span: 12 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
key: 'phone',
|
||||
title: '手机号',
|
||||
valueType: 'number',
|
||||
fieldProps: {
|
||||
maxLength: 11,
|
||||
},
|
||||
colProps: { span: 12 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
MyFormItems.EnumRadio({
|
||||
key: 'sex',
|
||||
title: '性别',
|
||||
colProps: { span: 24 },
|
||||
valueEnum: SexEnum,
|
||||
required: true,
|
||||
}),
|
||||
|
||||
{
|
||||
key: 'password',
|
||||
title: '密码',
|
||||
colProps: { span: 24 },
|
||||
valueType: 'password',
|
||||
},
|
||||
{
|
||||
key: 'remark',
|
||||
title: '备注',
|
||||
colProps: { span: 24 },
|
||||
valueType: 'textarea',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user