Compare commits

..

No commits in common. "49818c2c9f09833a29a1fd378ab2f0daf74162f2" and "8c73e695e2d84848d5ef8efeb1cd58a8946fdcfd" have entirely different histories.

6 changed files with 123 additions and 42 deletions

View File

@ -16,7 +16,7 @@ export default function Organizations(props: MyBetaModalFormProps) {
<> <>
<ProTable <ProTable
{...MyProTableProps.props} {...MyProTableProps.props}
// search={false} search={false}
request={async (params, sort) => request={async (params, sort) =>
MyProTableProps.request( MyProTableProps.request(
{ ...params, companies_id: props?.item?.id }, { ...params, companies_id: props?.item?.id },
@ -34,34 +34,28 @@ export default function Organizations(props: MyBetaModalFormProps) {
]} ]}
options={false} options={false}
columns={[ columns={[
{ MyColumns.ID(),
title: '组织ID',
dataIndex: 'id',
search: false,
},
{ {
title: '上级组织', title: '上级组织',
dataIndex: ['organization_parent', 'name'], dataIndex: ['organization_parent', 'name'],
search: false,
}, },
{ {
title: '组织名称', title: '组织',
dataIndex: 'name', dataIndex: 'name',
}, },
MyColumns.EnumTag({ MyColumns.EnumTag({
title: '组织类型', title: '类型',
dataIndex: 'type', dataIndex: 'type',
valueEnum: OrganizationsTypeEnum, valueEnum: OrganizationsTypeEnum,
search: false,
}), }),
// { {
// title: '负责人', title: '负责人',
// dataIndex: ['manager', 'name'], dataIndex: ['manager', 'name'],
// }, },
// { {
// title: '联系电话', title: '联系电话',
// dataIndex: 'manager_phone', dataIndex: 'manager_phone',
// }, },
MyColumns.Option({ MyColumns.Option({
render: (_, item: any, index, action) => ( render: (_, item: any, index, action) => (

View File

@ -7,8 +7,7 @@ import {
import { Apis } from '@/gen/Apis'; import { Apis } from '@/gen/Apis';
import { ProTable } from '@ant-design/pro-components'; import { ProTable } from '@ant-design/pro-components';
import { Space } from 'antd'; import { Space } from 'antd';
import PositionsCreate from '../modals/PositionsCreate'; import OrganizationsCreate from '../modals/OrganizationsCreate';
import PositionsUpdate from '../modals/PositionsUpdate';
export default function Organizations(props: MyBetaModalFormProps) { export default function Organizations(props: MyBetaModalFormProps) {
return ( return (
@ -24,14 +23,14 @@ export default function Organizations(props: MyBetaModalFormProps) {
) )
} }
toolBarRender={(action) => [ toolBarRender={(action) => [
<PositionsCreate <OrganizationsCreate
key="Create" key="Create"
reload={action?.reload} reload={action?.reload}
item={props?.item} item={props?.item}
title="组织" title="组织"
/>, />,
]} ]}
// options={false} options={false}
columns={[ columns={[
MyColumns.ID(), MyColumns.ID(),
@ -59,15 +58,11 @@ export default function Organizations(props: MyBetaModalFormProps) {
MyColumns.Option({ MyColumns.Option({
render: (_, item: any, index, action) => ( render: (_, item: any, index, action) => (
<Space key={index}> <Space key={index}>
<PositionsUpdate {/* <Update item={item} reload={action?.reload} title={title} /> */}
item={item}
reload={action?.reload}
title="岗位"
/>
<MyButtons.Delete <MyButtons.Delete
onConfirm={() => onConfirm={() =>
Apis.Company.CompanyPositions.Delete({ id: item.id }).then( Apis.Common.Admins.Delete({ id: item.id }).then(() =>
() => action?.reload(), action?.reload(),
) )
} }
/> />

View File

@ -4,6 +4,7 @@ import {
MyModalFormProps, MyModalFormProps,
rulesHelper, rulesHelper,
} from '@/common'; } from '@/common';
import { Selects } from '@/components/Select';
import { Apis } from '@/gen/Apis'; import { Apis } from '@/gen/Apis';
import { BetaSchemaForm } from '@ant-design/pro-components'; import { BetaSchemaForm } from '@ant-design/pro-components';
import { message } from 'antd'; import { message } from 'antd';
@ -12,15 +13,12 @@ export default function Create(props: MyBetaModalFormProps) {
return ( return (
<BetaSchemaForm<ApiTypes.Company.CompanyPositions.Store> <BetaSchemaForm<ApiTypes.Company.CompanyPositions.Store>
{...MyModalFormProps.props} {...MyModalFormProps.props}
title={`添加岗位`} title={`添加${props.title}`}
wrapperCol={{ span: 24 }} wrapperCol={{ span: 24 }}
width="500px" width="500px"
trigger={<MyButtons.Create title={`添加岗位`} />} trigger={<MyButtons.Create title={`添加${props.title}`} />}
onFinish={async (values) => onFinish={async (values) =>
Apis.Company.CompanyPositions.Store({ Apis.Company.CompanyPositions.Store(values)
...values,
companies_id: props?.item?.id,
})
.then(() => { .then(() => {
props.reload?.(); props.reload?.();
message.success(props.title + '成功'); message.success(props.title + '成功');
@ -29,11 +27,11 @@ export default function Create(props: MyBetaModalFormProps) {
.catch(() => false) .catch(() => false)
} }
columns={[ columns={[
// Selects?.Companies({ Selects?.Companies({
// title: '机构', title: '机构',
// key: 'companies_id', key: 'companies_id',
// formItemProps: { ...rulesHelper.text }, formItemProps: { ...rulesHelper.text },
// }), }),
{ {
key: 'name', key: 'name',
title: '岗位名称', title: '岗位名称',

View File

@ -0,0 +1,25 @@
import { MyPageContainer, MyProTableProps } from '@/common';
import { Apis } from '@/gen/Apis';
import { ProTable } from '@ant-design/pro-components';
import Create from './modals/Create';
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} />,
]}
/>
</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

@ -5,6 +5,7 @@ import {
rulesHelper, rulesHelper,
} from '@/common'; } from '@/common';
import { Selects } from '@/components/Select';
import { Apis } from '@/gen/Apis'; import { Apis } from '@/gen/Apis';
import { BetaSchemaForm } from '@ant-design/pro-components'; import { BetaSchemaForm } from '@ant-design/pro-components';
import { Form, message } from 'antd'; import { Form, message } from 'antd';
@ -20,13 +21,14 @@ export default function Update(props: MyBetaModalFormProps) {
form={form} form={form}
onOpenChange={(open: any) => { onOpenChange={(open: any) => {
if (open && props.item) { if (open && props.item) {
form.setFieldsValue(props.item); form.setFieldsValue({
...props.item,
});
} }
}} }}
onFinish={async (values) => onFinish={async (values) =>
Apis.Company.CompanyPositions.Update({ Apis.Company.CompanyPositions.Update({
...values, ...values,
companies_id: props?.item?.companies_id,
id: props.item?.id ?? 0, id: props.item?.id ?? 0,
}) })
.then(() => { .then(() => {
@ -37,6 +39,11 @@ export default function Update(props: MyBetaModalFormProps) {
.catch(() => false) .catch(() => false)
} }
columns={[ columns={[
Selects?.Companies({
title: '机构',
key: 'companies_id',
formItemProps: { ...rulesHelper.text },
}),
{ {
key: 'name', key: 'name',
title: '岗位名称', title: '岗位名称',