diff --git a/.umirc.ts b/.umirc.ts index 6fc5cab..af85b4a 100644 --- a/.umirc.ts +++ b/.umirc.ts @@ -15,8 +15,9 @@ export default defineConfig({ proxy: { '/api/': { // target: 'http://yt:8003', - target: 'http://10.39.13.80:8001', - // target: 'https://test-admin.linyikj.com.cn/', + // target: 'http://10.39.13.80:8001', + // target: 'http://10.39.13.78:8001/', + target: 'https://test-admin.linyikj.com.cn/', // target: 'http://we6f9c65.natappfree.cc', // target: 'https://loanos-test.nchl.net/', changeOrigin: true, diff --git a/gencode.json b/gencode.json index 5c1814c..b5fb778 100644 --- a/gencode.json +++ b/gencode.json @@ -1,4 +1,4 @@ { - "url": "http://10.39.13.80:8001/api/docs/openapi", + "url": "http://10.39.13.78:8001/api/docs/openapi", "module": "Admin" } diff --git a/src/common/components/schema/MyColumns.tsx b/src/common/components/schema/MyColumns.tsx index f667992..736cc91 100644 --- a/src/common/components/schema/MyColumns.tsx +++ b/src/common/components/schema/MyColumns.tsx @@ -1,6 +1,6 @@ import { MyResponseType, renderTextHelper } from '@/common'; import { ProColumns } from '@ant-design/pro-components'; -import { Image, Popconfirm, Tag } from 'antd'; +import { Image, Popconfirm, Switch, Tag } from 'antd'; type ReturnType = ProColumns, 'text'>; @@ -50,36 +50,23 @@ export const MyColumns = { } & ReturnType): ReturnType { return { title: '启/禁用', - render: (_, item, index, action) => - item?.deleted_at ? ( - { + render: (_, item, index, action) => ( + { + if (item?.deleted_at) { onRestore?.({ id: item.id }).then(() => action?.reload()); - }} - okText="是" - cancelText="否" - > - - 已禁用 - - - ) : ( - { + } else { onSoftDelete?.({ id: item.id }).then(() => action?.reload()); - }} - okText="是" - cancelText="否" - > - - 已启用 - - - ), + } + }} + okText="是" + cancelText="否" + > + + + ), search: false, ...rest, }; diff --git a/src/components/Select.tsx b/src/components/Select.tsx index 86188f4..99b8e30 100644 --- a/src/components/Select.tsx +++ b/src/components/Select.tsx @@ -110,7 +110,7 @@ export const Selects = { }, }; }, - // 单元下拉框 + // 网格单元下拉框 GridUnits(props?: PropsType): ReturnType { const { title = '单元', @@ -126,18 +126,21 @@ export const Selects = { valueType: 'select', hideInTable: hideInTable, formItemProps: { ...(required ? rulesHelper.number : {}) }, - request: async (params) => - ( - await Apis.Asset.AssetUnits.GridSelect({ - keywords: params?.KeyWords, - asset_projects_id: params?.asset_projects_id, - asset_buildings_id: params?.asset_buildings_id, - ...params, - }) - ).data, + request: async (params) => { + let res = await Apis.Asset.AssetUnits.GridSelect({ + keywords: params?.KeyWords, + asset_projects_id: params?.asset_projects_id, + ...params, + }); + res?.data?.map((l: any) => { + l.label = l.asset_building.name + l.label; + }); + return res?.data; + }, ...rest, fieldProps: { showSearch: true, + // mode: 'multiple', fieldNames: { label: 'label', value: 'value', @@ -355,6 +358,41 @@ export const Selects = { }, }; }, + //机构收款账户 + CompanyAccounts(props?: PropsType): ReturnType { + const { + title = '收款账户', + key = 'receipt_accounts_id', + required = false, + hideInTable = true, + ...rest + } = props ?? {}; + + return { + title: title, + key: key, + valueType: 'select', + hideInTable: hideInTable, + formItemProps: { ...(required ? rulesHelper.number : {}) }, + request: async (params) => + ( + await Apis.Company.CompanyReceiptAccounts.Select({ + keywords: params?.KeyWords, + ...params, + }) + ).data, + ...rest, + fieldProps: { + showSearch: true, + fieldNames: { + label: 'label', + value: 'value', + }, + ...rest?.fieldProps, + }, + }; + }, + //项目收款账户 ProjectAccounts(props?: PropsType): ReturnType { const { title = '收款账户', diff --git a/src/gen/ApiTypes.d.ts b/src/gen/ApiTypes.d.ts index acf9f43..df54f66 100644 --- a/src/gen/ApiTypes.d.ts +++ b/src/gen/ApiTypes.d.ts @@ -71,6 +71,25 @@ declare namespace ApiTypes { type RemoveOwner = { "house_occupants_id": number; // 房客id }; + type ChangeOccupant = { + "house_occupants_id": number; // 房客id + "type": string; // 类型,[enum:HouseRegistersTypeEnum + "update_info": string[]; // 要修改的信息 + "update_info.name"?: string; // 客户姓名 + "update_info.phone"?: string; // 客户手机号 + "update_info.reserve_phone"?: phone; // 客户备用电话 + "update_info.card_type"?: string; // 证件类型,[enum:HouseOccupantsCardTypeEnum] + "update_info.id_card"?: string; // 客户身份证号 + "update_info.card_front_image"?: string[]; // 身份证正面图片 + "update_info.card_back_image"?: string[]; // 身份证反面图片 + "update_info.address"?: string; // 客户地址 + "update_info.ownership_info"?: string[]; // 产权信息 + "house_relation"?: string; // 房客关系,[enum:HouseOccupantsHouseRelationEnum] + "residential_relation"?: string; // 居住关系,[enum:HouseOccupantsResidentialRelationEnum] + "owners_id"?: number; // 产权人id,[ref:house_occupants] + "relation_with_owner"?: string; // 与产权人关系,[enum:HouseOccupantsRelationWithOwnerEnum] + "status"?: string; // 状态,[enum:HouseOccupantsStatusEnum] + }; type Show = { "id": number; // id }; @@ -224,7 +243,7 @@ declare namespace ApiTypes { "charge"?: string; // 收费方式,[enum:AssetProjectsChargeEnum] "takeover_date"?: Date; // 接管日期 "closure_date"?: Date; // 封园日期 - "company_property_brands_id"?: string; // 物业品牌id,[ref:company_property_brands] + "company_property_brands_id"?: number; // 物业品牌id,[ref:company_property_brands] }; type Update = { "id": number; // id @@ -249,7 +268,7 @@ declare namespace ApiTypes { "charge"?: string; // 收费方式,[enum:AssetProjectsChargeEnum] "takeover_date"?: Date; // 接管日期 "closure_date"?: Date; // 封园日期 - "company_property_brands_id"?: string; // 物业品牌id,[ref:company_property_brands] + "company_property_brands_id"?: number; // 物业品牌id,[ref:company_property_brands] }; type BindCompany = { "projects_id": number; // 项目id @@ -518,6 +537,8 @@ declare namespace ApiTypes { namespace ConvenienceServices { type List = { "name"?: string; // 模糊搜索:名称 + "asset_projects_id"?: number; // 项目ID + "project_name"?: string; // 项目名称 }; type Store = { "asset_projects_id": number; // 项目ID @@ -713,8 +734,8 @@ declare namespace ApiTypes { } namespace CompanyProjectReceiptAccounts { type List = { - "companies_id": number; // 所属机构id,[ref:companies] - "projects_id": number; // 所属项目id,[ref:asset_projects] + "companies_id"?: number; // 所属机构id,[ref:companies] + "projects_id"?: number; // 所属项目id,[ref:asset_projects] }; type Store = { "companies_id": number; // 所属机构id,[ref:companies] @@ -769,7 +790,7 @@ declare namespace ApiTypes { } namespace CompanyReceiptAccounts { type List = { - "name"?: string; // 模糊搜索:名称 + "company_name"?: string; // 模糊搜索:名称 "companies_id"?: number; // 所属机构id,[ref:companies] }; type Store = { @@ -803,6 +824,10 @@ declare namespace ApiTypes { type Delete = { "id": number; // id }; + type Select = { + "company_name"?: string; // 模糊搜索:名称 + "companies_id"?: number; // 所属机构id,[ref:companies] + }; } namespace Organizations { type List = { @@ -870,6 +895,20 @@ declare namespace ApiTypes { }; } } + namespace Customer { + namespace CustomerOpinions { + type List = { + "type"?: string; // 类型,[enum:CustomerOpinionsTypeEnum] + "content"?: string; // 模糊搜索:内容 + }; + type Show = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + } + } namespace Grid { namespace Grids { type List = { diff --git a/src/gen/Apis.ts b/src/gen/Apis.ts index c4e0d9a..93433d4 100644 --- a/src/gen/Apis.ts +++ b/src/gen/Apis.ts @@ -45,6 +45,9 @@ export const Apis = { RemoveOwner(data: ApiTypes.Archive.HouseRegisters.RemoveOwner): Promise { return request('admin/archive/house_registers/remove_owner', { data }); }, + ChangeOccupant(data: ApiTypes.Archive.HouseRegisters.ChangeOccupant): Promise { + return request('admin/archive/house_registers/change_occupant', { data }); + }, Show(data: ApiTypes.Archive.HouseRegisters.Show): Promise { return request('admin/archive/house_registers/show', { data }); }, @@ -418,7 +421,7 @@ export const Apis = { }, }, CompanyProjectReceiptAccounts: { - List(data: ApiTypes.Company.CompanyProjectReceiptAccounts.List): Promise { + List(data?: ApiTypes.Company.CompanyProjectReceiptAccounts.List): Promise { return request('admin/company/company_project_receipt_accounts/list', { data }); }, Store(data: ApiTypes.Company.CompanyProjectReceiptAccounts.Store): Promise { @@ -479,6 +482,9 @@ export const Apis = { Delete(data: ApiTypes.Company.CompanyReceiptAccounts.Delete): Promise { return request('admin/company/company_receipt_accounts/delete', { data }); }, + Select(data?: ApiTypes.Company.CompanyReceiptAccounts.Select): Promise { + return request('admin/company/company_receipt_accounts/select', { data }); + }, }, Organizations: { List(data?: ApiTypes.Company.Organizations.List): Promise { @@ -516,6 +522,19 @@ export const Apis = { }, }, }, + Customer: { + CustomerOpinions: { + List(data?: ApiTypes.Customer.CustomerOpinions.List): Promise { + return request('admin/customer/customer_opinions/list', { data }); + }, + Show(data: ApiTypes.Customer.CustomerOpinions.Show): Promise { + return request('admin/customer/customer_opinions/show', { data }); + }, + Delete(data: ApiTypes.Customer.CustomerOpinions.Delete): Promise { + return request('admin/customer/customer_opinions/delete', { data }); + }, + }, + }, Grid: { Grids: { List(data?: ApiTypes.Grid.Grids.List): Promise { diff --git a/src/gen/Enums.ts b/src/gen/Enums.ts index 1259f9f..8e5f44e 100644 --- a/src/gen/Enums.ts +++ b/src/gen/Enums.ts @@ -126,7 +126,7 @@ export const BannersTypeEnum= { // 缓存类型 export const CacheTypeEnum= { - 'MobilePhoneVerificationCode': {"text":"手机验证码","color":"#5b3d89","value":"MobilePhoneVerificationCode"}, + 'MobilePhoneVerificationCode': {"text":"手机验证码","color":"#1f86c5","value":"MobilePhoneVerificationCode"}, }; // CompaniesMerchantTypeEnum @@ -189,6 +189,12 @@ export const CustomerBacklogsTypeEnum= { 'ContractTodo': {"text":"合同待办","color":"#722ed1","value":"ContractTodo"}, }; +// CustomerOpinionsTypeEnum +export const CustomerOpinionsTypeEnum= { + 'FeatureException': {"text":"功能异常","color":"#ff0000","value":"FeatureException"}, + 'FeatureSuggestion': {"text":"新功能建议","color":"#00bfff","value":"FeatureSuggestion"}, +}; + // 账单状态枚举 export const HouseBillsBillStatusEnum= { 'PendingPayment': {"text":"待支付","color":"#facc15","value":"PendingPayment"}, @@ -404,6 +410,8 @@ export const HouseRegistersTypeEnum= { 'RemoveOccupant': {"text":"移除住户","color":"#fa8c16","value":"RemoveOccupant"}, 'MoveOut': {"text":"搬离登记","color":"#f50","value":"MoveOut"}, 'MoveIn': {"text":"搬入登记","color":"#ffc53d","value":"MoveIn"}, + 'UpdateInfo': {"text":"修改信息","color":"#722ed1","value":"UpdateInfo"}, + 'UpdatePhone': {"text":"修改电话","color":"#13c2c2","value":"UpdatePhone"}, }; // HouseRegistersUsagePlanEnum diff --git a/src/pages/announcement/modals/AnnouncementCreate.tsx b/src/pages/announcement/modals/AnnouncementCreate.tsx deleted file mode 100644 index 768e196..0000000 --- a/src/pages/announcement/modals/AnnouncementCreate.tsx +++ /dev/null @@ -1,85 +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 { Form, message } from 'antd'; - -export default function Create(props: MyBetaModalFormProps) { - const [form] = Form.useForm(); - return ( - - {...MyModalFormProps.props} - title={`添加公告`} - wrapperCol={{ span: 24 }} - width="600px" - trigger={} - form={form} - onOpenChange={(open: any) => { - if (open) { - form.resetFields(); // 清空表单数据 - } - }} - onFinish={async (values) => - Apis.Msg.MsgPropertyAnnouncements.Store(values) - .then(() => { - props.reload?.(); - message.success('添加公告内容成功'); - return true; - }) - .catch(() => false) - } - columns={[ - { - key: 'title', - title: '公告标题', - colProps: { span: 24 }, - formItemProps: { ...rulesHelper.text }, - }, - { - key: 'content', - title: '公告内容', - valueType: 'textarea', - colProps: { span: 24 }, - formItemProps: { ...rulesHelper.text }, - fieldProps: { - autoSize: { minRows: 4, maxRows: 6 }, - }, - }, - { - key: 'publish_at', - title: '内容显示的发布日期', - valueType: 'date', - colProps: { span: 12 }, - fieldProps: { - style: { width: '100%' }, - }, - formItemProps: { ...rulesHelper.text }, - }, - Selects?.AssetProjects({ - title: '请选择项目', - key: 'asset_projects_id', - colProps: { span: 12 }, - formItemProps: { ...rulesHelper.text }, - }), - { - key: 'sort', - title: '排序', - valueType: 'digit', - colProps: { span: 12 }, - tooltip: '数值越大越靠前', - fieldProps: { - placeholder: '数值越大越靠前', - min: 0, - style: { width: '100%' }, - }, - initialValue: 0, - }, - ]} - /> - ); -} diff --git a/src/pages/announcement/modals/AnnouncementShow.tsx b/src/pages/announcement/modals/AnnouncementShow.tsx deleted file mode 100644 index e2b7215..0000000 --- a/src/pages/announcement/modals/AnnouncementShow.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import { MyBetaModalFormProps } from '@/common'; -import { MyModal } from '@/components/MyModal'; -import { ProCard, ProDescriptions } from '@ant-design/pro-components'; -import { Typography } from 'antd'; - -const { Text } = Typography; - -export default function info(props: MyBetaModalFormProps) { - return ( - - - - {props?.item?.title || '-'} - - - -
- {props?.item?.content || '-'} -
-
- - - {props?.item?.publish_at || '-'} - - - {props?.item?.asset_project?.name || '-'} - - - {props?.item?.created_at || '-'} - -
- - } - /> - ); -} diff --git a/src/pages/announcement/modals/AnnouncementUpdate.tsx b/src/pages/announcement/modals/AnnouncementUpdate.tsx deleted file mode 100644 index 2a2043f..0000000 --- a/src/pages/announcement/modals/AnnouncementUpdate.tsx +++ /dev/null @@ -1,95 +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 { Form, message } from 'antd'; - -export default function Update(props: MyBetaModalFormProps) { - const [form] = Form.useForm(); - return ( - - {...MyModalFormProps.props} - title={`编辑公告内容`} - trigger={} - wrapperCol={{ span: 24 }} - width="600px" - key={new Date().getTime()} - form={form} - onOpenChange={(open: any) => { - if (open && props.item) { - form.setFieldsValue(props.item); - } - }} - onFinish={async (values) => - Apis.Msg.MsgPropertyAnnouncements.Update({ - ...values, - id: props.item?.id ?? 0, - }) - .then(() => { - props.reload?.(); - message.success('编辑公告内容成功'); - return true; - }) - .catch(() => false) - } - columns={[ - { - key: 'title', - title: '公告标题', - colProps: { span: 24 }, - formItemProps: { ...rulesHelper.text }, - }, - { - key: 'content', - title: '公告内容', - valueType: 'textarea', - colProps: { span: 24 }, - formItemProps: { ...rulesHelper.text }, - fieldProps: { - autoSize: { minRows: 4, maxRows: 6 }, - }, - }, - { - key: 'publish_at', - title: '内容显示的发布日期', - valueType: 'date', - colProps: { span: 12 }, - fieldProps: { - style: { width: '100%' }, - }, - formItemProps: { ...rulesHelper.text }, - }, - Selects?.AssetProjects({ - title: '请选择项目', - key: 'asset_projects_id', - colProps: { span: 12 }, - formItemProps: { ...rulesHelper.text }, - }), - // { - // key: 'is_publish', - // title: '是否立刻发布', - // valueType: 'switch', - // colProps: { span: 8 }, - // }, - { - key: 'sort', - title: '排序', - valueType: 'digit', - colProps: { span: 12 }, - tooltip: '数值越大越靠前', - fieldProps: { - placeholder: '数值越大越靠前', - min: 0, - style: { width: '100%' }, - }, - initialValue: 0, - }, - ]} - /> - ); -} diff --git a/src/pages/archive/components/OccupantsNow.tsx b/src/pages/archive/components/OccupantsNow.tsx index 7066593..c8e00ee 100644 --- a/src/pages/archive/components/OccupantsNow.tsx +++ b/src/pages/archive/components/OccupantsNow.tsx @@ -10,10 +10,12 @@ import { Popconfirm, Space, Tag } from 'antd'; import { useEffect, useRef } from 'react'; import Delivery from '../modals/Delivery'; import AddOccupant from './modals/AddOccupant'; +import ChangePhone from './modals/ChangePhone'; import MoveIn from './modals/MoveIn'; import MoveOut from './modals/MoveOut'; import OccupantShow from './modals/OccupantShow'; import OccupantsUpdate from './modals/OccupantsUpdate'; +import OwnerUpdate from './modals/OwnerUpdate'; import RemoveOwner from './modals/RemoveOwner'; import Transfer from './modals/Transfer'; @@ -152,8 +154,16 @@ export default function Index({ ...rest }) { render: (_, item: any, index, action) => ( - - {!item?.is_live_in && ( + {item?.house_relation !== + HouseOccupantsHouseRelationEnum.NonOwner.value && ( + + )} + {item?.house_relation === + HouseOccupantsHouseRelationEnum.NonOwner.value && ( + + )} + + {!item?.move_in_date && ( )} {item?.move_in_date && ( diff --git a/src/pages/archive/components/modals/ChangePhone.tsx b/src/pages/archive/components/modals/ChangePhone.tsx new file mode 100644 index 0000000..0e08498 --- /dev/null +++ b/src/pages/archive/components/modals/ChangePhone.tsx @@ -0,0 +1,59 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { HouseRegistersTypeEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + + return ( + + {...MyModalFormProps.props} + title={`修改电话`} + wrapperCol={{ span: 24 }} + width="360px" + trigger={} + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.setFieldsValue(props?.item); // 编辑赋值 + } + }} + onFinish={async (values: any) => { + const requestData: any = { + house_occupants_id: props?.item?.id, + type: HouseRegistersTypeEnum.UpdatePhone.value, + house_relation: props?.item?.house_relation, + update_info: { + phone: values.phone, + }, + }; + return Apis.Archive.HouseRegisters.ChangeOccupant(requestData) + .then(() => { + props.reload?.(); + message.success('电话修改成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + { + title: '手机号', + dataIndex: 'phone', + colProps: { span: 24 }, + fieldProps: { + maxLength: 11, + }, + formItemProps: { ...rulesHelper.phone }, + }, + ]} + /> + ); +} diff --git a/src/pages/archive/components/modals/OwnerUpdate.tsx b/src/pages/archive/components/modals/OwnerUpdate.tsx new file mode 100644 index 0000000..5a81da0 --- /dev/null +++ b/src/pages/archive/components/modals/OwnerUpdate.tsx @@ -0,0 +1,106 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + HouseOccupantsCardTypeEnum, + HouseRegistersTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + + return ( + + {...MyModalFormProps.props} + title={`修改信息`} + wrapperCol={{ span: 24 }} + width="600px" + trigger={} + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.setFieldsValue(props?.item); // 编辑赋值 + } + }} + onFinish={async (values: any) => { + const requestData: any = { + house_occupants_id: props?.item?.id, + type: HouseRegistersTypeEnum.UpdateInfo.value, + house_relation: props?.item?.house_relation, + update_info: { + name: values.name || props?.item, + card_type: values.card_type, + id_card: values.id_card, + card_front_image: values.card_front_image, + card_back_image: values.card_back_image, + }, + }; + return Apis.Archive.HouseRegisters.ChangeOccupant(requestData) + .then(() => { + props.reload?.(); + message.success('信息编辑成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + { + valueType: 'group', + columns: [ + { + title: '名称', + dataIndex: 'name', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumSelect({ + key: 'card_type', + title: '证件类型', + colProps: { span: 10 }, + valueEnum: HouseOccupantsCardTypeEnum, + required: true, + }), + { + title: '证件号码', + dataIndex: 'id_card', + colProps: { span: 8 }, + fieldProps: { + maxLength: 18, + }, + formItemProps: { ...rulesHelper.text }, + }, + { + valueType: 'group', + columns: [ + MyFormItems.UploadImages({ + key: 'card_front_image', + title: '证件正面', + // uploadType: 'file', + required: true, + max: 1, + colProps: { span: 6 }, + }), + MyFormItems.UploadImages({ + key: 'card_back_image', + title: '证件反面', + // uploadType: 'file', + required: true, + max: 1, + colProps: { span: 6 }, + }), + ], + }, + ], + }, + ]} + /> + ); +} diff --git a/src/pages/asset/accounts/index.tsx b/src/pages/asset/accounts/index.tsx new file mode 100644 index 0000000..3a94e7d --- /dev/null +++ b/src/pages/asset/accounts/index.tsx @@ -0,0 +1,88 @@ +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 AccountsGet from './modals/AccountsGet'; + +export default function Index({ title = '项目账户' }) { + const navigate = useNavigate(); + + // 注册当前页面为标签页 + usePageTabs({ + tabKey: 'company-project-receipt-accounts', + tabLabel: title, + }); + + return ( + + + MyProTableProps.request( + params, + sort, + Apis.Company.CompanyProjectReceiptAccounts.List, + ) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + { + title: 'ID', + dataIndex: 'id', + // width: 360, + }, + { + title: '收款账号名称', + dataIndex: ['receipt_account', 'company_name'], + }, + { + title: '开户行', + dataIndex: ['receipt_account', 'company_bank'], + search: false, + }, + { + title: '收款账号', + dataIndex: ['receipt_account', 'company_account'], + search: false, + }, + // { + // title: '是否默认', + // dataIndex: 'is_default', + // search: false, + // render(_, record) { + // return `${record?.is_default ? '是' : '否'} `; + // }, + // }, + MyColumns.UpdatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + Apis.Company.CompanyProjectReceiptAccounts.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/asset/accounts/modals/AccountsGet.tsx b/src/pages/asset/accounts/modals/AccountsGet.tsx new file mode 100644 index 0000000..90b5158 --- /dev/null +++ b/src/pages/asset/accounts/modals/AccountsGet.tsx @@ -0,0 +1,67 @@ +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} + form={form} + title={`${props.title}`} + wrapperCol={{ span: 24 }} + width="500px" + trigger={ + + } + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + key={new Date().getTime()} + onFinish={async (values) => + Apis.Company.CompanyProjectReceiptAccounts.Store({ + ...values, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + Selects?.Companies({ + key: 'companies_id', + title: '选择机构', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + }), + Selects?.AssetProjects({ + key: 'projects_id', + title: '选择项目', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + }), + Selects?.CompanyAccounts({ + key: 'receipt_accounts_id', + title: '选择收款账户', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + }), + ]} + /> + ); +} diff --git a/src/pages/asset/components/modals/AssetAccountsSelect.tsx b/src/pages/asset/accounts/modals/AccountsSelect.tsx similarity index 98% rename from src/pages/asset/components/modals/AssetAccountsSelect.tsx rename to src/pages/asset/accounts/modals/AccountsSelect.tsx index dba2dfc..650b4e4 100644 --- a/src/pages/asset/components/modals/AssetAccountsSelect.tsx +++ b/src/pages/asset/accounts/modals/AccountsSelect.tsx @@ -68,7 +68,7 @@ export default function Index(props: MyBetaModalFormProps) { onShowContactPhone()} /> ); diff --git a/src/pages/announcement/index.tsx b/src/pages/asset/announcement/index.tsx similarity index 89% rename from src/pages/announcement/index.tsx rename to src/pages/asset/announcement/index.tsx index d3d6327..f14af81 100644 --- a/src/pages/announcement/index.tsx +++ b/src/pages/asset/announcement/index.tsx @@ -13,12 +13,12 @@ import AnnouncementCreate from './modals/AnnouncementCreate'; import AnnouncementShow from './modals/AnnouncementShow'; import AnnouncementUpdate from './modals/AnnouncementUpdate'; -export default function Index({ title = '公告管理' }) { +export default function Index({ title = '项目公告' }) { const navigate = useNavigate(); // 注册当前页面为标签页 usePageTabs({ - tabKey: 'Msg', + tabKey: 'msg-property-announcements', tabLabel: title, }); @@ -26,7 +26,7 @@ export default function Index({ title = '公告管理' }) { [ , ]} columns={[ MyColumns.ID(), - { - title: '标题', + title: '关联项目', + dataIndex: ['asset_project', 'name'], + search: false, + render: (_, record) => { + return record?.asset_project?.name; + }, + }, + { + title: '公告标题', dataIndex: 'title', width: 120, // 关键:固定列宽(若父容器过窄,可设 minWidth: 200 优先保证列宽) render: (text) => ( @@ -69,7 +76,7 @@ export default function Index({ title = '公告管理' }) { ), }, { - title: '内容', + title: '公告内容', dataIndex: 'content', valueType: 'textarea', // 仅影响表单编辑时的输入类型,不影响表格展示 search: false, @@ -97,12 +104,10 @@ export default function Index({ title = '公告管理' }) { search: false, }, { - title: '项目', - dataIndex: ['asset_project', 'name'], + title: '是否发布小程序', + dataIndex: 'is_publish', + render: (text) => (text ? '是' : '否'), search: false, - render: (_, record) => { - return record?.asset_project?.name; - }, }, MyColumns.SoftDelete({ title: '启/禁用', @@ -116,9 +121,6 @@ export default function Index({ title = '公告管理' }) { dataIndex: 'created_at', valueType: 'date', search: false, - // render: (_, record) => { - // return record?.created_at?.substring(0, 10); - // }, }, MyColumns.Option({ render: (_, item: any, index, action) => ( @@ -127,7 +129,7 @@ export default function Index({ title = '公告管理' }) { diff --git a/src/pages/asset/components/modals/AnnouncementCreate.tsx b/src/pages/asset/announcement/modals/AnnouncementCreate.tsx similarity index 86% rename from src/pages/asset/components/modals/AnnouncementCreate.tsx rename to src/pages/asset/announcement/modals/AnnouncementCreate.tsx index f261c00..03a4cda 100644 --- a/src/pages/asset/components/modals/AnnouncementCreate.tsx +++ b/src/pages/asset/announcement/modals/AnnouncementCreate.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'; @@ -27,7 +28,7 @@ export default function Create(props: MyBetaModalFormProps) { onFinish={async (values) => Apis.Msg.MsgPropertyAnnouncements.Store({ ...values, - asset_projects_id: props.item?.id, + asset_projects_id: values?.asset_projects_id || props.item?.id, }) .then(() => { props.reload?.(); @@ -37,6 +38,16 @@ export default function Create(props: MyBetaModalFormProps) { .catch(() => false) } columns={[ + ...(props?.item?.id + ? [] + : [ + Selects?.AssetProjects({ + key: 'asset_projects_id', + title: '关联项目', + colProps: { span: 24 }, + required: true, + }), + ]), { key: 'title', title: '公告标题', diff --git a/src/pages/asset/components/modals/AnnouncementShow.tsx b/src/pages/asset/announcement/modals/AnnouncementShow.tsx similarity index 100% rename from src/pages/asset/components/modals/AnnouncementShow.tsx rename to src/pages/asset/announcement/modals/AnnouncementShow.tsx diff --git a/src/pages/asset/components/modals/AnnouncementUpdate.tsx b/src/pages/asset/announcement/modals/AnnouncementUpdate.tsx similarity index 100% rename from src/pages/asset/components/modals/AnnouncementUpdate.tsx rename to src/pages/asset/announcement/modals/AnnouncementUpdate.tsx diff --git a/src/pages/asset/components/modals/GridCreate.tsx b/src/pages/asset/components/modals/GridCreate.tsx deleted file mode 100644 index bdcfb20..0000000 --- a/src/pages/asset/components/modals/GridCreate.tsx +++ /dev/null @@ -1,154 +0,0 @@ -import { - MyBetaModalFormProps, - MyButtons, - MyModalFormProps, - rulesHelper, -} from '@/common'; -import { Selects } from '@/components/Select'; -import { Apis } from '@/gen/Apis'; -import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; -import { Form, message } from 'antd'; - -export default function Create(props: MyBetaModalFormProps) { - const [form] = Form.useForm(); - console.log(props?.item, 'item'); - return ( - - {...MyModalFormProps.props} - title={`划分范围`} - // 基本表单 - width="700px" - layout="horizontal" - labelCol={{ span: 4 }} - wrapperCol={{ span: 24 }} - labelAlign="right" - trigger={} - form={form} - key={new Date().getTime()} - onOpenChange={(open: any) => { - if (open) { - form.resetFields(); // 清空表单数据 - } - }} - onFinish={async (values: any) => { - values?.grid_ranges?.forEach((res: { asset_projects_id: string }) => { - res.asset_projects_id = props?.item?.id; - }); - return Apis.Grid.Grids.Store({ - ...values, - asset_projects_id: props?.item?.id, - }) - .then(() => { - props.reload?.(); - message.success('范围划分成功'); - return true; - }) - .catch(() => false); - }} - columns={[ - Selects?.GetGridMark({ - key: 'grid_mark', - title: '范围标识', - params: { - asset_projects_id: props?.item?.id, - }, - colProps: { span: 24 }, - formItemProps: { ...rulesHelper.text }, - }), - { - valueType: 'formList', - dataIndex: 'grid_ranges', - colProps: { span: 24 }, - initialValue: [''], - formItemProps: { ...rulesHelper.array }, - fieldProps: { - copyIconProps: false, - creatorButtonProps: { - creatorButtonText: '添加楼栋单元', - }, - itemRender: ( - { listDom, action }: any, - { index }: { index: number }, - ) => { - return ( - - {listDom} - - ); - }, - }, - columns: [ - { - valueType: 'dependency', - name: ['asset_buildings_id', 'asset_units_id'], - columns: ({ asset_buildings_id }) => { - return [ - { - valueType: 'group', - columns: [ - Selects?.AssetBuildings({ - key: 'asset_buildings_id', - title: '选择楼栋', - params: { - asset_projects_id: props?.item?.id, - }, - colProps: { span: 12 }, - formItemProps: { ...rulesHelper.number }, - fieldProps: { - showSearch: true, - onChange: (value: any) => { - // 获取当前表单的所有值 - const formValues = form.getFieldsValue(); - const gridRanges = formValues.grid_ranges || []; - - // 清空所有行的asset_units_id,因为楼栋变化会影响所有单元选择 - const updatedGridRanges = gridRanges.map( - (item: any, index: number) => { - if (item.asset_buildings_id === value) { - return { ...item, asset_units_id: undefined }; - } - return item; - }, - ); - - // 更新表单值 - form.setFieldsValue({ - grid_ranges: updatedGridRanges, - }); - }, - }, - }), - ...(asset_buildings_id - ? [ - Selects?.GridUnits({ - key: 'asset_units_id', - title: '选择单元', - params: { - asset_projects_id: props?.item?.id, - asset_buildings_id: asset_buildings_id, - }, - colProps: { span: 12 }, - formItemProps: { ...rulesHelper.text }, - fieldProps: { - showSearch: true, - }, - }), - ] - : []), - ], - }, - ]; - }, - }, - ], - }, - ]} - /> - ); -} diff --git a/src/pages/asset/convenience_services/index.tsx b/src/pages/asset/convenience_services/index.tsx new file mode 100644 index 0000000..649570c --- /dev/null +++ b/src/pages/asset/convenience_services/index.tsx @@ -0,0 +1,111 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, + usePageTabs, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ConvenienceServicesTypeEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; +import ServiceCreate from './modals/ServiceCreate'; +import ServiceUpdate from './modals/ServiceUpdate'; + +export default function Index({ title = '便民服务' }) { + const navigate = useNavigate(); + + // 注册当前页面为标签页 + usePageTabs({ + tabKey: 'convenience-services', + tabLabel: title, + }); + + return ( + + + MyProTableProps.request( + params, + sort, + Apis.Common.ConvenienceServices.List, + ) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID(), + { + title: '关联项目', + dataIndex: ['asset_project', 'name'], + search: { + transform: (value) => { + return { project_name: value }; + }, + }, + }, + MyColumns.EnumTag({ + title: '类型', + dataIndex: 'type', + valueEnum: ConvenienceServicesTypeEnum, + search: false, + }), + { + title: '服务名称', + dataIndex: 'name', + }, + + { + title: '联系方式', + render(_, record) { + const content = record?.content || []; + + // 过滤有效数据 + const validItems = content.filter( + (item: any) => item?.name && item?.phone, + ); + + return ( +
+ {validItems.length > 0 ? ( + validItems.map((item: any, index: number) => ( + // 每个客户信息单独一行 +
+ {item.name}: {item.phone} +
+ )) + ) : ( + 暂无客户信息 + )} +
+ ); + }, + search: false, + }, + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + Apis.Common.ConvenienceServices.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> +
+ ); +} diff --git a/src/pages/asset/components/modals/ServiceCreate.tsx b/src/pages/asset/convenience_services/modals/ServiceCreate.tsx similarity index 92% rename from src/pages/asset/components/modals/ServiceCreate.tsx rename to src/pages/asset/convenience_services/modals/ServiceCreate.tsx index 82cc80c..10eb07c 100644 --- a/src/pages/asset/components/modals/ServiceCreate.tsx +++ b/src/pages/asset/convenience_services/modals/ServiceCreate.tsx @@ -5,6 +5,7 @@ import { MyModalFormProps, rulesHelper, } from '@/common'; +import { Selects } from '@/components/Select'; import { Apis } from '@/gen/Apis'; import { ConvenienceServicesTypeEnum } from '@/gen/Enums'; import { BetaSchemaForm } from '@ant-design/pro-components'; @@ -37,7 +38,7 @@ export default function Create(props: MyBetaModalFormProps) { type: values.type, name: service.name, content: service.content, - asset_projects_id: props.item?.id, + asset_projects_id: values.asset_projects_id || props.item?.id, } as any); } props.reload?.(); @@ -49,6 +50,16 @@ export default function Create(props: MyBetaModalFormProps) { } }} columns={[ + ...(props?.item?.id + ? [] + : [ + Selects?.AssetProjects({ + key: 'asset_projects_id', + title: '关联项目', + colProps: { span: 24 }, + required: true, + }), + ]), MyFormItems.EnumRadio({ key: 'type', title: '类型', diff --git a/src/pages/asset/components/modals/ServiceUpdate.tsx b/src/pages/asset/convenience_services/modals/ServiceUpdate.tsx similarity index 100% rename from src/pages/asset/components/modals/ServiceUpdate.tsx rename to src/pages/asset/convenience_services/modals/ServiceUpdate.tsx diff --git a/src/pages/asset/grids/index.tsx b/src/pages/asset/grids/index.tsx new file mode 100644 index 0000000..5210c0d --- /dev/null +++ b/src/pages/asset/grids/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 GridCreate from './modals/GridCreate'; +import GridMannger from './modals/GridMannger'; +import GridUpdate from './modals/GridUpdate'; + +export default function Index({ title = '楼栋范围' }) { + const navigate = useNavigate(); + + // 注册当前页面为标签页 + usePageTabs({ + tabKey: 'grids', + tabLabel: title, + }); + + return ( + + + MyProTableProps.request(params, sort, Apis.Grid.Grids.List) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + { + title: '关联项目', + dataIndex: ['asset_project', 'name'], + search: { + transform: (value) => { + return { project_name: value }; + }, + }, + }, + { + title: 'ID', + dataIndex: 'id', + }, + { + title: '板块名称', + dataIndex: 'name', + }, + { + title: '标识', + dataIndex: 'grid_mark', + }, + { + title: '楼栋管家', + dataIndex: ['company_employee', 'name'], + render: (_, item: any) => + `${item?.company_employee?.name || ''}-${ + item?.company_employee?.phone || '' + }`, + }, + // MyColumns.CreatedAt(), + MyColumns.UpdatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + + Apis.Grid.Grids.Delete({ id: item.id }).then(() => + action?.reload(), + ) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/asset/grids/modals/GridCreate copy 2.tsx b/src/pages/asset/grids/modals/GridCreate copy 2.tsx new file mode 100644 index 0000000..c5cf04d --- /dev/null +++ b/src/pages/asset/grids/modals/GridCreate copy 2.tsx @@ -0,0 +1,216 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +import { useState } from 'react'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const [transferData, setTransferData] = useState([]); + const [targetKeys, setTargetKeys] = useState([]); + + // 获取Transfer数据源 + // useEffect(() => { + // const asset_projects_id = props?.item?.id || 0; + // if (asset_projects_id) { + // Apis.Asset.AssetUnits.GridSelect({ asset_projects_id }) + // .then((res) => { + // const data = + // res.data?.map((item: any) => ({ + // key: item.value?.toString(), + // title: item.label, + // description: item.label, + // })) || []; + // setTransferData(data); + // }) + // .catch(() => { + // setTransferData([]); + // }); + // } + // }, [props?.item?.id]); + + return ( + + {...MyModalFormProps.props} + title={`范围添加`} + width="700px" + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 24 }} + labelAlign="right" + trigger={ + + } + form={form} + key={new Date().getTime()} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + form.setFieldsValue({ + asset_projects_id: props?.item?.id, + }); + } + }} + onFinish={async (values: any) => { + (values.asset_projects_id = + values?.asset_projects_id || props?.item?.id), + values?.grid_ranges?.map((res: { asset_projects_id: string }) => { + res.asset_projects_id = props?.item?.id; + }); + return Apis.Grid.Grids.Store({ + ...values, + }) + .then(() => { + props.reload?.(); + message.success('网格添加成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + ...(props?.item?.id + ? [] + : [ + Selects?.AssetProjects({ + key: 'asset_projects_id', + title: '选择项目', + colProps: { span: 24 }, + required: true, + }), + ]), + + { + valueType: 'dependency', + name: ['asset_projects_id'], + columns: ({ asset_projects_id }) => { + return [ + { + valueType: 'group', + columns: [ + Selects?.GetGridMark({ + key: 'grid_mark', + title: '范围标识', + params: { + asset_projects_id: + asset_projects_id || props?.item?.id || 0, + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + { + valueType: 'formList', + dataIndex: 'grid_ranges', + colProps: { span: 24 }, + initialValue: [''], + formItemProps: { ...rulesHelper.array }, + fieldProps: { + copyIconProps: false, + creatorButtonProps: { + creatorButtonText: '添加楼栋单元', + }, + itemRender: ( + { listDom, action }: any, + { index }: { index: number }, + ) => { + return ( + + {listDom} + + ); + }, + }, + columns: [ + { + valueType: 'dependency', + name: ['asset_buildings_id', 'asset_units_id'], + columns: ({ asset_buildings_id }) => { + return [ + { + valueType: 'group', + columns: [ + Selects?.AssetBuildings({ + key: 'asset_buildings_id', + title: '选择楼栋', + params: { + asset_projects_id: props?.item?.id, + }, + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + showSearch: true, + onChange: (value: any) => { + // 获取当前表单的所有值 + const formValues = form.getFieldsValue(); + const gridRanges = + formValues.grid_ranges || []; + + // 清空所有行的asset_units_id,因为楼栋变化会影响所有单元选择 + const updatedGridRanges = gridRanges.map( + (item: any, index: number) => { + if ( + item.asset_buildings_id === value + ) { + return { + ...item, + asset_units_id: undefined, + }; + } + return item; + }, + ); + // 更新表单值 + form.setFieldsValue({ + grid_ranges: updatedGridRanges, + }); + }, + }, + }), + ...(asset_buildings_id + ? [ + Selects?.GridUnits({ + key: 'asset_units_id', + title: '选择单元', + params: { + asset_projects_id: props?.item?.id, + asset_buildings_id: + asset_buildings_id, + }, + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + showSearch: true, + }, + }), + ] + : []), + ], + }, + ]; + }, + }, + ], + }, + ], + }, + ]; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/asset/grids/modals/GridCreate copy.tsx b/src/pages/asset/grids/modals/GridCreate copy.tsx new file mode 100644 index 0000000..17ed601 --- /dev/null +++ b/src/pages/asset/grids/modals/GridCreate copy.tsx @@ -0,0 +1,157 @@ +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'; +import { useEffect, useState } from 'react'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const [transferData, setTransferData] = useState([]); + const [targetKeys, setTargetKeys] = useState([]); + + // 获取Transfer数据源 + useEffect(() => { + const asset_projects_id = props?.item?.id || 0; + if (asset_projects_id) { + Apis.Asset.AssetUnits.GridSelect({ asset_projects_id }) + .then((res) => { + const data = + res.data?.map((item: any) => ({ + key: item.value?.toString(), + title: item.label, + description: item.label, + })) || []; + setTransferData(data); + }) + .catch(() => { + setTransferData([]); + }); + } + }, [props?.item?.id]); + + console.log(props.item, 'pppp'); + return ( + + {...MyModalFormProps.props} + title={`范围添加`} + width="700px" + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 24 }} + labelAlign="right" + trigger={ + + } + form={form} + key={new Date().getTime()} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + form.setFieldsValue({ + asset_projects_id: props?.item?.id, + }); + } + }} + onFinish={async (values: any) => { + values?.grid_ranges?.map((res: { asset_projects_id: string }) => { + res.asset_projects_id = props?.item?.id; + }); + return Apis.Grid.Grids.Store({ + ...values, + }) + .then(() => { + props.reload?.(); + message.success('网格添加成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + ...(props?.item?.id + ? [] + : [ + Selects?.AssetProjects({ + key: 'asset_projects_id', + title: '选择项目', + colProps: { span: 24 }, + required: true, + }), + ]), + + { + valueType: 'dependency', + name: ['asset_projects_id'], + columns: ({ asset_projects_id }) => { + return [ + { + valueType: 'group', + columns: [ + Selects?.GetGridMark({ + key: 'grid_mark', + title: '范围标识', + params: { + asset_projects_id: + asset_projects_id || props?.item?.id || 0, + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + Selects?.GridUnits({ + key: 'grid_units_id', + title: '选择单元', + params: { + asset_projects_id: + asset_projects_id || props?.item?.id || 0, + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + // { + // valueType: 'formItem', + // dataIndex: 'grid_units_id', + // title: '选择单元', + // colProps: { span: 24 }, + // formItemProps: { ...rulesHelper.text }, + // renderFormItem: () => ( + // { + // setTargetKeys(nextTargetKeys as string[]); + // form.setFieldValue('grid_units_id', nextTargetKeys); + // }} + // render={(item) => item.title} + // titles={['可选单元', '已选单元']} + // showSearch + // listStyle={{ + // width: 250, + // height: 300, + // }} + // operations={['选择', '移除']} + // locale={{ + // itemUnit: '项', + // itemsUnit: '项', + // searchPlaceholder: '请输入搜索内容', + // notFoundContent: '列表为空', + // }} + // /> + // ), + // }, + ], + }, + ]; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/asset/grids/modals/GridCreate.tsx b/src/pages/asset/grids/modals/GridCreate.tsx new file mode 100644 index 0000000..f1a4fbc --- /dev/null +++ b/src/pages/asset/grids/modals/GridCreate.tsx @@ -0,0 +1,159 @@ +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, Transfer } from 'antd'; +import { useEffect, useState } from 'react'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const [transferData, setTransferData] = useState([]); + const [targetKeys, setTargetKeys] = useState([]); + + // 获取Transfer数据源 + useEffect(() => { + const asset_projects_id = props?.item?.id || 0; + if (asset_projects_id) { + Apis.Asset.AssetUnits.GridSelect({ asset_projects_id }) + .then((res) => { + const data = + res.data?.map((item: any) => ({ + key: item.value?.toString(), + title: item?.asset_building?.name + item.label, + })) || []; + setTransferData(data); + }) + .catch(() => { + setTransferData([]); + }); + } + }, [props?.item?.id]); + + console.log(props.item, 'pppp'); + return ( + + {...MyModalFormProps.props} + title={`范围添加`} + width="700px" + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 24 }} + labelAlign="right" + trigger={ + + } + form={form} + key={new Date().getTime()} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + form.setFieldsValue({ + asset_projects_id: props?.item?.id, + }); + } + }} + onFinish={async (values: any) => { + (values.asset_projects_id = + values?.asset_projects_id || props?.item?.id), + values?.grid_ranges?.map((res: { asset_projects_id: string }) => { + res.asset_projects_id = props?.item?.id; + }); + return Apis.Grid.Grids.Store({ + ...values, + }) + .then(() => { + props.reload?.(); + message.success('网格添加成功'); + return true; + }) + .catch(() => false); + }} + submitter={false} + footer={[]} + columns={[ + ...(props?.item?.id + ? [] + : [ + Selects?.AssetProjects({ + key: 'asset_projects_id', + title: '选择项目', + colProps: { span: 24 }, + required: true, + }), + ]), + { + valueType: 'dependency', + name: ['asset_projects_id'], + columns: ({ asset_projects_id }) => { + return [ + { + valueType: 'group', + columns: [ + Selects?.GetGridMark({ + key: 'grid_mark', + title: '范围标识', + params: { + asset_projects_id: + asset_projects_id || props?.item?.id || 0, + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + + { + valueType: 'formItem', + dataIndex: 'grid_units_id', + title: '选择单元', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + renderFormItem: () => ( +
e.stopPropagation()}> + { + setTargetKeys(nextTargetKeys as string[]); + form.setFieldValue('grid_units_id', nextTargetKeys); + }} + render={(item) => item.title} + titles={['可选单元', '已选单元']} + showSearch + listStyle={{ + width: 250, + height: 300, + }} + operations={['选择', '移除']} + operationStyle={{ marginTop: 20 }} + locale={{ + itemUnit: '项', + itemsUnit: '项', + searchPlaceholder: '请输入搜索内容', + notFoundContent: '列表为空', + }} + onSelectChange={( + sourceSelectedKeys, + targetSelectedKeys, + ) => { + // 处理选择变化,但不触发表单提交 + }} + /> +
+ ), + }, + ], + }, + ]; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/asset/components/modals/GridMannger.tsx b/src/pages/asset/grids/modals/GridMannger.tsx similarity index 100% rename from src/pages/asset/components/modals/GridMannger.tsx rename to src/pages/asset/grids/modals/GridMannger.tsx diff --git a/src/pages/asset/components/modals/GridUpdate.tsx b/src/pages/asset/grids/modals/GridUpdate.tsx similarity index 100% rename from src/pages/asset/components/modals/GridUpdate.tsx rename to src/pages/asset/grids/modals/GridUpdate.tsx diff --git a/src/pages/asset/houses/index.tsx b/src/pages/asset/houses/index.tsx new file mode 100644 index 0000000..e478a9a --- /dev/null +++ b/src/pages/asset/houses/index.tsx @@ -0,0 +1,539 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, + usePageTabs, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + AssetHousesOwnershipTypeEnum, + AssetHousesUsageEnum, +} from '@/gen/Enums'; +import { ProCard, ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { message, Space, Typography } from 'antd'; +import { useCallback, useMemo, useRef, useState } from 'react'; +import BuildingsCreate from './modals/BuildingsCreate'; +import AssetBuildingsUpdate from './modals/BuildingsUpdate'; +import HousesCreate from './modals/HousesCreate'; +import HousesUpdate from './modals/HousesUpdate'; +import UnitsCreate from './modals/UnitsCreate'; +import AssetUnitsUpdate from './modals/UnitsUpdate'; + +const { Title } = Typography; +interface SelectedAsset { + id: number; + name: string; +} + +interface SelectedBuilding { + id: number; + name: string; +} + +interface SelectedUnit { + id: number; + name: string; +} + +export default function Index({ title = '项目列表' }) { + usePageTabs({ + tabKey: 'asset-buildings', + tabLabel: title, + }); + + const actionAssetRef: any = useRef(); + const actionBuildingsRef: any = useRef(); + const actionUnitsRef: any = useRef(); + const actionHousesRef: any = useRef(); + const navigate = useNavigate(); + + const [selectedAsset, setSelectedAsset] = useState( + null, + ); + const [selectedBuilding, setSelectedBuilding] = + useState(null); + const [selectedUnit, setSelectedUnit] = useState(null); + const [loading, setLoading] = useState({ + buildings: false, + units: false, + houses: false, + }); + + // 选择项目的回调函数 + const handleAssetSelect = useCallback( + (asset: SelectedAsset) => { + if (selectedAsset?.id === asset.id) return; // 避免重复选择 + + setSelectedAsset(asset); + setSelectedBuilding(null); // 重置楼栋选择 + setSelectedUnit(null); // 重置单元选择 + + // 刷新楼栋和单元列表 + actionBuildingsRef?.current?.reload(); + actionUnitsRef?.current?.reload(); + actionHousesRef?.current?.reload(); + }, + [selectedAsset?.id], + ); + + // 选择楼栋的回调函数 + const handleBuildingSelect = useCallback( + (building: SelectedBuilding) => { + if (selectedBuilding?.id === building.id) return; // 避免重复选择 + + setSelectedBuilding(building); + setSelectedUnit(null); // 重置单元选择 + + // 刷新单元和房屋列表 + actionUnitsRef?.current?.reload(); + actionHousesRef?.current?.reload(); + }, + [selectedBuilding?.id], + ); + + // 选择单元的回调函数 + const handleUnitSelect = useCallback( + (unit: SelectedUnit) => { + if (selectedUnit?.id === unit.id) return; // 避免重复选择 + + setSelectedUnit(unit); + // 刷新房屋列表 + actionHousesRef?.current?.reload(); + }, + [selectedUnit?.id], + ); + + // 删除操作的通用处理 + const handleDelete = useCallback( + async (deleteApi: any, id: number, reloadAction: any, itemName: string) => { + try { + await deleteApi({ id }); + message.success(`${itemName}删除成功`); + reloadAction(); + + // 如果删除的是当前选中项,清空选择 + if (itemName === '项目' && selectedAsset?.id === id) { + setSelectedAsset(null); + setSelectedBuilding(null); + setSelectedUnit(null); + } else if (itemName === '楼栋' && selectedBuilding?.id === id) { + setSelectedBuilding(null); + setSelectedUnit(null); + } else if (itemName === '单元' && selectedUnit?.id === id) { + setSelectedUnit(null); + } + } catch (error) { + message.error(`${itemName}删除失败`); + console.error(`删除${itemName}失败:`, error); + } + }, + [selectedAsset?.id, selectedBuilding?.id, selectedUnit?.id], + ); + + // 通用表格配置 + const getTableConfig = useMemo( + () => ({ + ...MyProTableProps.props, + search: false as const, + size: 'middle' as const, + options: false as const, + pagination: { + pageSize: 10, + showSizeChanger: false, + }, + }), + [], + ); + + // 项目表格列配置 + const projectColumns = useMemo( + () => [ + { + title: '项目', + dataIndex: 'name', + ellipsis: true, + search: { + transform: (value: string) => ({ name: value }), + }, + }, + MyColumns.Option({ + width: 120, + render: (_, item: any, index, action) => ( + + { + navigate(`/asset/id/${item.id}`); + }} + /> + + ), + }), + ], + [handleDelete], + ); + + // 楼栋表格列配置 + const buildingColumns = useMemo( + () => [ + { + title: '楼栋', + dataIndex: 'name', + ellipsis: true, + }, + MyColumns.Option({ + width: 120, + render: (_, item: any, index, action) => ( + + + {/* + handleDelete( + Apis.Asset.AssetBuildings.Delete, + item.id, + action?.reload, + '楼栋', + ) + } + /> */} + + ), + }), + ], + [handleDelete], + ); + + // 单元表格列配置 + const unitColumns = useMemo( + () => [ + { + title: '单元', + dataIndex: 'name', + ellipsis: true, + }, + MyColumns.Option({ + width: 120, + render: (_, item: any, index, action) => ( + + + {/* + handleDelete( + Apis.Asset.AssetUnits.Delete, + item.id, + action?.reload, + '单元', + ) + } + /> */} + + ), + }), + ], + [handleDelete], + ); + + // 房屋表格列配置 + const houseColumns = useMemo( + () => [ + MyColumns.EnumTag({ + title: '用途', + dataIndex: 'usage', + valueEnum: AssetHousesUsageEnum, + }), + { + title: '房屋名称', + dataIndex: 'full_name', + }, + { + title: '楼层', + dataIndex: 'floor', + render(_, record) { + return `${record?.floor}层`; + }, + }, + { + title: '房号', + dataIndex: 'name', + }, + { + title: '计费面积', + dataIndex: 'chargeable_area', + render(_, record) { + return `${ + record?.chargeable_area ? record?.chargeable_area + ' m²' : '-' + } `; + }, + }, + + MyColumns.EnumTag({ + title: '房屋属性', + dataIndex: 'ownership_type', + valueEnum: AssetHousesOwnershipTypeEnum, + }), + MyColumns.Option({ + width: 120, + render: (_, item: any, index, action) => ( + + + {/* + handleDelete( + Apis.Asset.AssetHouses.Delete, + item.id, + action?.reload, + '房屋', + ) + } + /> */} + + ), + }), + ], + [handleDelete], + ); + + return ( + + + // } + > + +
+ + <Space + style={{ display: 'flex', justifyContent: 'space-between' }} + > + 项目信息 + </Space> + + { + return selectedBuilding?.id === record?.id + ? 'ant-table-row-selected' + : ''; + }} + onRow={(record: any) => { + return { + onClick: () => { + handleAssetSelect(record); + }, + style: { + cursor: 'pointer', + }, + }; + }} + request={async (params, sort) => + MyProTableProps.request( + { ...params }, + sort, + Apis.Asset.AssetProjects.List, + ) + } + columns={projectColumns} + /> +
+ + {/* 楼栋列表 */} + {selectedAsset ? ( +
+ + <Space + style={{ display: 'flex', justifyContent: 'space-between' }} + > + <span>{selectedAsset?.name}</span> + <BuildingsCreate + key="BuildingsCreate" + item={{ ...selectedAsset, size: 'small' }} + reload={() => actionBuildingsRef?.current?.reload()} + title="楼栋" + /> + </Space> + + { + return selectedBuilding?.id === record?.id + ? 'ant-table-row-selected' + : ''; + }} + onRow={(record: any) => { + return { + onClick: () => { + handleBuildingSelect(record); + }, + style: { + cursor: 'pointer', + }, + }; + }} + request={async (params, sort) => + MyProTableProps.request( + { ...params, asset_projects_id: selectedAsset?.id }, + sort, + Apis.Asset.AssetBuildings.List, + ) + } + columns={buildingColumns} + /> +
+ ) : ( +
+ 请先选择项目 +
+ )} + {/* 单元列表 */} + {selectedBuilding ? ( +
+ + <Space + style={{ display: 'flex', justifyContent: 'space-between' }} + > + <span>{selectedBuilding.name}</span> + <UnitsCreate + key="UnitsCreate" + item={{ + ...selectedBuilding, + asset_buildings_id: selectedBuilding?.id, + size: 'small', + }} + reload={() => actionUnitsRef?.current?.reload()} + title="单元" + /> + </Space> + + + MyProTableProps.request( + { + ...params, + asset_projects_id: selectedAsset?.id, + asset_buildings_id: selectedBuilding?.id, + }, + sort, + Apis.Asset.AssetUnits.List, + ) + } + rowClassName={(record: any) => { + return selectedUnit?.id === record?.id + ? 'ant-table-row-selected' + : ''; + }} + onRow={(record: any) => { + return { + onClick: () => { + handleUnitSelect(record); + }, + style: { + cursor: 'pointer', + }, + }; + }} + columns={unitColumns} + /> +
+ ) : ( +
+ 请先选择楼栋 +
+ )} + + {/* 房屋列表 */} + {selectedUnit ? ( +
+ + <Space + style={{ display: 'flex', justifyContent: 'space-between' }} + > + <span>{selectedUnit.name}</span> + <HousesCreate + key="HousesCreate" + item={{ + ...selectedUnit, + asset_projects_id: selectedAsset?.id, + asset_buildings_id: selectedBuilding?.id, + asset_units_id: selectedUnit?.id, + size: 'small', + }} + reload={() => actionHousesRef?.current?.reload()} + title="房屋" + /> + </Space> + + + MyProTableProps.request( + { + ...params, + asset_projects_id: selectedAsset?.id, + asset_buildings_id: selectedBuilding?.id, + asset_units_id: selectedUnit?.id, + }, + sort, + Apis.Asset.AssetHouses.List, + ) + } + columns={houseColumns} + /> +
+ ) : ( +
+ {selectedBuilding ? '请先选择单元' : '请先选择楼栋'} +
+ )} +
+
+
+ ); +} diff --git a/src/pages/asset/components/modals/BuildingsCreate.tsx b/src/pages/asset/houses/modals/BuildingsCreate.tsx similarity index 90% rename from src/pages/asset/components/modals/BuildingsCreate.tsx rename to src/pages/asset/houses/modals/BuildingsCreate.tsx index f048745..a45dc6e 100644 --- a/src/pages/asset/components/modals/BuildingsCreate.tsx +++ b/src/pages/asset/houses/modals/BuildingsCreate.tsx @@ -18,7 +18,12 @@ export default function Create(props: MyBetaModalFormProps) { title={`${props.title}`} wrapperCol={{ span: 24 }} width="500px" - trigger={} + trigger={ + + } onOpenChange={(open: any) => { if (open) { form.resetFields(); // 清空表单数据 diff --git a/src/pages/asset/components/modals/BuildingsUpdate.tsx b/src/pages/asset/houses/modals/BuildingsUpdate.tsx similarity index 100% rename from src/pages/asset/components/modals/BuildingsUpdate.tsx rename to src/pages/asset/houses/modals/BuildingsUpdate.tsx diff --git a/src/pages/asset/components/modals/HousesCreate.tsx b/src/pages/asset/houses/modals/HousesCreate.tsx similarity index 97% rename from src/pages/asset/components/modals/HousesCreate.tsx rename to src/pages/asset/houses/modals/HousesCreate.tsx index 31443e7..9e0f3fe 100644 --- a/src/pages/asset/components/modals/HousesCreate.tsx +++ b/src/pages/asset/houses/modals/HousesCreate.tsx @@ -23,7 +23,12 @@ export default function Create(props: MyBetaModalFormProps) { title={`添加${props.title}`} wrapperCol={{ span: 24 }} width="800px" - trigger={} + trigger={ + + } form={form} key={new Date().getTime()} onOpenChange={(open: any) => { diff --git a/src/pages/asset/components/modals/HousesShow.tsx b/src/pages/asset/houses/modals/HousesShow.tsx similarity index 100% rename from src/pages/asset/components/modals/HousesShow.tsx rename to src/pages/asset/houses/modals/HousesShow.tsx diff --git a/src/pages/asset/components/modals/HousesUpdate.tsx b/src/pages/asset/houses/modals/HousesUpdate.tsx similarity index 99% rename from src/pages/asset/components/modals/HousesUpdate.tsx rename to src/pages/asset/houses/modals/HousesUpdate.tsx index 8584567..950e9c8 100644 --- a/src/pages/asset/components/modals/HousesUpdate.tsx +++ b/src/pages/asset/houses/modals/HousesUpdate.tsx @@ -24,7 +24,7 @@ export default function Update(props: MyBetaModalFormProps) { wrapperCol={{ span: 24 }} width="800px" trigger={ - + } form={form} key={new Date().getTime()} diff --git a/src/pages/asset/components/modals/UnitsCreate.tsx b/src/pages/asset/houses/modals/UnitsCreate.tsx similarity index 94% rename from src/pages/asset/components/modals/UnitsCreate.tsx rename to src/pages/asset/houses/modals/UnitsCreate.tsx index 27d1d95..9cf4fb5 100644 --- a/src/pages/asset/components/modals/UnitsCreate.tsx +++ b/src/pages/asset/houses/modals/UnitsCreate.tsx @@ -21,7 +21,12 @@ export default function Create(props: MyBetaModalFormProps) { title={`添加${props.title}`} wrapperCol={{ span: 24 }} width="700px" - trigger={} + trigger={ + + } form={form} key={new Date().getTime()} onOpenChange={(open: any) => { diff --git a/src/pages/asset/components/modals/UnitsUpdate.tsx b/src/pages/asset/houses/modals/UnitsUpdate.tsx similarity index 100% rename from src/pages/asset/components/modals/UnitsUpdate.tsx rename to src/pages/asset/houses/modals/UnitsUpdate.tsx diff --git a/src/pages/asset/components/Announcement.tsx b/src/pages/asset/list/components/Announcement.tsx similarity index 94% rename from src/pages/asset/components/Announcement.tsx rename to src/pages/asset/list/components/Announcement.tsx index 3310037..4a1b8ca 100644 --- a/src/pages/asset/components/Announcement.tsx +++ b/src/pages/asset/list/components/Announcement.tsx @@ -3,9 +3,9 @@ import { Apis } from '@/gen/Apis'; import { ProTable } from '@ant-design/pro-components'; import { Space } from 'antd'; import { useEffect, useRef } from 'react'; -import AnnouncementCreate from './modals/AnnouncementCreate'; -import AnnouncementShow from './modals/AnnouncementShow'; -import AnnouncementUpdate from './modals/AnnouncementUpdate'; +import AnnouncementCreate from '../../announcement/modals/AnnouncementCreate'; +import AnnouncementShow from '../../announcement/modals/AnnouncementShow'; +import AnnouncementUpdate from '../../announcement/modals/AnnouncementUpdate'; export default function Index({ ...rest }) { const actionLooks = useRef(); @@ -35,7 +35,6 @@ export default function Index({ ...rest }) { search={false} columns={[ MyColumns.ID(), - { title: '公告标题', dataIndex: 'title', diff --git a/src/pages/asset/components/AssetAccounts.tsx b/src/pages/asset/list/components/AssetAccounts.tsx similarity index 96% rename from src/pages/asset/components/AssetAccounts.tsx rename to src/pages/asset/list/components/AssetAccounts.tsx index 3ab4e2f..1ec330d 100644 --- a/src/pages/asset/components/AssetAccounts.tsx +++ b/src/pages/asset/list/components/AssetAccounts.tsx @@ -7,7 +7,7 @@ import { import { Apis } from '@/gen/Apis'; import { ProTable } from '@ant-design/pro-components'; import { Space } from 'antd'; -import AssetAccountsSelect from './modals/AssetAccountsSelect'; +import AccountsSelect from '../../accounts/modals/AccountsSelect'; export default function ReceiptAccounts(props: MyBetaModalFormProps) { return ( @@ -27,7 +27,7 @@ export default function ReceiptAccounts(props: MyBetaModalFormProps) { ) } toolBarRender={(action) => [ - (); @@ -26,7 +26,12 @@ export default function Index({ ...rest }) { ) } toolBarRender={(action) => [ - , + , ]} search={false} columns={[ diff --git a/src/pages/asset/components/AssetInfo.tsx b/src/pages/asset/list/components/AssetInfo.tsx similarity index 98% rename from src/pages/asset/components/AssetInfo.tsx rename to src/pages/asset/list/components/AssetInfo.tsx index 7f49348..65b917b 100644 --- a/src/pages/asset/components/AssetInfo.tsx +++ b/src/pages/asset/list/components/AssetInfo.tsx @@ -29,7 +29,7 @@ export default function AssetInfo(props: MyBetaModalFormProps) {
- +
{props?.item?.company?.name}
diff --git a/src/pages/asset/components/ChargeStandard.tsx b/src/pages/asset/list/components/ChargeStandard.tsx similarity index 100% rename from src/pages/asset/components/ChargeStandard.tsx rename to src/pages/asset/list/components/ChargeStandard.tsx diff --git a/src/pages/asset/components/ConvenienceServices.tsx b/src/pages/asset/list/components/ConvenienceServices.tsx similarity index 95% rename from src/pages/asset/components/ConvenienceServices.tsx rename to src/pages/asset/list/components/ConvenienceServices.tsx index 3155a6b..d1d48a0 100644 --- a/src/pages/asset/components/ConvenienceServices.tsx +++ b/src/pages/asset/list/components/ConvenienceServices.tsx @@ -4,8 +4,8 @@ import { ConvenienceServicesTypeEnum } from '@/gen/Enums'; import { ProTable } from '@ant-design/pro-components'; import { Space } from 'antd'; import { useEffect, useRef } from 'react'; -import ServiceCreate from './modals/ServiceCreate'; -import ServiceUpdate from './modals/ServiceUpdate'; +import ServiceCreate from '../../convenience_services/modals/ServiceCreate'; +import ServiceUpdate from '../../convenience_services/modals/ServiceUpdate'; export default function Index({ ...rest }) { const actionLooks = useRef(); diff --git a/src/pages/asset/components/modals/BindCompany.tsx b/src/pages/asset/list/components/modals/BindCompany.tsx similarity index 100% rename from src/pages/asset/components/modals/BindCompany.tsx rename to src/pages/asset/list/components/modals/BindCompany.tsx diff --git a/src/pages/asset/components/modals/ChargeStandardCreate.tsx b/src/pages/asset/list/components/modals/ChargeStandardCreate.tsx similarity index 100% rename from src/pages/asset/components/modals/ChargeStandardCreate.tsx rename to src/pages/asset/list/components/modals/ChargeStandardCreate.tsx diff --git a/src/pages/asset/components/modals/ChargeStandardHasHouse.tsx b/src/pages/asset/list/components/modals/ChargeStandardHasHouse.tsx similarity index 100% rename from src/pages/asset/components/modals/ChargeStandardHasHouse.tsx rename to src/pages/asset/list/components/modals/ChargeStandardHasHouse.tsx diff --git a/src/pages/asset/components/modals/ChargeStandardUpdate.tsx b/src/pages/asset/list/components/modals/ChargeStandardUpdate.tsx similarity index 100% rename from src/pages/asset/components/modals/ChargeStandardUpdate.tsx rename to src/pages/asset/list/components/modals/ChargeStandardUpdate.tsx diff --git a/src/pages/asset/index.tsx b/src/pages/asset/list/index.tsx similarity index 97% rename from src/pages/asset/index.tsx rename to src/pages/asset/list/index.tsx index 54d8d53..7d94b71 100644 --- a/src/pages/asset/index.tsx +++ b/src/pages/asset/list/index.tsx @@ -89,7 +89,7 @@ export default function Index({ title = '项目列表' }) { search: false, }, { - title: '绑定机构', + title: '关联机构', dataIndex: ['company', 'name'], search: { transform: (value) => { @@ -116,7 +116,7 @@ export default function Index({ title = '项目列表' }) { { - navigate(`/asset/${item.id}`); + navigate(`/asset/list/show/${item.id}`); }} /> (); diff --git a/src/pages/asset_houses/index.tsx b/src/pages/asset_houses/index.tsx index bb6fc6c..0d4422d 100644 --- a/src/pages/asset_houses/index.tsx +++ b/src/pages/asset_houses/index.tsx @@ -15,8 +15,8 @@ import { ProTable } from '@ant-design/pro-components'; import { useNavigate } from '@umijs/max'; import { Space } from 'antd'; import { useState } from 'react'; -import HousesShow from '../asset/components/modals/HousesShow'; -import HousesUpdate from '../asset/components/modals/HousesUpdate'; +import HousesShow from '../asset/houses/modals/HousesShow'; +import HousesUpdate from '../asset/houses/modals/HousesUpdate'; export default function Index({ title = '房屋列表' }) { const [getParams, setParams] = useState({}); @@ -128,7 +128,7 @@ export default function Index({ title = '房屋列表' }) { // search: false, // }), MyColumns.EnumTag({ - title: '产权性质', + title: '房屋属性', dataIndex: 'ownership_type', valueEnum: AssetHousesOwnershipTypeEnum, search: false, diff --git a/src/pages/asset_houses_bill/index.tsx b/src/pages/asset_houses_bill/index.tsx new file mode 100644 index 0000000..87572f8 --- /dev/null +++ b/src/pages/asset_houses_bill/index.tsx @@ -0,0 +1,128 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, + usePageTabs, +} from '@/common'; +import { MyExport } from '@/components/MyExport'; +import { Apis } from '@/gen/Apis'; +import { AssetHousesUsageEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; +import { useState } from 'react'; +import HousesShow from '../asset/houses/modals/HousesShow'; +import HousesUpdate from '../asset/houses/modals/HousesUpdate'; + +export default function Index({ title = '房屋列表' }) { + const [getParams, setParams] = useState({}); + + const navigate = useNavigate(); + // 注册当前页面为标签页 + usePageTabs({ + tabKey: 'asset-houses', + tabLabel: title, + }); + return ( + + { + setParams(params); + return MyProTableProps.request( + params, + sort, + Apis.Asset.AssetHouses.List, + ); + }} + toolBarRender={() => [ + , + ]} + columns={[ + MyColumns.ID(), + { + title: '项目名称', + dataIndex: ['asset_project', 'name'], + search: { + transform: (value) => { + return { project_name: value }; + }, + }, + }, + { + title: '房屋名称', + dataIndex: 'full_name', + }, + MyColumns.EnumTag({ + title: '用途', + dataIndex: 'usage', + valueEnum: AssetHousesUsageEnum, + }), + { + title: '楼层', + dataIndex: 'floor', + render(_, record) { + return `${record?.floor}层`; + }, + search: false, + }, + + { + title: '建筑面积', + dataIndex: 'built_area', + render(_, record) { + return `${ + record?.built_area ? record?.built_area + ' m²' : '-' + } `; + }, + search: false, + }, + { + title: '套内面积', + dataIndex: 'inside_area', + render(_, record) { + return `${ + record?.inside_area ? record?.inside_area + ' m²' : '-' + } `; + }, + search: false, + }, + { + title: '计费面积', + dataIndex: 'chargeable_area', + render(_, record) { + return `${ + record?.chargeable_area ? record?.chargeable_area + ' m²' : '-' + } `; + }, + search: false, + }, + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + + Apis.Asset.AssetHouses.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/company/apps/index.tsx b/src/pages/company/apps/index.tsx new file mode 100644 index 0000000..e6d4814 --- /dev/null +++ b/src/pages/company/apps/index.tsx @@ -0,0 +1,95 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, + usePageTabs, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { CompanyAppsAppTypeEnum, CompanyAppsModuleEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; +import AppCreate from './modals/AppCreate'; +import AppUpdate from './modals/AppUpdate'; + +export default function Index({ title = '应用管理' }) { + const navigate = useNavigate(); + + // 注册当前页面为标签页 + usePageTabs({ + tabKey: 'company-apps', + tabLabel: title, + }); + + return ( + + + MyProTableProps.request(params, sort, Apis.Company.CompanyApps.List) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID(), + { + title: '机构', + dataIndex: ['company', 'name'], + }, + MyColumns.EnumTag({ + title: '应用类型', + dataIndex: 'app_type', + valueEnum: CompanyAppsAppTypeEnum, + }), + MyColumns.EnumTag({ + title: '模块', + dataIndex: 'module', + valueEnum: CompanyAppsModuleEnum, + search: false, + }), + { + title: '应用ID', + dataIndex: 'app_id', + search: false, + ellipsis: true, + }, + // { + // title: '应用密钥', + // dataIndex: 'app_secret', + // search: false, + // ellipsis: true, + // render: (text) => '***' + String(text).slice(-4), + // }, + + MyColumns.UpdatedAt(), + // MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + Apis.Company.CompanyApps.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/company/components/modals/CompanyAppCreate.tsx b/src/pages/company/apps/modals/AppCreate.tsx similarity index 86% rename from src/pages/company/components/modals/CompanyAppCreate.tsx rename to src/pages/company/apps/modals/AppCreate.tsx index 560b39a..c6206e7 100644 --- a/src/pages/company/components/modals/CompanyAppCreate.tsx +++ b/src/pages/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/apps/modals/AppUpdate.tsx similarity index 100% rename from src/pages/company/components/modals/CompanyAppUpdate.tsx rename to src/pages/company/apps/modals/AppUpdate.tsx diff --git a/src/pages/company/brand/index.tsx b/src/pages/company/brand/index.tsx new file mode 100644 index 0000000..2379d1f --- /dev/null +++ b/src/pages/company/brand/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 BrandsCreate from './modals/BrandsCreate'; +import BrandUpdate from './modals/BrandUpdate'; + +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'], + }, + { + title: '品牌名称', + dataIndex: 'name', + }, + { + title: 'logo', + search: false, + 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 98% rename from src/pages/company/components/modals/PropertyBrandUpdate.tsx rename to src/pages/company/brand/modals/BrandUpdate.tsx index 22f3474..8d77ecf 100644 --- a/src/pages/company/components/modals/PropertyBrandUpdate.tsx +++ b/src/pages/company/brand/modals/BrandUpdate.tsx @@ -17,7 +17,7 @@ export default function Update(props: MyBetaModalFormProps) { title={`编辑${props.title}`} trigger={} wrapperCol={{ span: 24 }} - width="300px" + width="360px" form={form} key={new Date().getTime()} onOpenChange={(open: any) => { diff --git a/src/pages/company/components/modals/PropertyBrandsCreate.tsx b/src/pages/company/brand/modals/BrandsCreate.tsx similarity index 79% rename from src/pages/company/components/modals/PropertyBrandsCreate.tsx rename to src/pages/company/brand/modals/BrandsCreate.tsx index 12189c5..f6eb76b 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'; @@ -17,7 +18,7 @@ export default function Create(props: MyBetaModalFormProps) { {...MyModalFormProps.props} title={`添加品牌`} wrapperCol={{ span: 24 }} - width="300px" + width="360px" trigger={} form={form} onOpenChange={(open: any) => { @@ -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/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/index.tsx b/src/pages/company/list/index.tsx similarity index 95% rename from src/pages/company/index.tsx rename to src/pages/company/list/index.tsx index 882bc74..f26c344 100644 --- a/src/pages/company/index.tsx +++ b/src/pages/company/list/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/list/show/${item.id}`); }} /> {...MyModalFormProps.props} @@ -18,6 +20,12 @@ export default function Create(props: MyBetaModalFormProps) { wrapperCol={{ span: 24 }} width="600px" trigger={} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} onFinish={async (values) => Apis.Company.Companies.Store({ ...values, diff --git a/src/pages/company/modals/CompanyUpdate.tsx b/src/pages/company/list/modals/CompanyUpdate.tsx similarity index 100% rename from src/pages/company/modals/CompanyUpdate.tsx rename to src/pages/company/list/modals/CompanyUpdate.tsx diff --git a/src/pages/company/$id.tsx b/src/pages/company/list/show/$id.tsx similarity index 80% rename from src/pages/company/$id.tsx rename to src/pages/company/list/show/$id.tsx index 34f2b04..2e4d94e 100644 --- a/src/pages/company/$id.tsx +++ b/src/pages/company/list/show/$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 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/components/CompanyApps.tsx b/src/pages/company/list/table/Apps.tsx similarity index 90% rename from src/pages/company/components/CompanyApps.tsx rename to src/pages/company/list/table/Apps.tsx index f924c1a..e4b474a 100644 --- a/src/pages/company/components/CompanyApps.tsx +++ b/src/pages/company/list/table/Apps.tsx @@ -8,8 +8,8 @@ import { Apis } from '@/gen/Apis'; import { CompanyAppsAppTypeEnum, CompanyAppsModuleEnum } from '@/gen/Enums'; import { ProTable } from '@ant-design/pro-components'; import { Space } from 'antd'; -import CompanyAppCreate from './modals/CompanyAppCreate'; -import CompanyAppUpdate from './modals/CompanyAppUpdate'; +import AppCreate from '../../apps/modals/AppCreate'; +import AppUpdate from '../../apps/modals/AppUpdate'; export default function CompanyApps(props: MyBetaModalFormProps) { return ( @@ -24,7 +24,7 @@ export default function CompanyApps(props: MyBetaModalFormProps) { ) } toolBarRender={(action) => [ - ( - [ - + + 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/customer_opinions/index.tsx b/src/pages/customer_opinions/index.tsx new file mode 100644 index 0000000..9b1a4ea --- /dev/null +++ b/src/pages/customer_opinions/index.tsx @@ -0,0 +1,154 @@ +import { + MyColumns, + MyPageContainer, + MyProTableProps, + usePageTabs, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { CustomerOpinionsTypeEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Image } from 'antd'; + +export default function Index({ title = '投诉建议' }) { + // 注册当前页面为标签页 + usePageTabs({ + tabKey: 'customer_opinions', + tabLabel: title, + }); + + return ( + + + MyProTableProps.request( + params, + sort, + Apis.Customer.CustomerOpinions.List, + ) + } + // toolBarRender={(action) => [ + // , + // , + // ]} + columns={[ + MyColumns.ID(), + // MyColumns.EnumTag({ + // title: '反馈来源', + // dataIndex: 'payment_method', + // valueEnum: HouseOrdersPaymentMethodEnum, + // }), + MyColumns.EnumTag({ + title: '反馈类型', + dataIndex: 'type', + valueEnum: CustomerOpinionsTypeEnum, + }), + { + title: '反馈内容', + dataIndex: 'content', + search: false, + }, + { + title: '反馈内容', + dataIndex: 'content', + width: 120, // 关键:固定列宽(若父容器过窄,可设 minWidth: 200 优先保证列宽) + render: (text) => ( +
+ {text} +
+ ), + }, + { + title: '附件', + dataIndex: 'images', + search: false, + render: (_, record) => { + if (!Array.isArray(record.images) || record.images.length === 0) { + return '无附件'; + } + return ( +
+ {record.images.map((item: any, index: number) => { + if (item.type && item.type.includes('image')) { + return ( + + ); + } else if (item.type && item.type.includes('video')) { + return ( +
+ ); + }, + }, + MyColumns.CreatedAt(), + // MyColumns.Option({ + // render: (_, item: any, index, action) => ( + // + // + // + // Apis.Common.Admins.Delete({ id: item.id }).then(() => + // action?.reload(), + // ) + // } + // /> + // + // ), + // }), + ]} + /> +
+ ); +} diff --git a/src/pages/customer_opinions/modals/CustomerOpinionShow.tsx b/src/pages/customer_opinions/modals/CustomerOpinionShow.tsx new file mode 100644 index 0000000..65b917b --- /dev/null +++ b/src/pages/customer_opinions/modals/CustomerOpinionShow.tsx @@ -0,0 +1,92 @@ +import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { + AssetProjectsChargeEnum, + AssetProjectsEntrustTypeEnum, + AssetProjectsPropertyTypeEnum, + AssetProjectsStatusEnum, +} from '@/gen/Enums'; +import { ProCard, ProDescriptions } from '@ant-design/pro-components'; +import { Space } from 'antd'; + +export default function AssetInfo(props: MyBetaModalFormProps) { + return ( + + + + + +
+ {props?.item?.name} + {props?.item?.alias_name + ? `(${props?.item?.alias_name})` + : ''} +
+
+
+ + +
{props?.item?.company?.name}
+
+
+ + + {props?.item?.province || ''} + {props?.item?.city || ''} + {props?.item?.district || ''} + {props?.item?.address || ''} + + + + + + + + + + + + + + + + {props?.item?.takeover_date} + + + {props?.item?.closure_date} + + + {/* + {props?.item?.created_at} + */} + + {props?.item?.updated_at} + +
+
+ + } + /> + ); +} diff --git a/src/pages/examine/house_registers_audit/modals/Audit.tsx b/src/pages/examine/house_registers_audit/modals/Audit.tsx index 9da4e5f..670f921 100644 --- a/src/pages/examine/house_registers_audit/modals/Audit.tsx +++ b/src/pages/examine/house_registers_audit/modals/Audit.tsx @@ -70,18 +70,20 @@ export default function Update(props: MyBetaModalFormProps) { {props?.item?.asset_house?.full_name || '-'}
- {/* - - */} + + + {props?.item?.created_at || '-'} @@ -100,20 +102,10 @@ export default function Update(props: MyBetaModalFormProps) { rowKey={(record, index) => record?.id_card || index} size="small" columns={[ - MyColumns.EnumTag({ - title: '居住关系', - dataIndex: 'residential_relation', - valueEnum: HouseOccupantsResidentialRelationEnum, - }), // MyColumns.EnumTag({ - // title: - // props?.item?.status === 'Rented' - // ? '与主租人关系' - // : '与产权人关系', - // // title: '关系说明', - // dataIndex: 'relation_with_owner', - // valueEnum: HouseOccupantsRelationWithOwnerEnum, - // search: false, + // title: '居住关系', + // dataIndex: 'residential_relation', + // valueEnum: HouseOccupantsResidentialRelationEnum, // }), { title: '姓名', @@ -159,7 +151,62 @@ export default function Update(props: MyBetaModalFormProps) { /> )} - + {(props?.item?.type === 'UpdateInfo' || + props?.item?.type === 'UpdatePhone') && ( + + record?.id_card || index} + size="small" + columns={[ + { + title: '姓名', + dataIndex: 'name', + }, + { + title: '手机号', + dataIndex: 'phone', + }, + MyColumns.EnumTag({ + title: '证件类型', + dataIndex: 'card_type', + valueEnum: HouseOccupantsCardTypeEnum, + }), + { + title: '证件号码', + dataIndex: 'id_card', + }, + { + title: '证件资料', + render: (_, item) => { + return ( + + {item?.card_front_image?.[0] && ( + + )} + {item?.card_back_image?.[0] && ( + + )} + + ); + }, + }, + ]} + /> + + )} {props?.item?.type === 'AddOwner' && props?.item?.ownership_info && props?.item?.ownership_info?.length > 0 && ( @@ -170,7 +217,7 @@ export default function Update(props: MyBetaModalFormProps) { (res: any, index: number) => ( diff --git a/src/pages/house_charge_standard/components/HasHouse.tsx b/src/pages/house_charge_standard/components/HasHouse.tsx index 7c7c7dd..c278ff1 100644 --- a/src/pages/house_charge_standard/components/HasHouse.tsx +++ b/src/pages/house_charge_standard/components/HasHouse.tsx @@ -1,6 +1,6 @@ import { MyButtons, MyColumns, MyProTableProps } from '@/common'; import { Apis } from '@/gen/Apis'; -import ChargeStandardHasHouse from '@/pages/asset/components/modals/ChargeStandardHasHouse'; +import ChargeStandardHasHouse from '@/pages/asset/list/components/modals/ChargeStandardHasHouse'; import { ProTable } from '@ant-design/pro-components'; import { Space } from 'antd'; import { useEffect, useRef } from 'react'; diff --git a/src/pages/house_charge_standard/index.tsx b/src/pages/house_charge_standard/index.tsx index 86edfa2..f53cc2e 100644 --- a/src/pages/house_charge_standard/index.tsx +++ b/src/pages/house_charge_standard/index.tsx @@ -15,8 +15,8 @@ import { import { ProTable } from '@ant-design/pro-components'; import { useNavigate } from '@umijs/max'; import { Space } from 'antd'; -import ChargeStandardHasHouse from '../asset/components/modals/ChargeStandardHasHouse'; -import ChargeStandardUpdate from '../asset/components/modals/ChargeStandardUpdate'; +import ChargeStandardHasHouse from '../asset/list/components/modals/ChargeStandardHasHouse'; +import ChargeStandardUpdate from '../asset/list/components/modals/ChargeStandardUpdate'; import ChargeCreate from './modals/ChargeCreate'; export default function Index({ title = '收费标准' }) { 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()) }