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

View File

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

View File

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