diff --git a/.umirc.ts b/.umirc.ts index 52c94ec..9539141 100644 --- a/.umirc.ts +++ b/.umirc.ts @@ -14,14 +14,9 @@ export default defineConfig({ }, proxy: { '/api/': { -<<<<<<< HEAD // target: 'http://yt:8003', target: 'http://10.39.13.80:8001', // target: 'https://weapp-api.linyikj.com.cn/', -======= - target: 'http://yt:8001', - // target: 'http://10.39.13.80:8001', ->>>>>>> 1275c157f58b27d4d2b966e91a73bab4f3360be2 // target: 'http://we6f9c65.natappfree.cc', // target: 'https://loanos-test.nchl.net/', changeOrigin: true, diff --git a/src/common/components/formFields/MyUploadImages.tsx b/src/common/components/formFields/MyUploadImages.tsx index 9eaa355..c59a0f5 100644 --- a/src/common/components/formFields/MyUploadImages.tsx +++ b/src/common/components/formFields/MyUploadImages.tsx @@ -83,27 +83,44 @@ export function MyUploadImages({ Apis.Common.Auth.PreUpload({ filename: file.name, alc: 'public-read', - }).then(async (res) => { - axios - .put(res.data.url, file, { - headers: res.data.headers, - onUploadProgress: ({ total, loaded }) => { - if (total) - onProgress( - { percent: Math.round((loaded / total) * 100).toFixed(2) }, - file, - ); - }, - }) - .then(({ data: response }) => { - console.log('response', response); - if (response.errorMessage) { - onError(response, file); - } else { - onSuccess(res.data.url.split('?')[0], file); - } - }); - }); + }) + .then(async (res) => { + try { + axios + .put(res.data.url, file, { + headers: res.data.headers, + onUploadProgress: ({ total, loaded }) => { + if (total) + onProgress( + { percent: Math.round((loaded / total) * 100).toFixed(2) }, + file, + ); + }, + }) + .then(({ data: response }) => { + console.log('response', response); + if (response && response.errorMessage) { + onError(response, file); + } else { + // 确保URL正确处理 + const fileUrl = res.data.url.split('?')[0]; + console.log('文件上传成功,URL:', fileUrl); + onSuccess(fileUrl, file); + } + }) + .catch((error) => { + console.error('上传文件时出错:', error); + onError(error, file); + }); + } catch (error) { + console.error('处理上传请求时出错:', error); + onError(error, file); + } + }) + .catch((error) => { + console.error('获取预上传URL时出错:', error); + onError(error, file); + }); return { abort() { diff --git a/src/common/components/layout/MyImportModal.tsx b/src/common/components/layout/MyImportModal.tsx index 9685dc6..7de6d39 100644 --- a/src/common/components/layout/MyImportModal.tsx +++ b/src/common/components/layout/MyImportModal.tsx @@ -7,6 +7,7 @@ type MyImportModalType = { title?: string; type?: any; params?: Record; + size?: 'small' | 'middle' | 'large'; templateApi?: () => Promise; importApi: (data: any) => Promise; reload?: () => void; @@ -17,17 +18,22 @@ export function MyImportModal(props: MyImportModalType) { const [loading, setLoading] = useState(false); const [formData, setFormData] = useState(undefined); - const { title = '批量导入', params = {}, type = 'primary' } = props; + const { + title = '批量导入', + params = {}, + type = 'primary', + size = 'middle', + } = props; return ( <> {type === 'danger' ? ( - ) : ( - diff --git a/src/common/components/layout/MyPageContainer.tsx b/src/common/components/layout/MyPageContainer.tsx index 6341496..d14142b 100644 --- a/src/common/components/layout/MyPageContainer.tsx +++ b/src/common/components/layout/MyPageContainer.tsx @@ -364,7 +364,8 @@ export function MyPageContainer({ onChange={handleTabChange} onEdit={handleTabEdit} hideAdd - size="small" + size="middle" + // 标签size renderTabBar={renderTabBar} items={tabs.map((tab) => ({ key: tab.key, @@ -372,6 +373,7 @@ export function MyPageContainer({ closable: tab.closable, }))} style={{ + marginTop: 6, marginBottom: 0, }} className="tabs-header-only" diff --git a/src/common/components/layout/TabsExample.tsx b/src/common/components/layout/TabsExample.tsx deleted file mode 100644 index f1eaa68..0000000 --- a/src/common/components/layout/TabsExample.tsx +++ /dev/null @@ -1,191 +0,0 @@ -import { PlusOutlined, SettingOutlined, UserOutlined } from '@ant-design/icons'; -import { history } from '@umijs/max'; -import { Button, Card, Divider, Space } from 'antd'; -import { MyPageContainer } from './MyPageContainer'; -import { usePageTabs } from './usePageTabs'; - -/** - * 标签页使用示例组件 - * 展示如何使用MyPageContainer的多标签页功能 - */ -export function TabsExample() { - const tabsApi = usePageTabs({ - tabKey: 'tabs-example', - tabLabel: '标签页示例', - }); - - const handleAddTab = (key: string, label: string, path: string) => { - tabsApi.addTab({ - key, - label, - path, - closable: true, - }); - history.push(path); - }; - - const handleAddTabNext = (key: string, label: string, path: string) => { - tabsApi.addTabNext({ - key, - label, - path, - closable: true, - }); - history.push(path); - }; - - return ( - - - - - - - - - - - 在当前标签右侧打开新标签 - - - - - - - - - - - - - - - - - - - - - - - -
-

🎯 核心功能

-
    -
  • - 多标签页支持:支持同时打开多个页面标签 -
  • -
  • - 智能标签插入 - :新标签页默认在当前激活标签页的右边插入 -
  • -
  • - 右键菜单:右键点击标签页显示操作菜单 -
  • -
  • - 智能导航:关闭标签时自动切换到相邻标签 -
  • -
  • - 状态持久化:标签页状态在组件间共享 -
  • -
- -

🖱️ 右键菜单操作

-
    -
  • - 刷新:重新加载当前标签页 -
  • -
  • - 关闭:关闭当前标签页 -
  • -
  • - 关闭其他:关闭除当前标签外的所有标签 -
  • -
  • - 关闭左侧:关闭当前标签左侧的所有标签 -
  • -
  • - 关闭右侧:关闭当前标签右侧的所有标签 -
  • -
- -

💻 使用方法

-
-            {`// 1. 在页面组件中使用
-import { MyPageContainer, usePageTabs } from '@/common';
-
-function YourPage() {
-  usePageTabs({
-    tabKey: 'your-page',
-    tabLabel: '页面标题'
-  });
-
-  return (
-    
-      {/* 页面内容 */}
-    
-  );
-}`}
-          
-
-
-
- ); -} diff --git a/src/common/components/schema/MyFormItems.tsx b/src/common/components/schema/MyFormItems.tsx index 57c4e96..1a932d4 100644 --- a/src/common/components/schema/MyFormItems.tsx +++ b/src/common/components/schema/MyFormItems.tsx @@ -46,15 +46,7 @@ export const MyFormItems = { ...props, }; }, - // RichText(props: PropsType): ReturnType { - // return { - // renderFormItem: () => , - // formItemProps: { - // ...(props?.required ? rulesHelper.richtext : {}), - // }, - // ...props, - // }; - // }, + UploadImages({ max = 1, help, diff --git a/src/common/index.tsx b/src/common/index.tsx index 6cc2566..44c4a49 100644 --- a/src/common/index.tsx +++ b/src/common/index.tsx @@ -10,7 +10,7 @@ export * from './components/layout/MyCommonModal'; export * from './components/layout/MyImportModal'; export * from './components/layout/MyPageContainer'; export * from './components/layout/MyRootContainer'; -export * from './components/layout/TabsExample'; + export * from './components/layout/usePageTabs'; export * from './components/props/MyDrawerProps'; diff --git a/src/gen/ApiTypes.d.ts b/src/gen/ApiTypes.d.ts index 2b3f86c..33c1b83 100644 --- a/src/gen/ApiTypes.d.ts +++ b/src/gen/ApiTypes.d.ts @@ -121,6 +121,7 @@ declare namespace ApiTypes { "asset_buildings_id"?: number; // 所属楼栋id,[ref:asset_buildings] "asset_units_id"?: number; // 所属单元id,[ref:asset_units] "name"?: string; // 模糊搜索:名称 + "full_name"?: string; // 模糊搜索:全称 }; type Store = { "asset_projects_id": number; // 所属项目id,[ref:asset_projects] @@ -179,6 +180,15 @@ declare namespace ApiTypes { "asset_projects_id"?: number; // 所属项目id,[ref:asset_projects] "upload_file"?: mimes:xlsx,xls; // 上传的时候必填文件 }; + type Export = { + "asset_projects_id"?: number; // 所属项目id,[ref:asset_projects] + "asset_buildings_id"?: number; // 所属楼栋id,[ref:asset_buildings] + "asset_units_id"?: number; // 所属单元id,[ref:asset_units] + "name"?: string; // 模糊搜索:名称 + "full_name"?: string; // 模糊搜索:全称 + "current"?: number; // 页码 + "download_type": string; // 下载类型:page 当前页(含查询条件),query 所有页(含查询条件),all所有记录 + }; } namespace AssetProjects { type List = { @@ -409,6 +419,9 @@ declare namespace ApiTypes { type Delete = { "id": number; // id }; + type Import = { + "upload_file"?: mimes:xlsx,xls; // 上传的时候必填文件 + }; } } namespace Collcetion { @@ -589,6 +602,7 @@ declare namespace ApiTypes { type List = { "companies_id"?: number; // 机构ID "organizations_id"?: number; // 组织机构ID + "organization_name"?: string; // 组织机构名称 "name"?: string; // 模糊搜索:名称 "phone"?: string; // 模糊搜索:手机号 }; @@ -729,6 +743,12 @@ declare namespace ApiTypes { "name"?: string; // 模糊搜索:名称 "companies_id"?: number; // 机构ID[ref:companies] "parent_id"?: number; // 父级ID + "company_name"?: string; // 机构名称 + }; + type TreeList = { + "name"?: string; // 模糊搜索:名称 + "companies_id"?: number; // 机构ID[ref:companies] + "parent_id"?: number; // 父级ID }; type Store = { "companies_id": number; // 所属机构id,[ref:companies] @@ -852,6 +872,50 @@ declare namespace ApiTypes { }; } } + namespace Msg { + namespace MsgPropertyAnnouncements { + type List = { + "title"?: string; // 模糊搜索:标题 + "asset_projects_id"?: number; // 项目id,[ref:asset_projects] + "project_name"?: string; // 模糊搜索:项目名称 + "is_publish"?: number; // 是否发布 + }; + type Store = { + "asset_projects_id": number; // 项目id,[ref:asset_projects] + "title": string; // 标题 + "content": string; // 内容 + "is_publish"?: number; // 是否发布 + "publish_at"?: Date; // 发布时间 + "sort"?: number; // 排序 + }; + type Update = { + "id": number; // id + "asset_projects_id": number; // 项目id,[ref:asset_projects] + "companies_id": number; // 公司id,[ref:companies] + "title": string; // 标题 + "content": string; // 内容 + "is_publish"?: number; // 是否发布 + "publish_at"?: mixed; // 发布时间 + "sort"?: number; // 排序 + "admins_id"?: number; // 创建人id,[ref:admins] + "company_employees_id"?: number; // 创建员工id,[ref:company_employees] + "last_update_admins_id"?: number; // 最后修改人id,[ref:admins] + "last_update_company_employees"?: number; // 最后修改员工id,[ref:company_employees] + }; + type Show = { + "id": number; // id + }; + type SoftDelete = { + "id": number; // id + }; + type Restore = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + } + } namespace Permission { namespace SysPermissions { type List = { diff --git a/src/gen/Apis.ts b/src/gen/Apis.ts index acf3f0d..40bd372 100644 --- a/src/gen/Apis.ts +++ b/src/gen/Apis.ts @@ -102,6 +102,9 @@ export const Apis = { DownloadTemplate(): Promise { return request('admin/asset/asset_houses/download_template', {responseType: 'blob',}); }, + Export(data: ApiTypes.Asset.AssetHouses.Export): Promise { + return request('admin/asset/asset_houses/export', { responseType: 'blob',data }); + }, }, AssetProjects: { List(data?: ApiTypes.Asset.AssetProjects.List): Promise { @@ -218,6 +221,12 @@ export const Apis = { Delete(data: ApiTypes.Bill.HouseBills.Delete): Promise { return request('admin/bill/house_bills/delete', { data }); }, + Import(data?: ApiTypes.Bill.HouseBills.Import): Promise { + return request('admin/bill/house_bills/import', { data }); + }, + DownloadTemplate(): Promise { + return request('admin/bill/house_bills/download_template', {responseType: 'blob',}); + }, }, }, Collcetion: { @@ -429,6 +438,9 @@ export const Apis = { List(data?: ApiTypes.Company.Organizations.List): Promise { return request('admin/company/organizations/list', { data }); }, + TreeList(data?: ApiTypes.Company.Organizations.TreeList): Promise { + return request('admin/company/organizations/tree_list', { data }); + }, Store(data: ApiTypes.Company.Organizations.Store): Promise { return request('admin/company/organizations/store', { data }); }, @@ -513,6 +525,31 @@ export const Apis = { }, }, }, + Msg: { + MsgPropertyAnnouncements: { + List(data?: ApiTypes.Msg.MsgPropertyAnnouncements.List): Promise { + return request('admin/msg/msg_property_announcements/list', { data }); + }, + Store(data: ApiTypes.Msg.MsgPropertyAnnouncements.Store): Promise { + return request('admin/msg/msg_property_announcements/store', { data }); + }, + Update(data: ApiTypes.Msg.MsgPropertyAnnouncements.Update): Promise { + return request('admin/msg/msg_property_announcements/update', { data }); + }, + Show(data: ApiTypes.Msg.MsgPropertyAnnouncements.Show): Promise { + return request('admin/msg/msg_property_announcements/show', { data }); + }, + SoftDelete(data: ApiTypes.Msg.MsgPropertyAnnouncements.SoftDelete): Promise { + return request('admin/msg/msg_property_announcements/soft_delete', { data }); + }, + Restore(data: ApiTypes.Msg.MsgPropertyAnnouncements.Restore): Promise { + return request('admin/msg/msg_property_announcements/restore', { data }); + }, + Delete(data: ApiTypes.Msg.MsgPropertyAnnouncements.Delete): Promise { + return request('admin/msg/msg_property_announcements/delete', { data }); + }, + }, + }, Permission: { SysPermissions: { List(data: ApiTypes.Permission.SysPermissions.List): Promise { diff --git a/src/gen/Enums.ts b/src/gen/Enums.ts index bca742a..33fbc82 100644 --- a/src/gen/Enums.ts +++ b/src/gen/Enums.ts @@ -126,7 +126,7 @@ export const BannersTypeEnum= { // 缓存类型 export const CacheTypeEnum= { - 'MobilePhoneVerificationCode': {"text":"手机验证码","color":"#2f067d","value":"MobilePhoneVerificationCode"}, + 'MobilePhoneVerificationCode': {"text":"手机验证码","color":"#f002cf","value":"MobilePhoneVerificationCode"}, }; // CompaniesMerchantTypeEnum diff --git a/src/pages/announcement/index.tsx b/src/pages/announcement/index.tsx new file mode 100644 index 0000000..f35b691 --- /dev/null +++ b/src/pages/announcement/index.tsx @@ -0,0 +1,146 @@ +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 AnnouncementCreate from './modals/AnnouncementCreate'; +import AnnouncementShow from './modals/AnnouncementShow'; +import AnnouncementUpdate from './modals/AnnouncementUpdate'; + +export default function Index({ title = '内容管理' }) { + const navigate = useNavigate(); + + // 注册当前页面为标签页 + usePageTabs({ + tabKey: 'banners', + tabLabel: title, + }); + + return ( + + + MyProTableProps.request( + params, + sort, + Apis.Msg.MsgPropertyAnnouncements.List, + ) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID(), + + { + title: '标题', + dataIndex: 'title', + width: 120, // 关键:固定列宽(若父容器过窄,可设 minWidth: 200 优先保证列宽) + render: (text) => ( +
+ {text} +
+ ), + }, + { + title: '内容', + dataIndex: 'content', + valueType: 'textarea', // 仅影响表单编辑时的输入类型,不影响表格展示 + search: false, + width: 200, // 关键:固定列宽(若父容器过窄,可设 minWidth: 200 优先保证列宽) + render: (text) => ( +
+ {text} +
+ ), + }, + { + title: '发布日期', + dataIndex: 'publish_at', + valueType: 'date', + search: false, + }, + { + title: '项目', + dataIndex: ['asset_project', 'name'], + search: false, + render: (_, record) => { + return record?.asset_project?.name; + }, + }, + MyColumns.SoftDelete({ + title: '启/禁用', + onRestore: Apis.Msg.MsgPropertyAnnouncements.Restore, + onSoftDelete: Apis.Msg.MsgPropertyAnnouncements.SoftDelete, + search: false, + }), + { + //创建日期 + title: '创建日期', + dataIndex: 'created_at', + valueType: 'date', + search: false, + // render: (_, record) => { + // return record?.created_at?.substring(0, 10); + // }, + }, + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + + Apis.Banner.Banners.Delete({ id: item.id }).then(() => + action?.reload(), + ) + } + /> + + ), + }), + ]} + /> +
+ ); +} diff --git a/src/pages/announcement/modals/AnnouncementCreate.tsx b/src/pages/announcement/modals/AnnouncementCreate.tsx new file mode 100644 index 0000000..e7e869f --- /dev/null +++ b/src/pages/announcement/modals/AnnouncementCreate.tsx @@ -0,0 +1,92 @@ +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: '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/announcement/modals/AnnouncementShow.tsx b/src/pages/announcement/modals/AnnouncementShow.tsx new file mode 100644 index 0000000..e2b7215 --- /dev/null +++ b/src/pages/announcement/modals/AnnouncementShow.tsx @@ -0,0 +1,53 @@ +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 new file mode 100644 index 0000000..2a2043f --- /dev/null +++ b/src/pages/announcement/modals/AnnouncementUpdate.tsx @@ -0,0 +1,95 @@ +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 a77e6b1..7066593 100644 --- a/src/pages/archive/components/OccupantsNow.tsx +++ b/src/pages/archive/components/OccupantsNow.tsx @@ -79,9 +79,9 @@ export default function Index({ ...rest }) { search: false, }), MyColumns.EnumTag({ - // title: - // rest?.item?.status === 'Rented' ? '与租客关系' : '与业主关系', - title: '关系说明', + title: + rest?.item?.status === 'Rented' ? '与主租人关系' : '与产权人关系', + // title: '关系说明', dataIndex: 'relation_with_owner', valueEnum: HouseOccupantsRelationWithOwnerEnum, search: false, diff --git a/src/pages/archive/components/modals/AddOccupant.tsx b/src/pages/archive/components/modals/AddOccupant.tsx index 3e20db9..fcd3e5f 100644 --- a/src/pages/archive/components/modals/AddOccupant.tsx +++ b/src/pages/archive/components/modals/AddOccupant.tsx @@ -59,7 +59,6 @@ export default function AddOccupant(props: MyBetaModalFormProps) { dataIndex: 'customer_info', colProps: { span: 24 }, initialValue: [''], - fieldProps: { copyIconProps: false, creatorButtonProps: { @@ -86,27 +85,47 @@ export default function AddOccupant(props: MyBetaModalFormProps) { { valueType: 'group', columns: [ - MyFormItems.EnumRadio({ - key: 'residential_relation', - title: '居住关系', - colProps: { span: 12 }, - valueEnum: HouseOccupantsResidentialRelationEnum, - // valueEnum: () => { - // let obj: any = JSON.parse( - // JSON.stringify(HouseOccupantsResidentialRelationEnum), - // ); - // delete obj.Tenant; - // return obj; - // }, - required: true, - }), - MyFormItems.EnumRadio({ - key: 'relation_with_owner', - title: '关系标记', - valueEnum: HouseOccupantsRelationWithOwnerEnum, - colProps: { span: 18 }, - required: true, - }), + { + valueType: 'group', + columns: [ + MyFormItems.EnumRadio({ + key: 'residential_relation', + title: '居住关系', + colProps: { span: 8 }, + valueEnum: HouseOccupantsResidentialRelationEnum, + // valueEnum: () => { + // let obj: any = JSON.parse( + // JSON.stringify(HouseOccupantsResidentialRelationEnum), + // ); + // delete obj.Tenant; + // return obj; + // }, + required: true, + }), + { + name: ['residential_relation'], + valueType: 'dependency', + columns: ({ residential_relation }: any) => { + return residential_relation !== + HouseOccupantsResidentialRelationEnum.PrimaryTenant + .value + ? [ + MyFormItems.EnumRadio({ + key: 'relation_with_owner', + title: + residential_relation === 'Resident' + ? '与产权人关系' + : '与主租人关系', + valueEnum: HouseOccupantsRelationWithOwnerEnum, + colProps: { span: 16 }, + required: true, + }), + ] + : []; + }, + }, + ], + }, { title: '姓名', dataIndex: 'name', @@ -122,69 +141,130 @@ export default function AddOccupant(props: MyBetaModalFormProps) { }, formItemProps: { ...rulesHelper.phone }, }, - MyFormItems.EnumSelect({ - key: 'card_type', - title: '证件类型', - colProps: { span: 6 }, - valueEnum: HouseOccupantsCardTypeEnum, - required: true, - }), - { - title: '证件号码', - dataIndex: 'id_card', - colProps: { span: 6 }, - fieldProps: { - maxLength: 18, - }, - formItemProps: { ...rulesHelper.text }, - }, { - valueType: 'group', - columns: [ - MyFormItems.UploadImages({ - key: 'card_front_image', - title: '证件正面', - uploadType: 'file', - max: 1, - colProps: { span: 6 }, - formItemProps: { ...rulesHelper.text }, - }), - MyFormItems.UploadImages({ - key: 'card_back_image', - title: '证件反面', - uploadType: 'file', - max: 1, - colProps: { span: 6 }, - formItemProps: { ...rulesHelper.text }, - }), - { - title: '是否入住', - dataIndex: 'is_live_in', - colProps: { span: 6 }, - valueType: 'switch', - }, - { - name: ['is_live_in'], - valueType: 'dependency', - columns: ({ is_live_in }: any) => { - return is_live_in - ? [ - { - title: '入住日期', - dataIndex: 'move_in_date', - valueType: 'date', - colProps: { span: 6 }, - fieldProps: { - style: { width: '100%' }, - }, - formItemProps: { ...rulesHelper.text }, - }, - ] - : []; - }, - }, - ], + name: ['residential_relation'], + valueType: 'dependency', + columns: ({ residential_relation }: any) => { + return residential_relation === + HouseOccupantsResidentialRelationEnum.PrimaryTenant.value + ? [ + MyFormItems.EnumSelect({ + key: 'card_type', + title: '证件类型', + colProps: { span: 6 }, + valueEnum: HouseOccupantsCardTypeEnum, + required: true, + }), + { + title: '证件号码', + dataIndex: 'id_card', + colProps: { span: 6 }, + required: true, + fieldProps: { + maxLength: 18, + }, + }, + MyFormItems.UploadImages({ + key: 'card_front_image', + title: '证件正面', + // uploadType: 'file', + max: 1, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }), + MyFormItems.UploadImages({ + key: 'card_back_image', + title: '证件反面', + // uploadType: 'file', + max: 1, + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '是否入住', + dataIndex: 'is_live_in', + colProps: { span: 6 }, + valueType: 'switch', + }, + { + name: ['is_live_in'], + valueType: 'dependency', + columns: ({ is_live_in }: any) => { + return is_live_in + ? [ + { + title: '入住日期', + dataIndex: 'move_in_date', + valueType: 'date', + colProps: { span: 6 }, + fieldProps: { + style: { width: '100%' }, + }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : []; + }, + }, + ] + : [ + MyFormItems.EnumSelect({ + key: 'card_type', + title: '证件类型', + colProps: { span: 6 }, + valueEnum: HouseOccupantsCardTypeEnum, + }), + { + title: '证件号码', + dataIndex: 'id_card', + colProps: { span: 6 }, + fieldProps: { + maxLength: 18, + }, + }, + MyFormItems.UploadImages({ + key: 'card_front_image', + title: '证件正面', + // uploadType: 'file', + max: 1, + colProps: { span: 6 }, + }), + MyFormItems.UploadImages({ + key: 'card_back_image', + title: '证件反面', + // uploadType: 'file', + max: 1, + colProps: { span: 6 }, + }), + { + title: '是否入住', + dataIndex: 'is_live_in', + colProps: { span: 6 }, + valueType: 'switch', + }, + { + name: ['is_live_in'], + valueType: 'dependency', + columns: ({ is_live_in }: any) => { + return is_live_in + ? [ + { + title: '入住日期', + dataIndex: 'move_in_date', + valueType: 'date', + colProps: { span: 6 }, + fieldProps: { + style: { width: '100%' }, + }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : []; + }, + }, + ]; + }, }, ], }, diff --git a/src/pages/archive/components/modals/AddRent.tsx b/src/pages/archive/components/modals/AddRent.tsx deleted file mode 100644 index 65a87df..0000000 --- a/src/pages/archive/components/modals/AddRent.tsx +++ /dev/null @@ -1,188 +0,0 @@ -import { - MyBetaModalFormProps, - MyButtons, - MyFormItems, - MyModalFormProps, - rulesHelper, -} from '@/common'; -import { Apis } from '@/gen/Apis'; -import { - HouseOccupantsCardTypeEnum, - HouseOccupantsHouseRelationEnum, - HouseOccupantsRelationWithOwnerEnum, -} from '@/gen/Enums'; -import { BetaSchemaForm, ProCard } 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}`} - wrapperCol={{ span: 24 }} - width="900px" - trigger={ - - } - key={new Date().getTime()} - form={form} - onOpenChange={(open: any) => { - if (open) { - form.resetFields(); // 清空表单数据 - } - }} - onFinish={async (values) => - Apis.Archive.HouseRegisters.Store({ - ...values, - asset_houses_id: props?.item?.id, - house_status: 'Rented', - type: 'AddOccupant', - }) - .then(() => { - props.reload?.(); - message.success(props.title + '成功'); - return true; - }) - .catch(() => false) - } - columns={[ - { - valueType: 'formList', - dataIndex: 'customer_info', - colProps: { span: 24 }, - fieldProps: { - copyIconProps: false, - creatorButtonProps: { - creatorButtonText: '添加租客', - }, - itemRender: ( - { listDom, action }: any, - { index }: { index: number }, - ) => { - return ( - - {listDom} - - ); - }, - }, - columns: [ - { - valueType: 'group', - columns: [ - MyFormItems.EnumRadio({ - key: 'house_relation', - title: '房客关系', - colProps: { span: 6 }, - valueEnum: () => { - let obj: any = JSON.parse( - JSON.stringify(HouseOccupantsHouseRelationEnum), - ); - delete obj.Owner; - delete obj.Resident; - return obj; - }, - required: true, - }), - MyFormItems.EnumRadio({ - key: 'relation_with_owner', - title: '关系标记', - colProps: { span: 18 }, - valueEnum: HouseOccupantsRelationWithOwnerEnum, - required: true, - }), - - { - title: '姓名', - dataIndex: 'name', - colProps: { span: 6 }, - formItemProps: { ...rulesHelper.text }, - }, - { - title: '手机号', - dataIndex: 'phone', - colProps: { span: 6 }, - fieldProps: { - maxLength: 11, - }, - formItemProps: { ...rulesHelper.text }, - }, - MyFormItems.EnumSelect({ - key: 'card_type', - title: '证件类型', - colProps: { span: 6 }, - valueEnum: HouseOccupantsCardTypeEnum, - required: true, - }), - { - title: '证件号码', - dataIndex: 'id_card', - colProps: { span: 6 }, - fieldProps: { - maxLength: 18, - }, - formItemProps: { ...rulesHelper.text }, - }, - - { - valueType: 'group', - columns: [ - MyFormItems.UploadImages({ - key: 'card_front_image', - title: '证件正面', - uploadType: 'file', - max: 1, - colProps: { span: 6 }, - formItemProps: { ...rulesHelper.text }, - }), - MyFormItems.UploadImages({ - key: 'card_back_image', - title: '证件反面', - uploadType: 'file', - max: 1, - colProps: { span: 6 }, - formItemProps: { ...rulesHelper.text }, - }), - { - title: '是否入住', - dataIndex: 'is_live_in', - colProps: { span: 6 }, - valueType: 'switch', - }, - { - name: ['is_live_in'], - valueType: 'dependency', - columns: ({ is_live_in }: any) => { - return is_live_in - ? [ - { - title: '入住日期', - dataIndex: 'move_in_date', - valueType: 'date', - colProps: { span: 6 }, - fieldProps: { - style: { width: '100%' }, - }, - formItemProps: { ...rulesHelper.text }, - }, - ] - : []; - }, - }, - ], - }, - ], - }, - ], - }, - ]} - /> - ); -} diff --git a/src/pages/asset/$id.tsx b/src/pages/asset/$id.tsx index b73f1b1..0dcae2c 100644 --- a/src/pages/asset/$id.tsx +++ b/src/pages/asset/$id.tsx @@ -2,13 +2,14 @@ import { MyPageContainer, usePageTabs } from '@/common'; import { Apis } from '@/gen/Apis'; import { ProCard } from '@ant-design/pro-components'; import { useParams } from '@umijs/max'; -import { Tabs } from 'antd'; +import { Space, Tabs } from 'antd'; import { useEffect, useState } from 'react'; import AssetAccounts from './components/AssetAccounts'; import MyAssetBuildings from './components/AssetBuildings'; import AssetGrid from './components/AssetGrid'; import AssetInfo from './components/AssetInfo'; -import Basic from './components/Basic'; +import BindCompany from './components/modals/BindCompany'; +import AssetUpdate from './modals/AssetUpdate'; export default function Show({ title }: { title?: string } = {}) { const { id } = useParams<{ id: string }>(); @@ -39,12 +40,12 @@ export default function Show({ title }: { title?: string } = {}) { }, [id]); let items = [ - { - label: '基本信息', - key: 'info', - closable: false, - children: loadShow()} />, - }, + // { + // label: '基本信息', + // key: 'info', + // closable: false, + // children: loadShow()} />, + // }, { label: '楼栋管理', key: 'asset_buildings', @@ -52,7 +53,7 @@ export default function Show({ title }: { title?: string } = {}) { children: , }, { - label: '网格管理', + label: '楼栋划分', key: 'grid', closable: false, children: , @@ -72,7 +73,22 @@ export default function Show({ title }: { title?: string } = {}) { ]; return ( - loadShow()} /> + + + + + + } + > +
* 您可在以下页签中对应管理:楼栋管理、楼栋划分、收款账号;
+
diff --git a/src/pages/asset/components/AssetBuildings.tsx b/src/pages/asset/components/AssetBuildings.tsx index 0f6a0d0..6f0a0ab 100644 --- a/src/pages/asset/components/AssetBuildings.tsx +++ b/src/pages/asset/components/AssetBuildings.tsx @@ -2,17 +2,20 @@ import { MyBetaModalFormProps, MyButtons, MyColumns, + MyImportModal, MyProTableProps, } from '@/common'; import { Apis } from '@/gen/Apis'; -import { AssetHousesUsageEnum } from '@/gen/Enums'; +import { + AssetHousesOwnershipTypeEnum, + AssetHousesUsageEnum, +} from '@/gen/Enums'; import { ProCard, ProTable } from '@ant-design/pro-components'; import { Alert, message, Space, Typography } from 'antd'; import { useCallback, useRef, useState } from 'react'; import BuildingsCreate from './modals/BuildingsCreate'; import AssetBuildingsUpdate from './modals/BuildingsUpdate'; import HousesCreate from './modals/HousesCreate'; -import HousesShow from './modals/HousesShow'; import HousesUpdate from './modals/HousesUpdate'; import AssetUnitsCreate from './modals/UnitsCreate'; import AssetUnitsUpdate from './modals/UnitsUpdate'; @@ -70,7 +73,7 @@ export default function AssetBuildings(props: MyBetaModalFormProps) { 楼栋信息 + actionUnitsRef?.current?.reload()} - title={`${selectedBuilding.name}单元`} + title="单元" + // title={`添加${selectedBuilding.name}单元`} /> )} @@ -256,7 +270,8 @@ export default function AssetBuildings(props: MyBetaModalFormProps) { asset_units_id: selectedUnit?.id, }} reload={() => actionHousesRef?.current?.reload()} - title={`${selectedUnit.name}房屋`} + title="房屋" + // title={`${selectedUnit.name}房屋`} /> )} @@ -284,11 +299,6 @@ export default function AssetBuildings(props: MyBetaModalFormProps) { showSizeChanger: false, }} columns={[ - { - title: '房号', - dataIndex: 'name', - width: 80, - }, { title: '楼层', dataIndex: 'floor', @@ -297,17 +307,28 @@ export default function AssetBuildings(props: MyBetaModalFormProps) { return `${record?.floor}层`; }, }, + { + title: '房号', + dataIndex: 'name', + width: 80, + }, MyColumns.EnumTag({ title: '用途', dataIndex: 'usage', valueEnum: AssetHousesUsageEnum, width: 100, }), + MyColumns.EnumTag({ + title: '房屋属性', + dataIndex: 'ownership_type', + valueEnum: AssetHousesOwnershipTypeEnum, + width: 100, + }), MyColumns.Option({ width: 150, render: (_, item: any, index, action) => ( - + {/* */} `${item?.company_employee?.name || ''}-${ diff --git a/src/pages/asset/components/AssetInfo.tsx b/src/pages/asset/components/AssetInfo.tsx index cd38f5e..7f49348 100644 --- a/src/pages/asset/components/AssetInfo.tsx +++ b/src/pages/asset/components/AssetInfo.tsx @@ -1,4 +1,5 @@ import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { MyModal } from '@/components/MyModal'; import { AssetProjectsChargeEnum, AssetProjectsEntrustTypeEnum, @@ -10,62 +11,82 @@ import { Space } from 'antd'; export default function AssetInfo(props: MyBetaModalFormProps) { return ( - - - - - {props?.item?.alias_name} - - - {props?.item?.province || ''} - {props?.item?.city || ''} - {props?.item?.district || ''} - {props?.item?.address || ''} - - - - - - - - - - - - - + + + + + +
+ {props?.item?.name} + {props?.item?.alias_name + ? `(${props?.item?.alias_name})` + : ''} +
+
+
+ + +
{props?.item?.company?.name}
+
+
- - {props?.item?.takeover_date} - - - {props?.item?.closure_date} - + + {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} - -
-
-
+ */} + + {props?.item?.updated_at} + + +
+ + } + /> ); } diff --git a/src/pages/asset/components/Basic.tsx b/src/pages/asset/components/Basic.tsx index 701c760..7933ef7 100644 --- a/src/pages/asset/components/Basic.tsx +++ b/src/pages/asset/components/Basic.tsx @@ -1,4 +1,10 @@ -import { MyBetaModalFormProps } from '@/common'; +import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { + AssetProjectsChargeEnum, + AssetProjectsEntrustTypeEnum, + AssetProjectsPropertyTypeEnum, + AssetProjectsStatusEnum, +} from '@/gen/Enums'; import { ProCard, ProDescriptions } from '@ant-design/pro-components'; import { Space } from 'antd'; import AssetUpdate from '../modals/AssetUpdate'; @@ -11,7 +17,12 @@ export default function info(props: MyBetaModalFormProps) { -
{props?.item?.name}
+
+ {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/asset/components/modals/BindCompany.tsx b/src/pages/asset/components/modals/BindCompany.tsx index ec4023c..97dcd0e 100644 --- a/src/pages/asset/components/modals/BindCompany.tsx +++ b/src/pages/asset/components/modals/BindCompany.tsx @@ -14,8 +14,8 @@ export default function Update(props: MyBetaModalFormProps) { return ( {...MyModalFormProps.props} - title={`调整${props.title}`} - trigger={} + title={`换绑${props.title}`} + trigger={} wrapperCol={{ span: 24 }} width="500px" request={() => diff --git a/src/pages/asset/components/modals/GridCreate.tsx b/src/pages/asset/components/modals/GridCreate.tsx index 7d16696..c806170 100644 --- a/src/pages/asset/components/modals/GridCreate.tsx +++ b/src/pages/asset/components/modals/GridCreate.tsx @@ -15,10 +15,10 @@ export default function Create(props: MyBetaModalFormProps) { return ( {...MyModalFormProps.props} - title={`创建网格`} + title={`创建板块`} wrapperCol={{ span: 24 }} width="700px" - trigger={} + trigger={} form={form} key={new Date().getTime()} onOpenChange={(open: any) => { @@ -70,7 +70,7 @@ export default function Create(props: MyBetaModalFormProps) { diff --git a/src/pages/asset/components/modals/GridMannger.tsx b/src/pages/asset/components/modals/GridMannger.tsx index bf2c787..5aff682 100644 --- a/src/pages/asset/components/modals/GridMannger.tsx +++ b/src/pages/asset/components/modals/GridMannger.tsx @@ -16,12 +16,12 @@ export default function Create( return ( {...MyModalFormProps.props} - title={`设置网格员`} + title={`设置管理员`} wrapperCol={{ span: 24 }} width="500px" form={form} key={new Date().getTime()} - trigger={} + trigger={} request={() => Promise.resolve(props.item)} onOpenChange={(open: any) => { if (open && props.item) { diff --git a/src/pages/asset/components/modals/HousesCreate.tsx b/src/pages/asset/components/modals/HousesCreate.tsx index fd2db6b..31443e7 100644 --- a/src/pages/asset/components/modals/HousesCreate.tsx +++ b/src/pages/asset/components/modals/HousesCreate.tsx @@ -23,7 +23,7 @@ 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/UnitsCreate.tsx b/src/pages/asset/components/modals/UnitsCreate.tsx index b333039..27d1d95 100644 --- a/src/pages/asset/components/modals/UnitsCreate.tsx +++ b/src/pages/asset/components/modals/UnitsCreate.tsx @@ -59,14 +59,14 @@ export default function Create(props: MyBetaModalFormProps) { title: '建筑结构', colProps: { span: 12 }, valueEnum: AssetUnitsBuildingStructureEnum, - required: true, + // required: true, }), MyFormItems.EnumRadio({ key: 'building_type', title: '建筑类型', colProps: { span: 12 }, valueEnum: AssetUnitsBuildingTypeEnum, - required: true, + // required: true, }), { key: 'elevator_count', diff --git a/src/pages/asset/components/modals/UnitsUpdate.tsx b/src/pages/asset/components/modals/UnitsUpdate.tsx index 765c6b8..e37206f 100644 --- a/src/pages/asset/components/modals/UnitsUpdate.tsx +++ b/src/pages/asset/components/modals/UnitsUpdate.tsx @@ -69,14 +69,14 @@ export default function Update(props: MyBetaModalFormProps) { title: '建筑结构', colProps: { span: 12 }, valueEnum: AssetUnitsBuildingStructureEnum, - required: true, + // required: true, }), MyFormItems.EnumRadio({ key: 'building_type', title: '建筑类型', colProps: { span: 12 }, valueEnum: AssetUnitsBuildingTypeEnum, - required: true, + // required: true, }), { key: 'elevator_count', diff --git a/src/pages/asset/index.tsx b/src/pages/asset/index.tsx index 790b414..0087d13 100644 --- a/src/pages/asset/index.tsx +++ b/src/pages/asset/index.tsx @@ -1,7 +1,6 @@ import { MyButtons, MyColumns, - MyImportModal, MyPageContainer, MyProTableProps, usePageTabs, @@ -11,9 +10,11 @@ import { AssetProjectsPropertyTypeEnum } from '@/gen/Enums'; import { ProTable } from '@ant-design/pro-components'; import { Space } from 'antd'; import { useNavigate } from 'react-router-dom'; +import AssetInfo from './components/AssetInfo'; import AssetCreate from './modals/AssetCreate'; +import AssetUpdate from './modals/AssetUpdate'; -export default function Index({ title = '项目管理' }) { +export default function Index({ title = '项目列表' }) { const navigate = useNavigate(); // 注册当前页面为标签页 @@ -36,7 +37,7 @@ export default function Index({ title = '项目管理' }) { columns={[ MyColumns.ID(), MyColumns.EnumTag({ - title: '项目类型', + title: '类型', dataIndex: 'property_type', valueEnum: AssetProjectsPropertyTypeEnum, search: false, @@ -82,6 +83,15 @@ export default function Index({ title = '项目管理' }) { onSoftDelete: Apis.Asset.AssetProjects.SoftDelete, search: false, }), + { + title: '绑定机构', + dataIndex: ['company', 'name'], + search: { + transform: (value) => { + return { company_name: value }; + }, + }, + }, // { // title: '接管日期', // dataIndex: 'takeover_date', @@ -96,20 +106,14 @@ export default function Index({ title = '项目管理' }) { MyColumns.Option({ render: (_, item: any, index, action) => ( + + { navigate(`/asset/${item.id}`); }} /> - Apis.Common.Admins.Delete({ id: item.id }).then(() => diff --git a/src/pages/asset_houses/index.tsx b/src/pages/asset_houses/index.tsx index 8d985b3..49e33e7 100644 --- a/src/pages/asset_houses/index.tsx +++ b/src/pages/asset_houses/index.tsx @@ -35,7 +35,6 @@ export default function Index({ title = '房屋列表' }) { { title: '房屋名称', dataIndex: 'full_name', - ellipsis: true, }, MyColumns.EnumTag({ diff --git a/src/pages/bills/index.tsx b/src/pages/bills/index.tsx index 865e4b6..c223188 100644 --- a/src/pages/bills/index.tsx +++ b/src/pages/bills/index.tsx @@ -1,6 +1,7 @@ import { MyButtons, MyColumns, + MyImportModal, MyPageContainer, MyProTableProps, usePageTabs, @@ -32,6 +33,15 @@ export default function Index({ title = '账单' }) { MyProTableProps.request(params, sort, Apis.Bill.HouseBills.List) } toolBarRender={(action) => [ + , , ]} columns={[ diff --git a/src/pages/company/components/Employees.tsx b/src/pages/company/components/Employees.tsx index 0551abb..38e825d 100644 --- a/src/pages/company/components/Employees.tsx +++ b/src/pages/company/components/Employees.tsx @@ -36,8 +36,12 @@ export default function Index(props: MyBetaModalFormProps) { //to-do 按层级选择 { title: '所在组织', - dataIndex: ['organization', 'name'], - search: false, + dataIndex: 'organization_path', + search: { + transform: (value) => { + return { organization_name: value }; + }, + }, }, { title: '姓名', diff --git a/src/pages/company/components/Organizations.tsx b/src/pages/company/components/Organizations.tsx index 83c3b43..e979bf2 100644 --- a/src/pages/company/components/Organizations.tsx +++ b/src/pages/company/components/Organizations.tsx @@ -21,7 +21,7 @@ export default function Organizations(props: MyBetaModalFormProps) { MyProTableProps.request( { ...params, companies_id: props?.item?.id }, sort, - Apis.Company.Organizations.List, + Apis.Company.Organizations.TreeList, ) } toolBarRender={(action) => [ @@ -35,12 +35,6 @@ export default function Organizations(props: MyBetaModalFormProps) { // search={false} // options={false} columns={[ - MyColumns.EnumTag({ - title: '组织类型', - dataIndex: 'type', - valueEnum: OrganizationsTypeEnum, - search: false, - }), { title: '组织名称', dataIndex: 'name', @@ -50,6 +44,13 @@ export default function Organizations(props: MyBetaModalFormProps) { dataIndex: 'id', search: false, }, + MyColumns.EnumTag({ + title: '组织类型', + dataIndex: 'type', + valueEnum: OrganizationsTypeEnum, + search: false, + }), + { title: '上级组织', dataIndex: ['organization_parent', 'name'], @@ -58,12 +59,12 @@ export default function Organizations(props: MyBetaModalFormProps) { MyColumns.Option({ render: (_, item: any, index, action) => ( - - } + trigger={ + + } wrapperCol={{ span: 24 }} width="500px" onOpenChange={(open: any) => { diff --git a/src/pages/company/components/modals/OrganizationCreate.tsx b/src/pages/company/components/modals/OrganizationCreate.tsx index a8990be..460c47e 100644 --- a/src/pages/company/components/modals/OrganizationCreate.tsx +++ b/src/pages/company/components/modals/OrganizationCreate.tsx @@ -41,18 +41,6 @@ export default function Create(props: MyBetaModalFormProps) { .catch(() => false) } columns={[ - Selects?.OrganizationsTree({ - title: '上级组织', - key: 'parent_id', - params: { companies_id: props?.item?.id }, - colProps: { span: 24 }, - }), - { - key: 'name', - title: '组织名称', - colProps: { span: 24 }, - formItemProps: { ...rulesHelper.text }, - }, MyFormItems.EnumRadio({ key: 'type', title: '组织类型', @@ -60,24 +48,32 @@ export default function Create(props: MyBetaModalFormProps) { valueEnum: OrganizationsTypeEnum, required: true, }), - // Selects?.Employees({ - // title: '负责人', - // colProps: { span: 8 }, - // }), - // { - // key: 'manager_phone', - // title: '负责人手机', - // colProps: { span: 8 }, - // valueType: 'number', - // fieldProps: { - // maxLength: 11, - // }, - // }, - // { - // key: 'manager_email', - // title: '负责人邮箱', - // colProps: { span: 8 }, - // }, + { + key: 'name', + title: '组织名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + name: ['type'], + valueType: 'dependency', + columns: ({ type }: any) => { + return type !== OrganizationsTypeEnum.Group.value + ? [ + Selects?.OrganizationsTree({ + title: '请设置上级组织', + key: 'parent_id', + params: { companies_id: props?.item?.id }, + colProps: { span: 24 }, + fieldProps: { + placeholder: '可搜索或手动选择上级组织', + }, + formItemProps: { ...rulesHelper.text }, + }), + ] + : []; + }, + }, ]} /> ); diff --git a/src/pages/company/components/modals/OrganizationUpdate.tsx b/src/pages/company/components/modals/OrganizationUpdate.tsx index 482ddcc..6014b58 100644 --- a/src/pages/company/components/modals/OrganizationUpdate.tsx +++ b/src/pages/company/components/modals/OrganizationUpdate.tsx @@ -40,12 +40,6 @@ export default function Update(props: MyBetaModalFormProps) { .catch(() => false) } columns={[ - { - key: 'name', - title: '组织名称', - colProps: { span: 24 }, - formItemProps: { ...rulesHelper.text }, - }, MyFormItems.EnumRadio({ key: 'type', title: '类型', @@ -53,12 +47,12 @@ export default function Update(props: MyBetaModalFormProps) { valueEnum: OrganizationsTypeEnum, required: true, }), - // Selects?.OrganizationsTree({ - // title: '上级组织', - // key: 'parent_id', - // params: { companies_id: props?.item?.companies_id }, - // colProps: { span: 24 }, - // }), + { + key: 'name', + title: '组织名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, ]} /> ); diff --git a/src/pages/company/components/modals/ReceiptAccountCreate.tsx b/src/pages/company/components/modals/ReceiptAccountCreate.tsx index 4952433..14af4f1 100644 --- a/src/pages/company/components/modals/ReceiptAccountCreate.tsx +++ b/src/pages/company/components/modals/ReceiptAccountCreate.tsx @@ -65,6 +65,23 @@ export default function Create(props: MyBetaModalFormProps) { valueEnum: CompanyReceiptAccountsPayChannelEnum, required: true, }), + { + name: ['pay_channel'], + valueType: 'dependency', + columns: ({ pay_channel }: any) => { + return pay_channel === + CompanyReceiptAccountsPayChannelEnum.TongLian.value + ? [ + { + key: 'merchant_id', + title: '商户ID', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : []; + }, + }, // { // key: 'is_default', // title: '是否设为默认账号', diff --git a/src/pages/company/components/modals/ReceiptAccountUpdate.tsx b/src/pages/company/components/modals/ReceiptAccountUpdate.tsx index 316ded2..67ecbcf 100644 --- a/src/pages/company/components/modals/ReceiptAccountUpdate.tsx +++ b/src/pages/company/components/modals/ReceiptAccountUpdate.tsx @@ -65,6 +65,23 @@ export default function Update(props: MyBetaModalFormProps) { valueEnum: CompanyReceiptAccountsPayChannelEnum, required: true, }), + { + name: ['pay_channel'], + valueType: 'dependency', + columns: ({ pay_channel }: any) => { + return pay_channel === + CompanyReceiptAccountsPayChannelEnum.TongLian.value + ? [ + { + key: 'merchant_id', + title: '商户ID', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : []; + }, + }, // { // key: 'is_default', // title: '是否设为默认账号', diff --git a/src/pages/company/index.tsx b/src/pages/company/index.tsx index 2238d82..2fcd988 100644 --- a/src/pages/company/index.tsx +++ b/src/pages/company/index.tsx @@ -6,7 +6,6 @@ import { usePageTabs, } from '@/common'; import { Apis } from '@/gen/Apis'; -import { CompaniesMerchantTypeEnum } from '@/gen/Enums'; import { ProTable } from '@ant-design/pro-components'; import { useNavigate } from '@umijs/max'; import { Space } from 'antd'; @@ -41,19 +40,21 @@ export default function Index({ title = '机构列表' }) { columns={[ MyColumns.ID(), { - title: '组织简称', + title: '机构简称', dataIndex: 'short_name', + search: false, }, { title: '企业名称', dataIndex: 'name', }, - MyColumns.EnumTag({ - title: '类型', - dataIndex: 'merchant_type', - valueEnum: CompaniesMerchantTypeEnum, - search: false, - }), + + // MyColumns.EnumTag({ + // title: '类型', + // dataIndex: 'merchant_type', + // valueEnum: CompaniesMerchantTypeEnum, + // search: false, + // }), MyColumns.SoftDelete({ onRestore: Apis.Company.Companies.Restore, onSoftDelete: Apis.Company.Companies.SoftDelete, @@ -81,7 +82,7 @@ export default function Index({ title = '机构列表' }) { /> - Apis.Common.Admins.Delete({ id: item.id }).then(() => + Apis.Company.Companies.Delete({ id: item.id }).then(() => action?.reload(), ) } diff --git a/src/pages/company/modals/CompanyCreate.tsx b/src/pages/company/modals/CompanyCreate.tsx index c03dd9d..680b72d 100644 --- a/src/pages/company/modals/CompanyCreate.tsx +++ b/src/pages/company/modals/CompanyCreate.tsx @@ -47,11 +47,13 @@ export default function Create(props: MyBetaModalFormProps) { key: 'business_license_number', title: '营业执照号', colProps: { span: 24 }, + tooltip: '限制20位', formItemProps: { ...rulesHelper.text }, fieldProps: { maxLength: 18, }, }, + { key: 'contact_name', title: '联系人姓名', diff --git a/src/pages/employees/index.tsx b/src/pages/employees/index.tsx index a4b61f5..dae6194 100644 --- a/src/pages/employees/index.tsx +++ b/src/pages/employees/index.tsx @@ -50,9 +50,13 @@ export default function Index({ title = '员工管理' }) { search: false, }, { - title: '组织', - dataIndex: ['organization', 'name'], - search: false, + title: '所在组织', + dataIndex: 'organization_path', + search: { + transform: (value) => { + return { organization_name: value }; + }, + }, }, { title: '姓名', diff --git a/src/pages/examine/house_registers_audit/modals/Audit.tsx b/src/pages/examine/house_registers_audit/modals/Audit.tsx index af1d819..003c514 100644 --- a/src/pages/examine/house_registers_audit/modals/Audit.tsx +++ b/src/pages/examine/house_registers_audit/modals/Audit.tsx @@ -12,7 +12,7 @@ import { import { Apis } from '@/gen/Apis'; import { HouseOccupantsCardTypeEnum, - HouseOccupantsHouseRelationEnum, + HouseOccupantsRelationWithOwnerEnum, HouseRegistersStatusEnum, HouseRegistersTypeEnum, } from '@/gen/Enums'; @@ -31,7 +31,7 @@ export default function Update(props: MyBetaModalFormProps) { title={props.title} trigger={} wrapperCol={{ span: 24 }} - width="1000px" + width="800px" modalProps={{ bodyStyle: { maxHeight: '70vh', overflowY: 'auto' }, }} @@ -81,7 +81,7 @@ export default function Update(props: MyBetaModalFormProps) { {props?.item?.customer_info && props?.item?.customer_info?.length > 0 && ( - + record?.id_card || index} size="small" columns={[ + // MyColumns.EnumTag({ + // title: '房客关系', + // dataIndex: 'house_relation', + // valueEnum: HouseOccupantsHouseRelationEnum, + // width: 100, + // }), MyColumns.EnumTag({ - title: '房客关系', - dataIndex: 'house_relation', - valueEnum: HouseOccupantsHouseRelationEnum, - width: 100, + title: + props?.item?.status === 'Rented' + ? '与主租人关系' + : '与产权人关系', + // title: '关系说明', + dataIndex: 'relation_with_owner', + valueEnum: HouseOccupantsRelationWithOwnerEnum, + search: false, }), { title: '姓名', dataIndex: 'name', - width: 100, }, { title: '手机号', dataIndex: 'phone', - width: 120, }, MyColumns.EnumTag({ title: '证件类型', dataIndex: 'card_type', valueEnum: HouseOccupantsCardTypeEnum, - width: 120, }), { title: '证件号码', dataIndex: 'id_card', - width: 180, }, { title: '证件资料', - width: 120, render: (_, item) => { return ( @@ -147,7 +152,7 @@ export default function Update(props: MyBetaModalFormProps) { )} - {props?.item?.type === 'Delivery' && + {props?.item?.type === 'AddOwner' && props?.item?.ownership_info && props?.item?.ownership_info?.length > 0 && (