fix;岗位

This commit is contained in:
uiujun 2025-07-01 10:40:00 +08:00
parent 3e0e4ed472
commit ec00312701
11 changed files with 467 additions and 17 deletions

View File

@ -29,7 +29,7 @@ export default function Create(props: MyBetaModalFormProps) {
values?.grid_ranges?.map((res: { asset_projects_id: string }) => { values?.grid_ranges?.map((res: { asset_projects_id: string }) => {
res.asset_projects_id = props?.item?.id; res.asset_projects_id = props?.item?.id;
}); });
Apis.Grid.Grids.Store({ return Apis.Grid.Grids.Store({
...values, ...values,
asset_projects_id: props?.item?.id, asset_projects_id: props?.item?.id,
}) })

View File

@ -6,6 +6,8 @@ import { Tabs } from 'antd';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import ComponentsInfo from './components/ComponentsInfo'; import ComponentsInfo from './components/ComponentsInfo';
import Organizations from './components/Organizations'; import Organizations from './components/Organizations';
import Positions from './components/Positions';
import Projects from './components/Projects';
export default function Show({ title = '机构详情' }) { export default function Show({ title = '机构详情' }) {
const { id } = useParams<{ id: string }>(); const { id } = useParams<{ id: string }>();
const [data, setShow] = useState<any>({}); const [data, setShow] = useState<any>({});
@ -28,11 +30,29 @@ export default function Show({ title = '机构详情' }) {
children: <ComponentsInfo item={data} reload={() => loadShow()} />, children: <ComponentsInfo item={data} reload={() => loadShow()} />,
}, },
{ {
label: '组织', label: '项目管理',
key: '2', key: '2',
closable: false, closable: false,
children: <Projects item={data} />,
},
{
label: '组织管理',
key: '3',
closable: false,
children: <Organizations item={data} />, children: <Organizations item={data} />,
}, },
{
label: '员工管理',
key: '4',
closable: false,
// children: <Employees item={data} />,
},
{
label: '岗位管理',
key: '5',
closable: false,
children: <Positions item={data} />,
},
]; ];
return ( return (
<MyPageContainer title={title}> <MyPageContainer title={title}>

View File

@ -0,0 +1,76 @@
import {
MyBetaModalFormProps,
MyButtons,
MyColumns,
MyProTableProps,
} from '@/common';
import { Apis } from '@/gen/Apis';
import { ProTable } from '@ant-design/pro-components';
import { Space } from 'antd';
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.CompanyPositions.List,
)
}
toolBarRender={(action) => [
<OrganizationsCreate
key="Create"
reload={action?.reload}
item={props?.item}
title="组织"
/>,
]}
options={false}
columns={[
MyColumns.ID(),
{
title: '岗位名称',
dataIndex: 'name',
},
{
title: '岗位编号',
dataIndex: 'code',
search: false,
},
{
title: '岗位排序',
dataIndex: 'sort',
search: false,
},
{
title: '备注',
dataIndex: 'remark',
search: false,
},
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>
),
}),
]}
/>
</>
);
}

View File

@ -0,0 +1,82 @@
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 (
<>
<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}
item={props?.item}
title="组织"
/>,
]}
options={false}
columns={[
MyColumns.ID(),
{
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>
),
}),
]}
/>
</>
);
}

View File

@ -0,0 +1,62 @@
import {
MyBetaModalFormProps,
MyButtons,
MyModalFormProps,
rulesHelper,
} from '@/common';
import { Selects } from '@/components/Select';
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.Company.CompanyPositions.Store>
{...MyModalFormProps.props}
title={`添加${props.title}`}
wrapperCol={{ span: 24 }}
width="500px"
trigger={<MyButtons.Create title={`添加${props.title}`} />}
onFinish={async (values) =>
Apis.Company.CompanyPositions.Store(values)
.then(() => {
props.reload?.();
message.success(props.title + '成功');
return true;
})
.catch(() => false)
}
columns={[
Selects?.Companies({
title: '机构',
key: 'companies_id',
formItemProps: { ...rulesHelper.text },
}),
{
key: 'name',
title: '岗位名称',
colProps: { span: 12 },
formItemProps: { ...rulesHelper.text },
},
{
key: 'code',
title: '岗位编号',
colProps: { span: 12 },
// formItemProps: { ...rulesHelper.text },
},
// {
// key: 'sort',
// title: '岗位排序',
// colProps: { span: 24 },
// valueType: 'number',
// },
{
key: 'remark',
title: '备注',
colProps: { span: 24 },
valueType: 'textarea',
},
]}
/>
);
}

View File

@ -10,12 +10,12 @@ import { Space } from 'antd';
import Create from './modals/Create'; import Create from './modals/Create';
import Update from './modals/Update'; import Update from './modals/Update';
export default function Index({ title = '管理' }) { export default function Index({ title = '员工管理' }) {
return ( return (
<MyPageContainer title={title}> <MyPageContainer title={title}>
<ProTable <ProTable
{...MyProTableProps.props} {...MyProTableProps.props}
search={false} // search={false}
request={async (params, sort) => request={async (params, sort) =>
MyProTableProps.request( MyProTableProps.request(
params, params,
@ -40,10 +40,10 @@ export default function Index({ title = '管理员' }) {
title: '机构', title: '机构',
dataIndex: ['company', 'name'], dataIndex: ['company', 'name'],
}, },
{ // {
title: '组织', // title: '组织',
dataIndex: ['organization', 'name'], // dataIndex: ['organization', 'name'],
}, // },
MyColumns.UpdatedAt(), MyColumns.UpdatedAt(),
MyColumns.CreatedAt(), MyColumns.CreatedAt(),
MyColumns.Option({ MyColumns.Option({

View File

@ -15,10 +15,10 @@ export default function Create(props: MyBetaModalFormProps) {
return ( return (
<BetaSchemaForm<ApiTypes.Company.CompanyEmployees.Store> <BetaSchemaForm<ApiTypes.Company.CompanyEmployees.Store>
{...MyModalFormProps.props} {...MyModalFormProps.props}
title={`添加${props.title}`} title={`添加员工`}
wrapperCol={{ span: 24 }} wrapperCol={{ span: 24 }}
width="500px" width="500px"
trigger={<MyButtons.Create title={`添加${props.title}`} />} trigger={<MyButtons.Create title={`添加`} />}
onFinish={async (values) => onFinish={async (values) =>
Apis.Company.CompanyEmployees.Store(values) Apis.Company.CompanyEmployees.Store(values)
.then(() => { .then(() => {
@ -30,7 +30,7 @@ export default function Create(props: MyBetaModalFormProps) {
} }
columns={[ columns={[
Selects?.Companies({ Selects?.Companies({
title: '机构', title: '所属机构',
key: 'companies_id', key: 'companies_id',
formItemProps: { ...rulesHelper.text }, formItemProps: { ...rulesHelper.text },
}), }),
@ -49,7 +49,7 @@ export default function Create(props: MyBetaModalFormProps) {
{ {
key: 'name', key: 'name',
title: '姓名', title: '姓名',
colProps: { span: 12 }, colProps: { span: 6 },
formItemProps: { ...rulesHelper.text }, formItemProps: { ...rulesHelper.text },
}, },
{ {
@ -65,7 +65,7 @@ export default function Create(props: MyBetaModalFormProps) {
MyFormItems.EnumRadio({ MyFormItems.EnumRadio({
key: 'sex', key: 'sex',
title: '性别', title: '性别',
colProps: { span: 24 }, colProps: { span: 6 },
valueEnum: SexEnum, valueEnum: SexEnum,
required: true, required: true,
}), }),

View File

@ -16,7 +16,7 @@ export default function Update(props: MyBetaModalFormProps) {
return ( return (
<BetaSchemaForm<ApiTypes.Company.CompanyEmployees.Update> <BetaSchemaForm<ApiTypes.Company.CompanyEmployees.Update>
{...MyModalFormProps.props} {...MyModalFormProps.props}
title={`编辑${props.title}`} title={`编辑员工`}
trigger={<MyButtons.Edit />} trigger={<MyButtons.Edit />}
wrapperCol={{ span: 24 }} wrapperCol={{ span: 24 }}
width="500px" width="500px"
@ -43,7 +43,7 @@ export default function Update(props: MyBetaModalFormProps) {
} }
columns={[ columns={[
Selects?.Companies({ Selects?.Companies({
title: '机构', title: '所属机构',
key: 'companies_id', key: 'companies_id',
formItemProps: { ...rulesHelper.text }, formItemProps: { ...rulesHelper.text },
}), }),
@ -62,7 +62,7 @@ export default function Update(props: MyBetaModalFormProps) {
{ {
key: 'name', key: 'name',
title: '姓名', title: '姓名',
colProps: { span: 12 }, colProps: { span: 6 },
formItemProps: { ...rulesHelper.text }, formItemProps: { ...rulesHelper.text },
}, },
{ {
@ -78,7 +78,7 @@ export default function Update(props: MyBetaModalFormProps) {
MyFormItems.EnumRadio({ MyFormItems.EnumRadio({
key: 'sex', key: 'sex',
title: '性别', title: '性别',
colProps: { span: 24 }, colProps: { span: 6 },
valueEnum: SexEnum, valueEnum: SexEnum,
required: true, required: true,
}), }),

View File

@ -0,0 +1,74 @@
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.CompanyPositions.List,
)
}
toolBarRender={(action) => [
<Create key="Create" reload={action?.reload} title={title} />,
]}
columns={[
MyColumns.ID(),
{
title: '机构',
dataIndex: ['company', 'name'],
},
{
title: '岗位名称',
dataIndex: 'name',
},
{
title: '岗位编号',
dataIndex: 'code',
search: false,
},
{
title: '岗位排序',
dataIndex: 'sort',
search: false,
},
{
title: '备注',
dataIndex: 'remark',
search: false,
},
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>
);
}

View File

@ -0,0 +1,62 @@
import {
MyBetaModalFormProps,
MyButtons,
MyModalFormProps,
rulesHelper,
} from '@/common';
import { Selects } from '@/components/Select';
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.Company.CompanyPositions.Store>
{...MyModalFormProps.props}
title={`添加${props.title}`}
wrapperCol={{ span: 24 }}
width="500px"
trigger={<MyButtons.Create title={`添加${props.title}`} />}
onFinish={async (values) =>
Apis.Company.CompanyPositions.Store(values)
.then(() => {
props.reload?.();
message.success(props.title + '成功');
return true;
})
.catch(() => false)
}
columns={[
Selects?.Companies({
title: '机构',
key: 'companies_id',
formItemProps: { ...rulesHelper.text },
}),
{
key: 'name',
title: '岗位名称',
colProps: { span: 12 },
formItemProps: { ...rulesHelper.text },
},
{
key: 'code',
title: '岗位编号',
colProps: { span: 12 },
// formItemProps: { ...rulesHelper.text },
},
// {
// key: 'sort',
// title: '岗位排序',
// colProps: { span: 24 },
// valueType: 'number',
// },
{
key: 'remark',
title: '备注',
colProps: { span: 24 },
valueType: 'textarea',
},
]}
/>
);
}

View File

@ -0,0 +1,74 @@
import {
MyBetaModalFormProps,
MyButtons,
MyModalFormProps,
rulesHelper,
} from '@/common';
import { Selects } from '@/components/Select';
import { Apis } from '@/gen/Apis';
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.CompanyPositions.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,
});
}
}}
onFinish={async (values) =>
Apis.Company.CompanyPositions.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 },
}),
{
key: 'name',
title: '岗位名称',
colProps: { span: 12 },
formItemProps: { ...rulesHelper.text },
},
{
key: 'code',
title: '岗位编号',
colProps: { span: 12 },
// formItemProps: { ...rulesHelper.text },
},
// {
// key: 'sort',
// title: '岗位排序',
// colProps: { span: 24 },
// valueType: 'number',
// },
{
key: 'remark',
title: '备注',
colProps: { span: 24 },
valueType: 'textarea',
},
]}
/>
);
}