diff --git a/src/pages/company/companies/components/Organizations.tsx b/src/pages/company/companies/components/Organizations.tsx index 87afca4..c6592dc 100644 --- a/src/pages/company/companies/components/Organizations.tsx +++ b/src/pages/company/companies/components/Organizations.tsx @@ -16,7 +16,7 @@ export default function Organizations(props: MyBetaModalFormProps) { <> MyProTableProps.request( { ...params, companies_id: props?.item?.id }, @@ -34,28 +34,34 @@ export default function Organizations(props: MyBetaModalFormProps) { ]} options={false} columns={[ - MyColumns.ID(), + { + title: '组织ID', + dataIndex: 'id', + search: false, + }, { 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) => ( diff --git a/src/pages/company/companies/components/Positions.tsx b/src/pages/company/companies/components/Positions.tsx index 561ba00..8a9aa2b 100644 --- a/src/pages/company/companies/components/Positions.tsx +++ b/src/pages/company/companies/components/Positions.tsx @@ -7,7 +7,8 @@ import { import { Apis } from '@/gen/Apis'; import { ProTable } from '@ant-design/pro-components'; import { Space } from 'antd'; -import OrganizationsCreate from '../modals/OrganizationsCreate'; +import PositionsCreate from '../modals/PositionsCreate'; +import PositionsUpdate from '../modals/PositionsUpdate'; export default function Organizations(props: MyBetaModalFormProps) { return ( @@ -23,14 +24,14 @@ export default function Organizations(props: MyBetaModalFormProps) { ) } toolBarRender={(action) => [ - , ]} - options={false} + // options={false} columns={[ MyColumns.ID(), @@ -58,11 +59,15 @@ export default function Organizations(props: MyBetaModalFormProps) { MyColumns.Option({ render: (_, item: any, index, action) => ( - {/* */} + - Apis.Common.Admins.Delete({ id: item.id }).then(() => - action?.reload(), + Apis.Company.CompanyPositions.Delete({ id: item.id }).then( + () => action?.reload(), ) } /> diff --git a/src/pages/company/companies/modals/PositionsCreate.tsx b/src/pages/company/companies/modals/PositionsCreate.tsx index f8aa8a3..e804c55 100644 --- a/src/pages/company/companies/modals/PositionsCreate.tsx +++ b/src/pages/company/companies/modals/PositionsCreate.tsx @@ -4,7 +4,6 @@ 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'; @@ -13,12 +12,15 @@ export default function Create(props: MyBetaModalFormProps) { return ( {...MyModalFormProps.props} - title={`添加${props.title}`} + title={`添加岗位`} wrapperCol={{ span: 24 }} width="500px" - trigger={} + trigger={} onFinish={async (values) => - Apis.Company.CompanyPositions.Store(values) + Apis.Company.CompanyPositions.Store({ + ...values, + companies_id: props?.item?.id, + }) .then(() => { props.reload?.(); message.success(props.title + '成功'); @@ -27,11 +29,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: '岗位名称', diff --git a/src/pages/company/positions/modals/Update.tsx b/src/pages/company/companies/modals/PositionsUpdate.tsx similarity index 86% rename from src/pages/company/positions/modals/Update.tsx rename to src/pages/company/companies/modals/PositionsUpdate.tsx index 4be6b58..3554ad4 100644 --- a/src/pages/company/positions/modals/Update.tsx +++ b/src/pages/company/companies/modals/PositionsUpdate.tsx @@ -5,7 +5,6 @@ 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'; @@ -21,14 +20,13 @@ 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(() => { @@ -39,11 +37,6 @@ export default function Update(props: MyBetaModalFormProps) { .catch(() => false) } columns={[ - Selects?.Companies({ - title: '机构', - key: 'companies_id', - formItemProps: { ...rulesHelper.text }, - }), { key: 'name', title: '岗位名称', diff --git a/src/pages/company/positions/index.tsx b/src/pages/company/positions/index.tsx deleted file mode 100644 index fe835e3..0000000 --- a/src/pages/company/positions/index.tsx +++ /dev/null @@ -1,25 +0,0 @@ -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 ( - - - MyProTableProps.request( - params, - sort, - Apis.Company.CompanyPositions.List, - ) - } - toolBarRender={(action) => [ - , - ]} - /> - - ); -} diff --git a/src/pages/company/positions/modals/Create.tsx b/src/pages/company/positions/modals/Create.tsx deleted file mode 100644 index f8aa8a3..0000000 --- a/src/pages/company/positions/modals/Create.tsx +++ /dev/null @@ -1,62 +0,0 @@ -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 ( - - {...MyModalFormProps.props} - title={`添加${props.title}`} - wrapperCol={{ span: 24 }} - width="500px" - trigger={} - 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', - }, - ]} - /> - ); -}