diff --git a/.umirc.ts b/.umirc.ts index 6fc5cab..8050038 100644 --- a/.umirc.ts +++ b/.umirc.ts @@ -16,6 +16,7 @@ export default defineConfig({ '/api/': { // target: 'http://yt:8003', target: 'http://10.39.13.80:8001', + // target: 'http://10.39.67.86:8001/', // target: 'https://test-admin.linyikj.com.cn/', // target: 'http://we6f9c65.natappfree.cc', // target: 'https://loanos-test.nchl.net/', diff --git a/src/pages/company/$id.tsx b/src/pages/company/auto/$id.tsx similarity index 82% rename from src/pages/company/$id.tsx rename to src/pages/company/auto/$id.tsx index 34f2b04..e1791b5 100644 --- a/src/pages/company/$id.tsx +++ b/src/pages/company/auto/$id.tsx @@ -5,15 +5,15 @@ import { useParams } from '@umijs/max'; import { Space, Tabs } from 'antd'; import { useEffect, useState } from 'react'; -import Assets from './components/Assets'; -import CompanyApps from './components/CompanyApps'; -import ComponentsInfo from './components/ComponentsInfo'; -import Employees from './components/Employees'; -import Organizations from './components/Organizations'; -import Positions from './components/Positions'; -import PropertyBrands from './components/PropertyBrands'; -import ReceiptAccounts from './components/ReceiptAccounts'; import CompanyUpdate from './modals/CompanyUpdate'; +import CompanyApps from './table/Apps'; +import Assets from './table/Assets'; +import Brands from './table/Brands'; +import ComponentsInfo from './table/ComponentsInfo'; +import Employees from './table/Employees'; +import Organizations from './table/Organizations'; +import Positions from './table/Positions'; +import ReceiptAccounts from './table/ReceiptAccounts'; export default function Show({ title }: { title?: string } = {}) { const { id } = useParams<{ id: string }>(); @@ -43,12 +43,6 @@ export default function Show({ title }: { title?: string } = {}) { }, [id]); let items = [ - { - label: '0-品牌配置', - key: '0', - closable: false, - children: , - }, { label: '1-项目配置', key: '1', @@ -86,6 +80,12 @@ export default function Show({ title }: { title?: string } = {}) { closable: false, children: , }, + { + label: '7-品牌配置', + key: '7', + closable: false, + children: , + }, ]; return ( @@ -104,7 +104,7 @@ export default function Show({ title }: { title?: string } = {}) { } >
- * 您可在以下页签中对应配置:项目、组织、岗位、员工、账号、应用; + * 您可在以下页签中对应配置:项目、组织、岗位、员工、账号、应用、品牌;
diff --git a/src/pages/company/index.tsx b/src/pages/company/auto/index.tsx similarity index 96% rename from src/pages/company/index.tsx rename to src/pages/company/auto/index.tsx index 882bc74..42190a8 100644 --- a/src/pages/company/index.tsx +++ b/src/pages/company/auto/index.tsx @@ -9,9 +9,9 @@ import { Apis } from '@/gen/Apis'; import { ProTable } from '@ant-design/pro-components'; import { useNavigate } from '@umijs/max'; import { Space } from 'antd'; -import ComponentsInfo from './components/ComponentsInfo'; import CompanyCreate from './modals/CompanyCreate'; import CompanyUpdate from './modals/CompanyUpdate'; +import ComponentsInfo from './table/ComponentsInfo'; export default function Index({ title = '机构列表' }) { const navigate = useNavigate(); @@ -77,7 +77,7 @@ export default function Index({ title = '机构列表' }) { title="配置" data-tooltip-position="top" onClick={() => { - navigate(`/company/${item.id}`); + navigate(`/company/auto/${item.id}`); }} /> [ - ( - + + MyProTableProps.request( + params, + sort, + Apis.Company.CompanyPropertyBrands.List, + ) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID(), + { + title: '机构', + dataIndex: ['company', 'name'], + search: false, + }, + { + title: '物业名称', + dataIndex: 'name', + }, + { + title: 'logo', + render: (_, item) => { + return ( + + {item?.logo?.[0] && ( + + )} + + ); + }, + }, + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + Apis.Company.CompanyPropertyBrands.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> +
+ ); +} diff --git a/src/pages/company/components/modals/PropertyBrandUpdate.tsx b/src/pages/company/brand/modals/BrandUpdate.tsx similarity index 100% rename from src/pages/company/components/modals/PropertyBrandUpdate.tsx rename to src/pages/company/brand/modals/BrandUpdate.tsx diff --git a/src/pages/company/components/modals/PropertyBrandsCreate.tsx b/src/pages/company/brand/modals/BrandsCreate.tsx similarity index 80% rename from src/pages/company/components/modals/PropertyBrandsCreate.tsx rename to src/pages/company/brand/modals/BrandsCreate.tsx index 12189c5..027d4af 100644 --- a/src/pages/company/components/modals/PropertyBrandsCreate.tsx +++ b/src/pages/company/brand/modals/BrandsCreate.tsx @@ -5,6 +5,7 @@ import { 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'; @@ -28,7 +29,7 @@ export default function Create(props: MyBetaModalFormProps) { onFinish={async (values) => Apis.Company.CompanyPropertyBrands.Store({ ...values, - companies_id: props?.item?.id, + companies_id: values?.companies_id || props?.item?.id, }) .then(() => { props.reload?.(); @@ -38,6 +39,16 @@ export default function Create(props: MyBetaModalFormProps) { .catch(() => false) } columns={[ + ...(props?.item?.id + ? [] + : [ + Selects?.Companies({ + key: 'companies_id', + title: '公司', + colProps: { span: 24 }, + required: true, + }), + ]), { key: 'name', title: '品牌名称', diff --git a/src/pages/company/company_apps/index.tsx b/src/pages/company/company_apps/index.tsx new file mode 100644 index 0000000..022a2f4 --- /dev/null +++ b/src/pages/company/company_apps/index.tsx @@ -0,0 +1,92 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, + usePageTabs, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Image, Space } from 'antd'; +import AppCreate from './modals/AppCreate'; +import AppUpdate from './modals/AppUpdate'; + +export default function Index({ title = '品牌管理' }) { + const navigate = useNavigate(); + + // 注册当前页面为标签页 + usePageTabs({ + tabKey: 'company-brands', + tabLabel: title, + }); + + return ( + + + MyProTableProps.request( + params, + sort, + Apis.Company.CompanyPropertyBrands.List, + ) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID(), + { + title: '机构', + dataIndex: ['company', 'name'], + search: false, + }, + { + title: '物业名称', + dataIndex: 'name', + }, + { + title: 'logo', + render: (_, item) => { + return ( + + {item?.logo?.[0] && ( + + )} + + ); + }, + }, + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + Apis.Company.CompanyPropertyBrands.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/company/components/modals/CompanyAppCreate.tsx b/src/pages/company/company_apps/modals/AppCreate.tsx similarity index 86% rename from src/pages/company/components/modals/CompanyAppCreate.tsx rename to src/pages/company/company_apps/modals/AppCreate.tsx index 560b39a..c6206e7 100644 --- a/src/pages/company/components/modals/CompanyAppCreate.tsx +++ b/src/pages/company/company_apps/modals/AppCreate.tsx @@ -5,6 +5,7 @@ import { MyModalFormProps, rulesHelper, } from '@/common'; +import { Selects } from '@/components/Select'; import { Apis } from '@/gen/Apis'; import { CompanyAppsAppTypeEnum, CompanyAppsModuleEnum } from '@/gen/Enums'; import { BetaSchemaForm } from '@ant-design/pro-components'; @@ -29,7 +30,7 @@ export default function Create(props: MyBetaModalFormProps) { onFinish={async (values) => Apis.Company.CompanyApps.Store({ ...values, - companies_id: props?.item?.id, + companies_id: values?.companies_id || props?.item?.id, }) .then(() => { props.reload?.(); @@ -39,6 +40,16 @@ export default function Create(props: MyBetaModalFormProps) { .catch(() => false) } columns={[ + ...(props?.item?.id + ? [] + : [ + Selects?.Companies({ + key: 'companies_id', + title: '公司', + colProps: { span: 24 }, + required: true, + }), + ]), MyFormItems.EnumRadio({ key: 'app_type', title: '应用类型', diff --git a/src/pages/company/components/modals/CompanyAppUpdate.tsx b/src/pages/company/company_apps/modals/AppUpdate.tsx similarity index 100% rename from src/pages/company/components/modals/CompanyAppUpdate.tsx rename to src/pages/company/company_apps/modals/AppUpdate.tsx diff --git a/src/pages/employees/index.tsx b/src/pages/company/employees/index.tsx similarity index 94% rename from src/pages/employees/index.tsx rename to src/pages/company/employees/index.tsx index 4f7b76a..ecc252b 100644 --- a/src/pages/employees/index.tsx +++ b/src/pages/company/employees/index.tsx @@ -8,8 +8,8 @@ import { import { Apis } from '@/gen/Apis'; import { ProTable } from '@ant-design/pro-components'; import { Space } from 'antd'; -import EmployeeCreate from '../company/components/modals/EmployeeCreate'; -import EmployeeUpdate from '../company/components/modals/EmployeeUpdate'; +import EmployeeCreate from './modals/EmployeeCreate'; +import EmployeeUpdate from './modals/EmployeeUpdate'; export default function Index({ title = '员工管理' }) { // 使用多标签页功能 diff --git a/src/pages/company/components/modals/EmployeeCreate.tsx b/src/pages/company/employees/modals/EmployeeCreate.tsx similarity index 88% rename from src/pages/company/components/modals/EmployeeCreate.tsx rename to src/pages/company/employees/modals/EmployeeCreate.tsx index 7949d13..d2c78fa 100644 --- a/src/pages/company/components/modals/EmployeeCreate.tsx +++ b/src/pages/company/employees/modals/EmployeeCreate.tsx @@ -24,14 +24,12 @@ export default function Create(props: MyBetaModalFormProps) { onOpenChange={(open: any) => { if (open) { form.resetFields(); // 清空表单数据 - form.setFieldsValue({ - companies_id: props?.item?.id, - }); } }} onFinish={async (values: any) => Apis.Company.CompanyEmployees.Store({ ...values, + companies_id: values?.companies_id || props?.item?.id, organizations_id: values?.organizations_id?.[values.organizations_id.length - 1], }) @@ -43,12 +41,16 @@ export default function Create(props: MyBetaModalFormProps) { .catch(() => false) } columns={[ - Selects?.Companies({ - key: 'companies_id', - title: '所属机构', - colProps: { span: 24 }, - formItemProps: { ...rulesHelper.number }, - }), + ...(props?.item?.id + ? [] + : [ + Selects?.Companies({ + key: 'companies_id', + title: '公司', + colProps: { span: 24 }, + required: true, + }), + ]), Selects?.OrganizationsTree({ title: '选择组织', key: 'organizations_id', diff --git a/src/pages/company/components/modals/EmployeeUpdate.tsx b/src/pages/company/employees/modals/EmployeeUpdate.tsx similarity index 100% rename from src/pages/company/components/modals/EmployeeUpdate.tsx rename to src/pages/company/employees/modals/EmployeeUpdate.tsx diff --git a/src/pages/company/organizations/index.tsx b/src/pages/company/organizations/index.tsx new file mode 100644 index 0000000..f0c8d0a --- /dev/null +++ b/src/pages/company/organizations/index.tsx @@ -0,0 +1,103 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, + usePageTabs, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { OrganizationsTypeEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; +import OrganizationChange from './modals/OrganizationChange'; +import OrganizationCreate from './modals/OrganizationCreate'; +import OrganizationUpdate from './modals/OrganizationUpdate'; + +export default function Index({ title = '组织列表' }) { + const navigate = useNavigate(); + + // 注册当前页面为标签页 + usePageTabs({ + tabKey: 'company-organizations', + tabLabel: title, + }); + + return ( + + + MyProTableProps.request( + params, + sort, + Apis.Company.Organizations.TreeList, + ) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + { + title: '机构', + dataIndex: ['company', 'name'], + search: false, + }, + { + title: '组织ID', + dataIndex: 'id', + search: false, + }, + { + title: '组织名称', + dataIndex: 'name', + }, + MyColumns.EnumTag({ + title: '组织类型', + dataIndex: 'type', + valueEnum: OrganizationsTypeEnum, + search: false, + }), + + { + title: '上级组织', + dataIndex: ['organization_parent', 'name'], + search: false, + }, + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + + Apis.Company.Organizations.Delete({ id: item.id }).then( + () => action?.reload(), + ) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/company/components/modals/OrganizationChange.tsx b/src/pages/company/organizations/modals/OrganizationChange.tsx similarity index 100% rename from src/pages/company/components/modals/OrganizationChange.tsx rename to src/pages/company/organizations/modals/OrganizationChange.tsx diff --git a/src/pages/company/components/modals/OrganizationCreate.tsx b/src/pages/company/organizations/modals/OrganizationCreate.tsx similarity index 86% rename from src/pages/company/components/modals/OrganizationCreate.tsx rename to src/pages/company/organizations/modals/OrganizationCreate.tsx index 460c47e..b9432ab 100644 --- a/src/pages/company/components/modals/OrganizationCreate.tsx +++ b/src/pages/company/organizations/modals/OrganizationCreate.tsx @@ -21,6 +21,7 @@ export default function Create(props: MyBetaModalFormProps) { wrapperCol={{ span: 24 }} width="500px" trigger={} + key={new Date().getTime()} form={form} onOpenChange={(open: any) => { if (open) { @@ -30,7 +31,7 @@ export default function Create(props: MyBetaModalFormProps) { onFinish={async (values: any) => Apis.Company.Organizations.Store({ ...values, - companies_id: props?.item?.id, + companies_id: values?.companies_id || props?.item?.id, parent_id: values?.parent_id?.[values.parent_id.length - 1], }) .then(() => { @@ -41,6 +42,16 @@ export default function Create(props: MyBetaModalFormProps) { .catch(() => false) } columns={[ + ...(props?.item?.id + ? [] + : [ + Selects?.Companies({ + key: 'companies_id', + title: '公司', + colProps: { span: 24 }, + required: true, + }), + ]), MyFormItems.EnumRadio({ key: 'type', title: '组织类型', diff --git a/src/pages/company/components/modals/OrganizationUpdate.tsx b/src/pages/company/organizations/modals/OrganizationUpdate.tsx similarity index 100% rename from src/pages/company/components/modals/OrganizationUpdate.tsx rename to src/pages/company/organizations/modals/OrganizationUpdate.tsx diff --git a/src/pages/company/positions/index.tsx b/src/pages/company/positions/index.tsx new file mode 100644 index 0000000..6eb1809 --- /dev/null +++ b/src/pages/company/positions/index.tsx @@ -0,0 +1,96 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, + usePageTabs, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; +import PositionCreate from './modals/PositionCreate'; +import PositionUpdate from './modals/PositionUpdate'; + +export default function Index({ title = '岗位管理' }) { + const navigate = useNavigate(); + + // 注册当前页面为标签页 + usePageTabs({ + tabKey: 'company-positions', + tabLabel: title, + }); + + return ( + + + MyProTableProps.request( + params, + sort, + Apis.Company.CompanyPositions.List, + ) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID(), + { + title: '机构', + dataIndex: ['company', 'name'], + search: false, + }, + { + title: '岗位名称', + dataIndex: 'name', + width: 200, + }, + { + title: '岗位编号', + dataIndex: 'code', + search: false, + width: 200, + }, + // { + // title: '岗位排序', + // dataIndex: 'sort', + // search: false, + // }, + { + title: '岗位备注', + dataIndex: 'remark', + search: false, + width: 200, + }, + MyColumns.UpdatedAt(), + // MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + Apis.Company.CompanyPositions.Delete({ id: item.id }).then( + () => action?.reload(), + ) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/company/components/modals/PositionCreate.tsx b/src/pages/company/positions/modals/PositionCreate.tsx similarity index 81% rename from src/pages/company/components/modals/PositionCreate.tsx rename to src/pages/company/positions/modals/PositionCreate.tsx index 3a5e53d..c40be6a 100644 --- a/src/pages/company/components/modals/PositionCreate.tsx +++ b/src/pages/company/positions/modals/PositionCreate.tsx @@ -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 { Form, message } from 'antd'; @@ -26,7 +27,7 @@ export default function Create(props: MyBetaModalFormProps) { onFinish={async (values) => Apis.Company.CompanyPositions.Store({ ...values, - companies_id: props?.item?.id, + companies_id: values?.companies_id || props?.item?.id, }) .then(() => { props.reload?.(); @@ -36,11 +37,16 @@ export default function Create(props: MyBetaModalFormProps) { .catch(() => false) } columns={[ - // Selects?.Companies({ - // title: '机构', - // key: 'companies_id', - // formItemProps: { ...rulesHelper.text }, - // }), + ...(props?.item?.id + ? [] + : [ + Selects?.Companies({ + key: 'companies_id', + title: '公司', + colProps: { span: 24 }, + required: true, + }), + ]), { key: 'name', title: '岗位名称', diff --git a/src/pages/company/components/modals/PositionUpdate.tsx b/src/pages/company/positions/modals/PositionUpdate.tsx similarity index 100% rename from src/pages/company/components/modals/PositionUpdate.tsx rename to src/pages/company/positions/modals/PositionUpdate.tsx diff --git a/src/pages/company/receipt_accounts/index.tsx b/src/pages/company/receipt_accounts/index.tsx new file mode 100644 index 0000000..0c109e1 --- /dev/null +++ b/src/pages/company/receipt_accounts/index.tsx @@ -0,0 +1,91 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, + usePageTabs, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; +import ReceiptAccountCreate from './modals/ReceiptAccountCreate'; +import ReceiptAccountUpdate from './modals/ReceiptAccountUpdate'; + +export default function Index({ title = '账号管理' }) { + const navigate = useNavigate(); + + // 注册当前页面为标签页 + usePageTabs({ + tabKey: 'company-receipt_accounts', + tabLabel: title, + }); + + return ( + + + MyProTableProps.request( + params, + sort, + Apis.Company.CompanyReceiptAccounts.List, + ) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID(), + { + title: '机构', + dataIndex: ['company', 'name'], + search: false, + }, + { + title: '收款账号名称', + dataIndex: 'company_name', + }, + { + title: '开户行', + dataIndex: 'company_bank', + search: false, + }, + { + title: '收款账号', + dataIndex: 'company_account', + search: false, + }, + MyColumns.UpdatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + Apis.Company.CompanyReceiptAccounts.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/company/components/modals/ReceiptAccountCreate.tsx b/src/pages/company/receipt_accounts/modals/ReceiptAccountCreate.tsx similarity index 87% rename from src/pages/company/components/modals/ReceiptAccountCreate.tsx rename to src/pages/company/receipt_accounts/modals/ReceiptAccountCreate.tsx index 0525449..cfee14a 100644 --- a/src/pages/company/components/modals/ReceiptAccountCreate.tsx +++ b/src/pages/company/receipt_accounts/modals/ReceiptAccountCreate.tsx @@ -5,6 +5,7 @@ import { MyModalFormProps, rulesHelper, } from '@/common'; +import { Selects } from '@/components/Select'; import { Apis } from '@/gen/Apis'; import { CompanyReceiptAccountsPayChannelEnum } from '@/gen/Enums'; import { BetaSchemaForm } from '@ant-design/pro-components'; @@ -29,7 +30,8 @@ export default function Create(props: MyBetaModalFormProps) { onFinish={async (values) => Apis.Company.CompanyReceiptAccounts.Store({ ...values, - companies_id: props?.item?.id, + companies_id: values?.companies_id || props?.item?.id, + is_default: 0, }) .then(() => { @@ -40,6 +42,16 @@ export default function Create(props: MyBetaModalFormProps) { .catch(() => false) } columns={[ + ...(props?.item?.id + ? [] + : [ + Selects?.Companies({ + key: 'companies_id', + title: '公司', + colProps: { span: 24 }, + required: true, + }), + ]), { key: 'company_name', title: '收款账户名称', diff --git a/src/pages/company/components/modals/ReceiptAccountUpdate.tsx b/src/pages/company/receipt_accounts/modals/ReceiptAccountUpdate.tsx similarity index 100% rename from src/pages/company/components/modals/ReceiptAccountUpdate.tsx rename to src/pages/company/receipt_accounts/modals/ReceiptAccountUpdate.tsx diff --git a/src/pages/house_charge_task_details/index.tsx b/src/pages/house_charge_task_details/index.tsx new file mode 100644 index 0000000..b118dad --- /dev/null +++ b/src/pages/house_charge_task_details/index.tsx @@ -0,0 +1,115 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, + usePageTabs, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + HouseChargeTasksStatusEnum, + HouseChargeTasksTypeEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import ChargeTasksCreate from './modals/ChargeTasksCreate'; + +export default function Index({ title = '账单任务' }) { + // 注册当前页面为标签页 + usePageTabs({ + tabKey: 'charge_tasks', + tabLabel: title, + }); + + return ( + + + MyProTableProps.request( + params, + sort, + Apis.HouseCharage.HouseChargeTasks.List, + ) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID(), + MyColumns.EnumTag({ + title: '任务状态', + dataIndex: 'status', + valueEnum: HouseChargeTasksStatusEnum, + }), + MyColumns.EnumTag({ + title: '创建类型', + dataIndex: 'type', + valueEnum: HouseChargeTasksTypeEnum, + }), + { + title: '收费标准名称', + dataIndex: 'charge_standard_name', + search: false, + }, + { + title: '账单月份', + render: (_, record) => { + return `${record.year}-${String(record.month).padStart(2, '0')}`; + }, + }, + { + title: '计费开始日期', + dataIndex: 'start_date', + search: false, + }, + { + title: '计费结束日期', + dataIndex: 'end_date', + search: false, + }, + { + title: '项目名称', + dataIndex: 'project_name', + search: false, + }, + { + title: '机构名称', + dataIndex: 'company_name', + search: false, + }, + MyColumns.SoftDelete({ + title: '启/禁用', + onRestore: Apis.HouseCharage.HouseChargeTasks.Restore, + onSoftDelete: Apis.HouseCharage.HouseChargeTasks.SoftDelete, + search: false, + }), + MyColumns.UpdatedAt(), + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + Apis.HouseCharage.HouseChargeTasks.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/house_charge_task_details/modals/ChargeTasksCreate.tsx b/src/pages/house_charge_task_details/modals/ChargeTasksCreate.tsx new file mode 100644 index 0000000..199fa3b --- /dev/null +++ b/src/pages/house_charge_task_details/modals/ChargeTasksCreate.tsx @@ -0,0 +1,109 @@ +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 Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`创建${props.title}`} + width="480px" + layout="horizontal" + labelCol={{ span: 8 }} + wrapperCol={{ span: 16 }} + labelAlign="left" + trigger={} + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + onFinish={async (values) => + Apis.HouseCharage.HouseChargeTasks.Store(values) + .then(() => { + props.reload?.(); + message.success(props.title + '账单任务创建成功'); + return true; + }) + .catch(() => false) + } + columns={[ + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + { + valueType: 'dependency', + name: ['asset_projects_id'], + columns: ({ asset_projects_id }) => { + return [ + Selects?.ChargeStandard({ + title: '选择收费标准', + key: 'house_charge_standards_id', + params: { + asset_projects_id: asset_projects_id, + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + showSearch: true, + }, + }), + ]; + }, + }, + { + key: 'month', + title: '选择生成月份', + valueType: 'date', + colProps: { span: 24 }, + fieldProps: { + picker: 'month', + format: 'YYYY-MM', + valueFormat: 'YYYY-MM', + style: { + width: '100%', + }, + }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'start_date', + title: '计费开始日期', + valueType: 'date', + colProps: { span: 24 }, + fieldProps: { + style: { + width: '100%', + }, + }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'end_date', + title: '计费结束日期', + valueType: 'date', + colProps: { span: 24 }, + fieldProps: { + style: { + width: '100%', + }, + }, + formItemProps: { ...rulesHelper.text }, + }, + ]} + /> + ); +} diff --git a/src/pages/house_charge_tasks/index.tsx b/src/pages/house_charge_tasks/index.tsx index b118dad..74da70b 100644 --- a/src/pages/house_charge_tasks/index.tsx +++ b/src/pages/house_charge_tasks/index.tsx @@ -6,18 +6,14 @@ import { usePageTabs, } from '@/common'; import { Apis } from '@/gen/Apis'; -import { - HouseChargeTasksStatusEnum, - HouseChargeTasksTypeEnum, -} from '@/gen/Enums'; +import { HouseChargeTaskDetailsStatusEnum } from '@/gen/Enums'; import { ProTable } from '@ant-design/pro-components'; import { Space } from 'antd'; -import ChargeTasksCreate from './modals/ChargeTasksCreate'; -export default function Index({ title = '账单任务' }) { +export default function Index({ title = '任务结果' }) { // 注册当前页面为标签页 usePageTabs({ - tabKey: 'charge_tasks', + tabKey: 'charge_task_details', tabLabel: title, }); @@ -34,33 +30,28 @@ export default function Index({ title = '账单任务' }) { MyProTableProps.request( params, sort, - Apis.HouseCharage.HouseChargeTasks.List, + Apis.HouseCharage.HouseChargeTaskDetails.List, ) } - toolBarRender={(action) => [ - , - ]} + // toolBarRender={(action) => [ + // , + // ]} columns={[ + { + title: '任务ID', + dataIndex: 'house_charge_tasks_id', + search: false, + }, MyColumns.ID(), MyColumns.EnumTag({ title: '任务状态', dataIndex: 'status', - valueEnum: HouseChargeTasksStatusEnum, + valueEnum: HouseChargeTaskDetailsStatusEnum, }), - MyColumns.EnumTag({ - title: '创建类型', - dataIndex: 'type', - valueEnum: HouseChargeTasksTypeEnum, - }), - { - title: '收费标准名称', - dataIndex: 'charge_standard_name', - search: false, - }, { title: '账单月份', render: (_, record) => { @@ -77,22 +68,6 @@ export default function Index({ title = '账单任务' }) { dataIndex: 'end_date', search: false, }, - { - title: '项目名称', - dataIndex: 'project_name', - search: false, - }, - { - title: '机构名称', - dataIndex: 'company_name', - search: false, - }, - MyColumns.SoftDelete({ - title: '启/禁用', - onRestore: Apis.HouseCharage.HouseChargeTasks.Restore, - onSoftDelete: Apis.HouseCharage.HouseChargeTasks.SoftDelete, - search: false, - }), MyColumns.UpdatedAt(), MyColumns.CreatedAt(), MyColumns.Option({ @@ -100,7 +75,7 @@ export default function Index({ title = '账单任务' }) { - Apis.HouseCharage.HouseChargeTasks.Delete({ + Apis.HouseCharage.HouseChargeTaskDetails.Delete({ id: item.id, }).then(() => action?.reload()) }