diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index eae615c..a970c57 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -64,7 +64,7 @@ jobs: with: host: ${{ vars.DEV_HOST_IP }} port: 22 - username: 'ubuntu' + username: 'root' password: ${{ secrets.DEV_HOST_PASSWORD }} script: | docker login -u ${{ vars.REGISTRY_USERNAME }} -p ${{ secrets.REGISTRY_PASSWORD }} ${{ vars.REGISTRY_URL}} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2844942..608fc34 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,10 +12,6 @@ env: jobs: build: runs-on: ubuntu-latest - container: - image: zuogeus/act-ubuntu:node18 - options: --add-host nexus.zzwb.cc:192.168.2.7 - steps: - name: Setup Environments shell: bash @@ -25,54 +21,54 @@ jobs: echo "IMAGE_NAME=${{ vars.REGISTRY_URL }}/${{ vars.REGISTRY_NAMESPACE }}/$REPO:$GITHUB_REF_NAME" >> $GITHUB_ENV - name: Checkout - uses: https://gitee.com/zuowenbo/checkout@v4.1.1 + uses: https://gitee.com/zuowenbo/checkout@v4.2.2 - - name: Get npm cache directory - id: npm-cache-dir - shell: bash - run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT} - - - name: Set node_modules cache - uses: https://gitee.com/zuowenbo/cache@v4.0.0 - id: npm-cache + - name: Cache Docker layers + uses: https://gitee.com/zuowenbo/cache@v4.2.1 with: - path: ${{ steps.npm-cache-dir.outputs.dir }} - key: ${{ runner.os }}-node-umi4-${{ hashFiles('**/package-lock.json') }} + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ env.REPO_NAME }}-${{ github.sha }} restore-keys: | - ${{ runner.os }}-node-umi4- - - - run: npm install --registry=https://registry.npmmirror.com - - run: npm run build + ${{ runner.os }}-buildx-${{ env.REPO_NAME }}- - name: Set up Docker Buildx - uses: https://gitee.com/zuowenbo/setup-buildx-action@v3.0.0 + uses: https://gitee.com/zuowenbo/setup-buildx-action@v3.9.0 with: - driver-opts: network=host + driver-opts: image=registry.cn-shenzhen.aliyuncs.com/zuoge-proxy/buildkit:buildx-stable-1 - name: Login to Docker Hub - uses: https://gitee.com/zuowenbo/login-action@v3.0.0 + uses: https://gitee.com/zuowenbo/login-action@v3.3.0 with: registry: ${{ vars.REGISTRY_URL }} username: ${{ vars.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_PASSWORD }} - name: Build and push final image - uses: https://gitee.com/zuowenbo/build-push-action@v5.1.0 + uses: https://gitee.com/zuowenbo/build-push-action@v6.14.0 with: context: . tags: ${{ env.IMAGE_NAME }} push: true + platforms: linux/amd64 build-args: BRANCH=${{ env.GITHUB_REF_NAME }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache - name: Deploy to remote uses: https://gitee.com/zuowenbo/ssh-action@v1.0.3 with: - host: ${{ vars.LOAN_MAIN_HOST_IP_PHP }} + host: ${{ vars.MAIN_HOST_IP }} port: 22 - username: 'ubuntu' - password: ${{ secrets.LOAN_MAIN_HOST_PASSWORD }} + username: 'root' + password: ${{ secrets.MAIN_HOST_PASSWORD }} script: | docker login -u ${{ vars.REGISTRY_USERNAME }} -p ${{ secrets.REGISTRY_PASSWORD }} ${{ vars.REGISTRY_URL}} + docker volume create ${{ env.REPO_NAME }} || true docker pull ${{ env.IMAGE_NAME }} docker stop ${{ env.REPO_NAME }} || true docker rm ${{ env.REPO_NAME }} || true diff --git a/.umirc.ts b/.umirc.ts index 594e7bb..6fc5cab 100644 --- a/.umirc.ts +++ b/.umirc.ts @@ -14,8 +14,9 @@ export default defineConfig({ }, proxy: { '/api/': { - target: 'http://yt:8001', - // target: 'http://10.39.13.80:8001', + // target: 'http://yt:8003', + target: 'http://10.39.13.80:8001', + // target: 'https://test-admin.linyikj.com.cn/', // target: 'http://we6f9c65.natappfree.cc', // target: 'https://loanos-test.nchl.net/', changeOrigin: true, diff --git a/src/common/components/Editor/custom-types.d.ts b/src/common/components/Editor/custom-types.d.ts new file mode 100644 index 0000000..4c7f653 --- /dev/null +++ b/src/common/components/Editor/custom-types.d.ts @@ -0,0 +1,14 @@ +import { SlateDescendant } from '@wangeditor/editor'; + +declare module '@wangeditor/editor' { + // 扩展 Text + interface SlateText { + text: string; + } + + // 扩展 Element + interface SlateElement { + type: string; + children: SlateDescendant[]; + } +} diff --git a/src/common/components/Editor/index.tsx b/src/common/components/Editor/index.tsx new file mode 100644 index 0000000..dac622e --- /dev/null +++ b/src/common/components/Editor/index.tsx @@ -0,0 +1,113 @@ +import { Apis } from '@/gen/Apis'; +import { IDomEditor, IToolbarConfig } from '@wangeditor/editor'; +import { Editor, Toolbar } from '@wangeditor/editor-for-react'; +import '@wangeditor/editor/dist/css/style.css'; // 引入 css +import axios from 'axios'; +import { useEffect, useState } from 'react'; +type InsertFnType = (url: string) => void; +function MyEditor(props: any) { + // editor 实例 + const [editor, setEditor] = useState(null); // TS 语法 + + // 编辑器内容 + const [html, setHtml] = useState(''); + + useEffect(() => { + setTimeout(() => { + setHtml(props.value || ''); + }, 500); + }, []); + + // 工具栏配置 + const toolbarConfig: Partial = {}; // TS 语法 + // const toolbarConfig = { } // JS 语法 + const customRequest = ( + file: any, + onSuccess: (url: string, file: any) => void, + ) => { + Apis.Auth.PreUpload({ + filename: file.name, + alc: 'public-read', + }).then(async (res) => { + axios + .put(res.data.url, file, { + headers: res.data.headers, + onUploadProgress: ({ total, loaded }) => { + console.log('loaded', total, loaded); + }, + }) + .then(({ data: response }) => { + console.log('response', response); + if (response.errorMessage) { + console.log(response, file); + } else { + onSuccess(res.data.url.split('?')[0], file); + } + }); + }); + + return { + abort() { + console.log('upload progress is aborted.'); + }, + }; + }; + // 编辑器配置 + const editorConfig: Partial = { + // TS 语法 + // const editorConfig = { // JS 语法 + placeholder: '请输入内容...', + MENU_CONF: { + uploadVideo: { + async customUpload(file: File, insertFn: InsertFnType) { + // TS 语法 + customRequest(file, (url) => { + console.log(url, '视频'); + insertFn(url); + }); + }, + }, + uploadImage: { + async customUpload(file: File, insertFn: InsertFnType) { + // TS 语法 + customRequest(file, (url) => { + console.log(url, '图片'); + insertFn(url); + }); + }, + }, + }, + }; + + // 及时销毁 editor ,重要! + useEffect(() => { + return () => { + if (editor === null) return; + editor.destroy(); + setEditor(null); + }; + }, [editor]); + + return ( +
+ + props?.onChange?.(editor.getHtml())} + mode="default" + style={{ height: '500px', overflowY: 'hidden' }} + /> +
+ ); +} + +export default MyEditor; diff --git a/src/common/components/MyButtons.tsx b/src/common/components/MyButtons.tsx index 951028a..86a4e81 100644 --- a/src/common/components/MyButtons.tsx +++ b/src/common/components/MyButtons.tsx @@ -49,14 +49,14 @@ export const MyButtons = { }, View({ title, ...rest }: MyButtonsType): JSX.Element { return ( - ); }, Edit({ title = '编辑', ...rest }: MyButtonsType): JSX.Element { return ( - ); 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 07ee28e..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' ? ( - ) : ( - @@ -54,7 +60,10 @@ export function MyImportModal(props: MyImportModalType) { }); }} confirmLoading={loading} - destroyOnClose={true} + // 使用 destroyOnClose 已弃用,建议使用 afterClose 处理清理逻辑 + afterClose={() => { + setFormData(undefined); + }} maskClosable={false} footer={(dom) => { return ( 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/components/Address.tsx b/src/components/Address.tsx index 14b6f5f..6d78126 100644 --- a/src/components/Address.tsx +++ b/src/components/Address.tsx @@ -5,6 +5,7 @@ import { ProFormText, } from '@ant-design/pro-components'; +import { rulesHelper } from '@/common'; import { DefaultOptionType } from 'antd/es/cascader'; import data from './city.json'; const request = async () => Promise.resolve(data as Record[]); @@ -45,9 +46,9 @@ export const Address = { return accumulator; }, {} as Record); }, - // formItemProps: { - // ...(required ? rulesHelper.array : {}), - // }, + formItemProps: { + ...(required ? rulesHelper.array : {}), + }, fieldProps: { showSearch: true, changeOnSelect: true, diff --git a/src/components/MyExport.tsx b/src/components/MyExport.tsx new file mode 100644 index 0000000..d9363fe --- /dev/null +++ b/src/components/MyExport.tsx @@ -0,0 +1,45 @@ +import { Button, Dropdown, MenuProps } from 'antd'; + +export const MyExport = (props: any) => { + const items: MenuProps['items'] = [ + { + key: '1', + label: '当前页(含查询条件)', + onClick: () => + props?.keyParams + ? props?.download?.({ download_type: 'page', ...props?.item }) + : props?.download?.Export?.({ + download_type: 'page', + ...props?.item, + }), + }, + { + key: '2', + label: '所有页(含查询条件)', + onClick: () => + props?.keyParams + ? props?.download?.({ download_type: 'query', ...props?.item }) + : props?.download?.Export?.({ + download_type: 'query', + ...props?.item, + }), + }, + { + key: '3', + label: '所有记录', + onClick: () => + props?.keyParams + ? props?.download?.({ download_type: 'all', ...props?.item }) + : props?.download?.Export?.({ + download_type: 'all', + ...props?.item, + }), + }, + ]; + + return ( + + + + ); +}; diff --git a/src/components/MyModal.tsx b/src/components/MyModal.tsx index 671d149..3daae85 100644 --- a/src/components/MyModal.tsx +++ b/src/components/MyModal.tsx @@ -1,15 +1,15 @@ import { MyButtons } from '@/common'; import { Modal } from 'antd'; -import { useImperativeHandle, useState } from 'react'; +import { useImperativeHandle, useState } from 'react'; export function MyModal(props?: any) { const [open, setOpen] = useState(false); const close = () => { - setOpen(false) - } + setOpen(false); + }; useImperativeHandle(props.myRef, () => ({ - close - })); + close, + })); return ( <> {props?.trigger ? ( @@ -17,6 +17,7 @@ export function MyModal(props?: any) { ) : ( setOpen(true)} /> )} diff --git a/src/gen/ApiTypes.d.ts b/src/gen/ApiTypes.d.ts index 969daac..2962ef0 100644 --- a/src/gen/ApiTypes.d.ts +++ b/src/gen/ApiTypes.d.ts @@ -46,18 +46,12 @@ declare namespace ApiTypes { "asset_houses_id": number; // 房屋ID "type": string; // 类型,[enum:HouseRegistersTypeEnum] "status"?: string; // 状态,[enum:HouseRegistersStatusEnum] - "house_status"?: string; // 房屋状态,[enum:HouseRegistersHouseStatusEnum] - "usage_plan"?: string; // 使用计划,[enum:HouseRegistersUsagePlanEnum] - "customer_type"?: string; // 客户类型,[enum:HouseRegistersCustomerTypeEnum] "customer_info"?: string[]; // 客户信息 "ownership_info"?: string[]; // 产权信息 }; type Update = { "id": number; // id "type": string; // 类型,[enum:HouseRegistersTypeEnum] - "house_status"?: string; // 房屋状态,[enum:HouseRegistersHouseStatusEnum] - "usage_plan"?: string; // 使用计划,[enum:HouseRegistersUsagePlanEnum] - "customer_type"?: string; // 客户类型,[enum:HouseRegistersCustomerTypeEnum] "customer_info"?: string[]; // 客户信息 "ownership_info"?: string[]; // 产权信息 }; @@ -127,6 +121,8 @@ declare namespace ApiTypes { "asset_buildings_id"?: number; // 所属楼栋id,[ref:asset_buildings] "asset_units_id"?: number; // 所属单元id,[ref:asset_units] "name"?: string; // 模糊搜索:名称 + "full_name"?: string; // 模糊搜索:全称 + "project_name"?: string; // 模糊搜索:项目名称 }; type Store = { "asset_projects_id": number; // 所属项目id,[ref:asset_projects] @@ -181,6 +177,19 @@ declare namespace ApiTypes { "asset_units_id"?: number; // 所属单元id,[ref:asset_units] "keywords"?: string; // 关键词 }; + type Import = { + "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 = { @@ -411,6 +420,9 @@ declare namespace ApiTypes { type Delete = { "id": number; // id }; + type Import = { + "upload_file"?: mimes:xlsx,xls; // 上传的时候必填文件 + }; } } namespace Collcetion { @@ -420,6 +432,7 @@ declare namespace ApiTypes { "asset_houses_id"?: number; // 房屋id,[ref:asset_houses] "channel"?: string; // 通知渠道,[enum:HouseCollectionTasksChannelEnum] "status"?: string; // 通知状态,[enum:HouseCollectionRecordsStatusEnum] + "full_name"?: string; // 房屋名称 }; type Show = { "id": number; // id @@ -490,6 +503,28 @@ declare namespace ApiTypes { "filename": string; // 文件名称 }; } + namespace ConvenienceServices { + type List = { + "name"?: string; // 模糊搜索:名称 + }; + type Store = { + "type": string; // 类型,[enum:ConvenienceServicesTypeEnum] + "name": string; // 名称 + "content": string[]; // 内容 + }; + type Update = { + "id": number; // id + "type": string; // 类型,[enum:ConvenienceServicesTypeEnum] + "name": string; // 名称 + "content": string[]; // 内容 + }; + type Show = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + } } namespace Company { namespace Companies { @@ -590,6 +625,7 @@ declare namespace ApiTypes { type List = { "companies_id"?: number; // 机构ID "organizations_id"?: number; // 组织机构ID + "organization_name"?: string; // 组织机构名称 "name"?: string; // 模糊搜索:名称 "phone"?: string; // 模糊搜索:手机号 }; @@ -730,6 +766,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] @@ -816,6 +858,95 @@ declare namespace ApiTypes { }; } } + namespace HouseCharage { + namespace HouseChargeHasHouses { + type List = { + "house_charge_standards_id": number; // 房屋收费标准id,[ref:house_charge_standards] + }; + type Store = { + "house_charge_standards_id": number; // 房屋收费标准id,[ref:house_charge_standards] + "houses_ids": string[]; // 房屋id,[ref:houses] + }; + type GetChargeStandardHouseIds = { + "house_charge_standards_id": number; // 房屋收费标准id,[ref:house_charge_standards] + }; + type Show = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + } + namespace HouseChargeStandards { + type List = { + "name"?: string; // 模糊搜索:名称 + "project_name"?: string; // 模糊搜索:项目名称 + "company_name"?: string; // 模糊搜索:机构名称 + "charge_type"?: string; // 收费类型,[enum:HouseBillsTypeEnum] + "asset_projects_id"?: number; // 项目id,[ref:asset_projects] + "companies_id"?: number; // 机构id,[ref:companies] + }; + type Store = { + "asset_projects_id": number; // 项目id,[ref:asset_projects] + "name": string; // 收费标准名称 + "type": string; // 收费类型,[enum:HouseChargeStandardsTypeEnum] + "charge_type": string; // 收费类型,[enum:HouseBillsTypeEnum] + "calculation_mode": string; // 计费模式,[enum:HouseChargeStandardsCalculationModeEnum] + "calculation_method": string; // 计量方式,[enum:HouseChargeStandardsCalculationMethodEnum] + "price_algorithm": string; // 单价算法,[enum:HouseChargeStandardsPriceAlgorithmEnum] + "price"?: number; // 单价 + "calculation_period"?: string; // 计费周期,[enum:HouseChargeStandardsCalculationPeriodEnum] + "auto_date"?: Date; // 自动生成日期 + "is_tiered"?: number; // 是否阶梯收费 + "tiered_rates"?: string[]; // 阶梯收费标准 + "is_apportionment"?: number; // 是否分摊 + "apportionment_method"?: string; // 分摊方式,[enum:HouseChargeStandardsApportionmentMethodEnum] + "has_late_fee"?: number; // 是否滞纳金 + "late_fee_start_days"?: number; // 生成几天后开始收取滞纳金 + "late_fee_rate"?: number; // 滞纳金费率(百分比) + "late_fee_cap_days"?: number; // 滞纳金封顶天数 + "has_minimum_charge"?: number; // 是否保底价 + "minimum_charge_amount"?: number; // 保底价金额 + "remark"?: string; // 备注 + }; + type Update = { + "id": number; // id + "asset_projects_id": number; // 项目id,[ref:asset_projects] + "name": string; // 收费标准名称 + "type": string; // 收费类型,[enum:HouseChargeStandardsTypeEnum] + "charge_type": string; // 收费类型,[enum:HouseBillsTypeEnum] + "calculation_mode": string; // 计费模式,[enum:HouseChargeStandardsCalculationModeEnum] + "calculation_method": string; // 计量方式,[enum:HouseChargeStandardsCalculationMethodEnum] + "price_algorithm": string; // 单价算法,[enum:HouseChargeStandardsPriceAlgorithmEnum] + "price"?: number; // 单价 + "calculation_period"?: string; // 计费周期,[enum:HouseChargeStandardsCalculationPeriodEnum] + "auto_date"?: Date; // 自动生成日期 + "is_tiered"?: number; // 是否阶梯收费 + "tiered_rates"?: string[]; // 阶梯收费标准 + "is_apportionment"?: number; // 是否分摊 + "apportionment_method"?: string; // 分摊方式,[enum:HouseChargeStandardsApportionmentMethodEnum] + "has_late_fee"?: number; // 是否滞纳金 + "late_fee_start_days"?: number; // 生成几天后开始收取滞纳金 + "late_fee_rate"?: number; // 滞纳金费率(百分比) + "late_fee_cap_days"?: number; // 滞纳金封顶天数 + "has_minimum_charge"?: number; // 是否保底价 + "minimum_charge_amount"?: number; // 保底价金额 + "remark"?: string; // 备注 + }; + type Show = { + "id": number; // id + }; + type SoftDelete = { + "id": number; // id + }; + type Restore = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + } + } namespace HouseOrder { namespace HouseOrderPayments { type List = { @@ -853,6 +984,49 @@ 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"?: boolean; // 是否发布 + "publish_at"?: Date; // 发布时间 + "sort"?: number; // 排序 + }; + type Update = { + "id": number; // id + "asset_projects_id": number; // 项目id,[ref:asset_projects] + "title": string; // 标题 + "content": string; // 内容 + "is_publish"?: boolean; // 是否发布 + "publish_at"?: Date; // 发布时间 + "sort"?: number; // 排序 + }; + type Show = { + "id": number; // id + }; + type IsPublish = { + "id": number; // id + "is_publish": boolean; // 是否发布 + }; + type SoftDelete = { + "id": number; // id + }; + type Restore = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + } + } namespace Permission { namespace SysPermissions { type List = { @@ -960,10 +1134,10 @@ declare namespace ApiTypes { "id": number; // id "type": string; // 工单类型,[enum:HouseWorkOrdersTypeEnum] "level": string; // 优先级,[enum:HouseWorkOrdersLevelEnum] - "title": string; // 工单标题 "content": string; // 工单内容 "reporter_name"?: string; // 上报人名称 "reporter_phone"?: string; // 上报人手机 + "contact_phone"?: string; // 联系人电话 "attachments"?: string[]; // 工单附件 "asset_houses_id": number; // 资产房屋id,[ref:asset_houses] }; diff --git a/src/gen/Apis.ts b/src/gen/Apis.ts index 3b32f20..1e64ee1 100644 --- a/src/gen/Apis.ts +++ b/src/gen/Apis.ts @@ -96,6 +96,15 @@ export const Apis = { Select(data?: ApiTypes.Asset.AssetHouses.Select): Promise { return request('admin/asset/asset_houses/select', { data }); }, + Import(data?: ApiTypes.Asset.AssetHouses.Import): Promise { + return request('admin/asset/asset_houses/import', { data }); + }, + 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 { @@ -212,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: { @@ -285,6 +300,23 @@ export const Apis = { return request('admin/common/auth/temporary_url', { data }); }, }, + ConvenienceServices: { + List(data?: ApiTypes.Common.ConvenienceServices.List): Promise { + return request('admin/common/convenience_services/list', { data }); + }, + Store(data: ApiTypes.Common.ConvenienceServices.Store): Promise { + return request('admin/common/convenience_services/store', { data }); + }, + Update(data: ApiTypes.Common.ConvenienceServices.Update): Promise { + return request('admin/common/convenience_services/update', { data }); + }, + Show(data: ApiTypes.Common.ConvenienceServices.Show): Promise { + return request('admin/common/convenience_services/show', { data }); + }, + Delete(data: ApiTypes.Common.ConvenienceServices.Delete): Promise { + return request('admin/common/convenience_services/delete', { data }); + }, + }, }, Company: { Companies: { @@ -423,6 +455,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 }); }, @@ -477,6 +512,48 @@ export const Apis = { }, }, }, + HouseCharage: { + HouseChargeHasHouses: { + List(data: ApiTypes.HouseCharage.HouseChargeHasHouses.List): Promise { + return request('admin/house_charage/house_charge_has_houses/list', { data }); + }, + Store(data: ApiTypes.HouseCharage.HouseChargeHasHouses.Store): Promise { + return request('admin/house_charage/house_charge_has_houses/store', { data }); + }, + GetChargeStandardHouseIds(data: ApiTypes.HouseCharage.HouseChargeHasHouses.GetChargeStandardHouseIds): Promise { + return request('admin/house_charage/house_charge_has_houses/get_charge_standard_house_ids', { data }); + }, + Show(data: ApiTypes.HouseCharage.HouseChargeHasHouses.Show): Promise { + return request('admin/house_charage/house_charge_has_houses/show', { data }); + }, + Delete(data: ApiTypes.HouseCharage.HouseChargeHasHouses.Delete): Promise { + return request('admin/house_charage/house_charge_has_houses/delete', { data }); + }, + }, + HouseChargeStandards: { + List(data?: ApiTypes.HouseCharage.HouseChargeStandards.List): Promise { + return request('admin/house_charage/house_charge_standards/list', { data }); + }, + Store(data: ApiTypes.HouseCharage.HouseChargeStandards.Store): Promise { + return request('admin/house_charage/house_charge_standards/store', { data }); + }, + Update(data: ApiTypes.HouseCharage.HouseChargeStandards.Update): Promise { + return request('admin/house_charage/house_charge_standards/update', { data }); + }, + Show(data: ApiTypes.HouseCharage.HouseChargeStandards.Show): Promise { + return request('admin/house_charage/house_charge_standards/show', { data }); + }, + SoftDelete(data: ApiTypes.HouseCharage.HouseChargeStandards.SoftDelete): Promise { + return request('admin/house_charage/house_charge_standards/soft_delete', { data }); + }, + Restore(data: ApiTypes.HouseCharage.HouseChargeStandards.Restore): Promise { + return request('admin/house_charage/house_charge_standards/restore', { data }); + }, + Delete(data: ApiTypes.HouseCharage.HouseChargeStandards.Delete): Promise { + return request('admin/house_charage/house_charge_standards/delete', { data }); + }, + }, + }, HouseOrder: { HouseOrderPayments: { List(data: ApiTypes.HouseOrder.HouseOrderPayments.List): Promise { @@ -507,6 +584,34 @@ 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 }); + }, + IsPublish(data: ApiTypes.Msg.MsgPropertyAnnouncements.IsPublish): Promise { + return request('admin/msg/msg_property_announcements/is_publish', { 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 ccd2165..0f7a2f4 100644 --- a/src/gen/Enums.ts +++ b/src/gen/Enums.ts @@ -126,7 +126,7 @@ export const BannersTypeEnum= { // 缓存类型 export const CacheTypeEnum= { - 'MobilePhoneVerificationCode': {"text":"手机验证码","color":"#f8c2db","value":"MobilePhoneVerificationCode"}, + 'MobilePhoneVerificationCode': {"text":"手机验证码","color":"#a10533","value":"MobilePhoneVerificationCode"}, }; // CompaniesMerchantTypeEnum @@ -148,6 +148,18 @@ export const CompanyAppsModuleEnum= { 'Customer': {"text":"客户端","color":"#10b981","value":"Customer"}, }; +// CompanyEmployeeBacklogsStatusEnum +export const CompanyEmployeeBacklogsStatusEnum= { + 'Pending': {"text":"待办","color":"#FF6600","value":"Pending"}, + 'Completed': {"text":"已办","color":"#2A82E4","value":"Completed"}, +}; + +// CompanyEmployeeBacklogsTypeEnum +export const CompanyEmployeeBacklogsTypeEnum= { + 'WorkOrder': {"text":"工单","color":"#FF6600","value":"WorkOrder"}, + 'Contract': {"text":"合同","color":"#2A82E4","value":"Contract"}, +}; + // CompanyReceiptAccountsPayChannelEnum export const CompanyReceiptAccountsPayChannelEnum= { 'WeChat': {"text":"微信","color":"#07c160","value":"WeChat"}, @@ -156,10 +168,18 @@ export const CompanyReceiptAccountsPayChannelEnum= { 'TongLian': {"text":"通联支付","color":"#ff9f0a","value":"TongLian"}, }; +// ConvenienceServicesTypeEnum +export const ConvenienceServicesTypeEnum= { + 'EmergencyRepair': {"text":"紧急抢修","color":"#ef4444","value":"EmergencyRepair"}, + 'LifeService': {"text":"生活服务","color":"#3b82f6","value":"LifeService"}, + 'GovernmentConsulting': {"text":"政务咨询","color":"#10b981","value":"GovernmentConsulting"}, + 'PropertyExclusive': {"text":"物业专属","color":"#8b5cf6","value":"PropertyExclusive"}, +}; + // CustomerBacklogsStatusEnum export const CustomerBacklogsStatusEnum= { 'Pending': {"text":"待办","color":"#faad14","value":"Pending"}, - 'Done': {"text":"已办","color":"#52c41a","value":"Done"}, + 'Completed': {"text":"已办","color":"#2A82E4","value":"Completed"}, }; // CustomerBacklogsTypeEnum @@ -188,6 +208,77 @@ export const HouseBillsTypeEnum= { 'SharedElectricityFee': {"text":"公摊电费","color":"#ec4899","value":"SharedElectricityFee"}, }; +// HouseChargeStandardsApportionmentMethodEnum +export const HouseChargeStandardsApportionmentMethodEnum= { + 'HouseCount': {"text":"房屋数分摊","color":"#3b82f6","value":"HouseCount"}, + 'AreaProportion': {"text":"房屋计费面积分摊","color":"#10b981","value":"AreaProportion"}, + 'FixedRatio': {"text":"按固定比例分摊","color":"#f59e0b","value":"FixedRatio"}, +}; + +// HouseChargeStandardsCalculationMethodEnum +export const HouseChargeStandardsCalculationMethodEnum= { + 'ChargeableArea': {"text":"计费面积","color":"#3b82f6","value":"ChargeableArea"}, + 'BuiltArea': {"text":"建筑面积","color":"#10b981","value":"BuiltArea"}, + 'InsideArea': {"text":"套内面积","color":"#f59e0b","value":"InsideArea"}, + 'PerUnit': {"text":"按套","color":"#06b6d4","value":"PerUnit"}, + 'ElectricityUsage': {"text":"用电量","color":"#8b5cf6","value":"ElectricityUsage"}, + 'WaterUsage': {"text":"用水量","color":"#ec4899","value":"WaterUsage"}, +}; + +// HouseChargeStandardsCalculationModeEnum +export const HouseChargeStandardsCalculationModeEnum= { + 'FixedAmount': {"text":"固定金额","color":"#3b82f6","value":"FixedAmount"}, + 'QuantityPrice': {"text":"数量*单价","color":"#10b981","value":"QuantityPrice"}, +}; + +// HouseChargeStandardsCalculationPeriodEnum +export const HouseChargeStandardsCalculationPeriodEnum= { + 'PerTime': {"text":"按次","color":"#3b82f6","value":"PerTime"}, + 'PerDay': {"text":"按日","color":"#10b981","value":"PerDay"}, + 'PerMonth': {"text":"按月","color":"#f59e0b","value":"PerMonth"}, + 'PerYear': {"text":"按年","color":"#8b5cf6","value":"PerYear"}, +}; + +// HouseChargeStandardsPriceAlgorithmEnum +export const HouseChargeStandardsPriceAlgorithmEnum= { + 'Fixed': {"text":"固定","color":"#4caf50","value":"Fixed"}, + 'Tiered': {"text":"分级价阶梯","color":"#2196f3","value":"Tiered"}, + 'Peak': {"text":"最高价阶梯","color":"#ff9800","value":"Peak"}, +}; + +// HouseChargeStandardsStatusEnum +export const HouseChargeStandardsStatusEnum= { + 'Active': {"text":"启用","color":"#3b82f6","value":"Active"}, + 'Inactive': {"text":"禁用","color":"#ef4444","value":"Inactive"}, +}; + +// HouseChargeStandardsTypeEnum +export const HouseChargeStandardsTypeEnum= { + 'House': {"text":"房屋","color":"#3b82f6","value":"House"}, + 'Meter': {"text":"仪表","color":"#10b981","value":"Meter"}, +}; + +// HouseChargeTaskDetailsStatusEnum +export const HouseChargeTaskDetailsStatusEnum= { + 'Pending': {"text":"待处理","color":"#f59e0b","value":"Pending"}, + 'Success': {"text":"成功","color":"#22c55e","value":"Success"}, + 'Failed': {"text":"失败","color":"#ef4444","value":"Failed"}, +}; + +// HouseChargeTasksStatusEnum +export const HouseChargeTasksStatusEnum= { + 'Pending': {"text":"待执行","color":"#f59e0b","value":"Pending"}, + 'InProgress': {"text":"执行中","color":"#3b82f6","value":"InProgress"}, + 'Completed': {"text":"已完成","color":"#10b981","value":"Completed"}, + 'Failed': {"text":"失败","color":"#ef4444","value":"Failed"}, +}; + +// HouseChargeTasksTypeEnum +export const HouseChargeTasksTypeEnum= { + 'Scheduled': {"text":"定时创建","color":"#3b82f6","value":"Scheduled"}, + 'Manual': {"text":"手动创建","color":"#10b981","value":"Manual"}, +}; + // HouseCollectionRecordsCollectionResultEnum export const HouseCollectionRecordsCollectionResultEnum= { 'PromiseToPay': {"text":"承诺缴费","color":"#4caf50","value":"PromiseToPay"}, @@ -234,18 +325,23 @@ export const HouseOccupantsCardTypeEnum= { // HouseOccupantsHouseRelationEnum export const HouseOccupantsHouseRelationEnum= { 'Owner': {"text":"产权人","color":"#2db7f5","value":"Owner"}, - 'Resident': {"text":"住户","color":"#87d068","value":"Resident"}, - 'Tenant': {"text":"租客","color":"#fa8c16","value":"Tenant"}, + 'NonOwner': {"text":"非产权人","color":"#fa8c16","value":"NonOwner"}, }; // HouseOccupantsRelationWithOwnerEnum export const HouseOccupantsRelationWithOwnerEnum= { - 'Self': {"text":"本人","color":"#52c41a","value":"Self"}, - 'Spouse': {"text":"夫妻","color":"#2db7f5","value":"Spouse"}, - 'FatherSon': {"text":"父子","color":"#faad14","value":"FatherSon"}, - 'MotherSon': {"text":"母子","color":"#fa8c16","value":"MotherSon"}, + 'Spouse': {"text":"配偶","color":"#2db7f5","value":"Spouse"}, 'Children': {"text":"子女","color":"#87d068","value":"Children"}, - 'ContactPerson': {"text":"指定联系人","color":"#f5222d","value":"ContactPerson"}, + 'Parents': {"text":"父母","color":"#faad14","value":"Parents"}, + 'Siblings': {"text":"兄弟姐妹","color":"#fa8c16","value":"Siblings"}, + 'OtherRelatives': {"text":"其他亲属","color":"#f5222d","value":"OtherRelatives"}, +}; + +// HouseOccupantsResidentialRelationEnum +export const HouseOccupantsResidentialRelationEnum= { + 'Resident': {"text":"住户","color":"#2db7f5","value":"Resident"}, + 'PrimaryTenant': {"text":"主租人","color":"#87d068","value":"PrimaryTenant"}, + 'Tenant': {"text":"租客","color":"#fa8c16","value":"Tenant"}, }; // HouseOccupantsStatusEnum @@ -296,18 +392,18 @@ export const HouseRegistersIdentityTypeEnum= { // HouseRegistersStatusEnum export const HouseRegistersStatusEnum= { 'Pending': {"text":"待审","color":"#faad14","value":"Pending"}, - 'Approved': {"text":"已审","color":"#52c41a","value":"Approved"}, + 'Approved': {"text":"通过","color":"#52c41a","value":"Approved"}, 'Rejected': {"text":"驳回","color":"#f5222d","value":"Rejected"}, }; // HouseRegistersTypeEnum export const HouseRegistersTypeEnum= { - 'Delivery': {"text":"入户登记","color":"#2db7f5","value":"Delivery"}, - 'Transfer': {"text":"过户登记","color":"#87d068","value":"Transfer"}, + 'AddOwner': {"text":"添加产权人","color":"#52c41a","value":"AddOwner"}, + 'RemoveOwner': {"text":"减少产权人","color":"#d9363e","value":"RemoveOwner"}, 'AddOccupant': {"text":"添加住户","color":"#108ee9","value":"AddOccupant"}, + 'RemoveOccupant': {"text":"移除住户","color":"#fa8c16","value":"RemoveOccupant"}, 'MoveOut': {"text":"搬离登记","color":"#f50","value":"MoveOut"}, 'MoveIn': {"text":"搬入登记","color":"#ffc53d","value":"MoveIn"}, - 'RemoveOwner': {"text":"减少产权人","color":"#d9363e","value":"RemoveOwner"}, }; // HouseRegistersUsagePlanEnum diff --git a/src/pages/announcement/index.tsx b/src/pages/announcement/index.tsx new file mode 100644 index 0000000..d3d6327 --- /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: 'Msg', + 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.Msg.MsgPropertyAnnouncements.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 2f93e0e..7066593 100644 --- a/src/pages/archive/components/OccupantsNow.tsx +++ b/src/pages/archive/components/OccupantsNow.tsx @@ -8,8 +8,8 @@ import { import { ProTable } from '@ant-design/pro-components'; import { Popconfirm, Space, Tag } from 'antd'; import { useEffect, useRef } from 'react'; +import Delivery from '../modals/Delivery'; import AddOccupant from './modals/AddOccupant'; -import AddRent from './modals/AddRent'; import MoveIn from './modals/MoveIn'; import MoveOut from './modals/MoveOut'; import OccupantShow from './modals/OccupantShow'; @@ -45,24 +45,30 @@ export default function Index({ ...rest }) { ) } toolBarRender={(action) => [ - , - , - , + !rest.item?.house_occupants?.length ? ( + '' + ) : ( + <> + + + + ), ]} search={false} columns={[ @@ -73,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 8f5c430..fcd3e5f 100644 --- a/src/pages/archive/components/modals/AddOccupant.tsx +++ b/src/pages/archive/components/modals/AddOccupant.tsx @@ -10,11 +10,13 @@ import { HouseOccupantsCardTypeEnum, HouseOccupantsHouseRelationEnum, HouseOccupantsRelationWithOwnerEnum, + HouseOccupantsResidentialRelationEnum, + HouseRegistersTypeEnum, } from '@/gen/Enums'; import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; import { Form, message } from 'antd'; -export default function Create(props: MyBetaModalFormProps) { +export default function AddOccupant(props: MyBetaModalFormProps) { const [form] = Form.useForm(); return ( @@ -36,7 +38,13 @@ export default function Create(props: MyBetaModalFormProps) { Apis.Archive.HouseRegisters.Store({ ...values, asset_houses_id: props?.item?.id, - type: 'AddOccupant', + type: HouseRegistersTypeEnum.AddOccupant.value, + customer_info: values.customer_info?.map((res: any) => { + return { + ...res, + house_relation: HouseOccupantsHouseRelationEnum.NonOwner.value, + }; + }), }) .then(() => { props.reload?.(); @@ -50,10 +58,11 @@ export default function Create(props: MyBetaModalFormProps) { valueType: 'formList', dataIndex: 'customer_info', colProps: { span: 24 }, + initialValue: [''], fieldProps: { copyIconProps: false, creatorButtonProps: { - creatorButtonText: '添加住户', + creatorButtonText: '添加客户', }, itemRender: ( { listDom, action }: any, @@ -63,7 +72,7 @@ export default function Create(props: MyBetaModalFormProps) { @@ -76,34 +85,47 @@ export default function Create(props: MyBetaModalFormProps) { { valueType: 'group', columns: [ - MyFormItems.EnumRadio({ - key: 'house_relation', - title: '房客关系', - colProps: { span: 6 }, - valueEnum: () => { - let obj: any = JSON.parse( - JSON.stringify(HouseOccupantsHouseRelationEnum), - ); - delete obj.Tenant; - return obj; - }, - required: true, - }), - MyFormItems.EnumRadio({ - key: 'relation_with_owner', - title: '关系标记', - valueEnum: HouseOccupantsRelationWithOwnerEnum, - colProps: { span: 18 }, - // valueEnum: () => { - // let obj: any = JSON.parse( - // JSON.stringify(HouseOccupantsRelationWithOwnerEnum), - // ); - // delete obj.Self; - // return obj; - // }, - 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', @@ -119,69 +141,130 @@ export default function Create(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/archive/components/modals/RegistersShow.tsx b/src/pages/archive/components/modals/RegistersShow.tsx index 27aaedc..a3cf902 100644 --- a/src/pages/archive/components/modals/RegistersShow.tsx +++ b/src/pages/archive/components/modals/RegistersShow.tsx @@ -8,7 +8,7 @@ import { MyModal } from '@/components/MyModal'; import { HouseOccupantsCardTypeEnum, HouseOccupantsHouseRelationEnum, - HouseOccupantsRelationWithOwnerEnum, + HouseOccupantsResidentialRelationEnum, HouseRegistersStatusEnum, HouseRegistersTypeEnum, } from '@/gen/Enums'; @@ -63,9 +63,9 @@ export default function RegistersShow(props: MyBetaModalFormProps) { valueEnum: HouseOccupantsHouseRelationEnum, }), MyColumns.EnumTag({ - title: '关系说明', - dataIndex: 'relation_with_owner', - valueEnum: HouseOccupantsRelationWithOwnerEnum, + title: '居住关系', + dataIndex: 'residential_relation', + valueEnum: HouseOccupantsResidentialRelationEnum, }), { title: '姓名', diff --git a/src/pages/archive/index.tsx b/src/pages/archive/index.tsx index b98a51d..5d98c75 100644 --- a/src/pages/archive/index.tsx +++ b/src/pages/archive/index.tsx @@ -8,7 +8,6 @@ import { import { Apis } from '@/gen/Apis'; import { AssetHousesOwnershipTypeEnum, - AssetHousesStatusEnum, AssetHousesUsageEnum, } from '@/gen/Enums'; import { ProTable } from '@ant-design/pro-components'; @@ -32,17 +31,26 @@ export default function Index({ title = '房屋档案' }) { } columns={[ MyColumns.ID(), + { + title: '项目名称', + dataIndex: ['asset_project', 'name'], + search: { + transform: (value) => { + return { project_name: value }; + }, + }, + }, { title: '房屋名称', dataIndex: 'full_name', ellipsis: true, }, - MyColumns.EnumTag({ - title: '房屋状态', - dataIndex: 'status', - valueEnum: AssetHousesStatusEnum, - search: false, - }), + // MyColumns.EnumTag({ + // title: '房屋状态', + // dataIndex: 'status', + // valueEnum: AssetHousesStatusEnum, + // search: false, + // }), MyColumns.EnumTag({ title: '产权性质', @@ -71,7 +79,7 @@ export default function Index({ title = '房屋档案' }) { search: false, }, { - title: '产权人/住户', + title: '客户信息', render(_, record) { const owners = record?.house_occupants?.filter( @@ -111,7 +119,7 @@ export default function Index({ title = '房屋档案' }) { render: (_, item: any, index, action) => ( { navigate(`/archive/${item.id}`); }} @@ -120,17 +128,10 @@ export default function Index({ title = '房屋档案' }) { ) : ( - { - navigate(`/archive/asset_house/${item.id}`); - }} - /> + '' )} ), diff --git a/src/pages/archive/modals/Delivery.tsx b/src/pages/archive/modals/Delivery.tsx index edcaecc..ecf078f 100644 --- a/src/pages/archive/modals/Delivery.tsx +++ b/src/pages/archive/modals/Delivery.tsx @@ -9,7 +9,7 @@ import { Apis } from '@/gen/Apis'; import { HouseOccupantsCardTypeEnum, HouseOccupantsHouseRelationEnum, - HouseRegistersCustomerTypeEnum, + HouseRegistersTypeEnum, } from '@/gen/Enums'; import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; import { Form, message } from 'antd'; @@ -19,12 +19,17 @@ export default function Create(props: MyBetaModalFormProps) { return ( {...MyModalFormProps.props} - title={`添加${props.title}`} + title={`${props.title}`} wrapperCol={{ span: 24 }} width="800px" trigger={ - + } + key={new Date().getTime()} form={form} onOpenChange={(open: any) => { if (open) { @@ -35,13 +40,11 @@ export default function Create(props: MyBetaModalFormProps) { Apis.Archive.HouseRegisters.Store({ ...values, asset_houses_id: props?.item?.id, - type: 'Delivery', + type: HouseRegistersTypeEnum.AddOwner.value, customer_info: values.customer_info?.map((res: any) => { return { ...res, - house_relation: 'Owner', - house_status: 'SelfOccupied', - relation_with_owner: 'Self', + house_relation: HouseOccupantsHouseRelationEnum.Owner.value, }; }), }) @@ -54,38 +57,25 @@ export default function Create(props: MyBetaModalFormProps) { } columns={[ // MyFormItems.EnumRadio({ - // key: 'house_status', - // title: '房屋状态', + // key: 'customer_type', + // title: '产权归属类型', // colProps: { span: 12 }, - // valueEnum: HouseRegistersHouseStatusEnum, - // formItemProps: { ...rulesHelper.text }, + // valueEnum: HouseRegistersCustomerTypeEnum, // }), - // MyFormItems.EnumRadio({ - // key: 'house_status', - // title: '使用计划', - // colProps: { span: 8 }, - // valueEnum: HouseRegistersUsagePlanEnum, - // formItemProps: { ...rulesHelper.text }, - // }), - MyFormItems.EnumSelect({ - key: 'customer_type', - title: '产权归属', - colProps: { span: 6 }, - valueEnum: HouseRegistersCustomerTypeEnum, - }), MyFormItems.UploadImages({ key: 'ownership_info', title: '产权文件', - tooltip: '上限3张', + tooltip: '上限9张', uploadType: 'file', - max: 3, - colProps: { span: 18 }, + max: 9, + colProps: { span: 24 }, formItemProps: { ...rulesHelper.array }, }), { valueType: 'formList', dataIndex: 'customer_info', colProps: { span: 24 }, + initialValue: [''], fieldProps: { copyIconProps: false, creatorButtonProps: { @@ -159,19 +149,21 @@ export default function Create(props: MyBetaModalFormProps) { MyFormItems.UploadImages({ key: 'card_front_image', title: '证件正面', - uploadType: 'file', + // uploadType: 'file', + required: true, max: 1, colProps: { span: 6 }, }), MyFormItems.UploadImages({ key: 'card_back_image', title: '证件反面', - uploadType: 'file', + // uploadType: 'file', + required: true, max: 1, colProps: { span: 6 }, }), { - title: '是否办理入住', + title: '是否入住', dataIndex: 'is_live_in', colProps: { span: 6 }, valueType: 'switch', diff --git a/src/pages/asset/$id.tsx b/src/pages/asset/$id.tsx index 3b5dc9b..939d715 100644 --- a/src/pages/asset/$id.tsx +++ b/src/pages/asset/$id.tsx @@ -2,13 +2,15 @@ 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 ChargeStandard from './components/ChargeStandard'; +import BindCompany from './components/modals/BindCompany'; +import AssetUpdate from './modals/AssetUpdate'; export default function Show({ title }: { title?: string } = {}) { const { id } = useParams<{ id: string }>(); @@ -17,7 +19,7 @@ export default function Show({ title }: { title?: string } = {}) { // 注册当前页面为标签页 const { addTab } = usePageTabs({ tabKey: `asset-show-${id}`, - tabLabel: data?.name || title || '资产详情', + tabLabel: data?.name || title || '项目详情', }); const loadShow = () => { @@ -39,12 +41,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,11 +54,17 @@ export default function Show({ title }: { title?: string } = {}) { children: , }, { - label: '网格管理', + label: '楼栋划分', key: 'grid', closable: false, children: , }, + { + label: '收费标准', + key: 'charge_standard', + closable: false, + children: , + }, { label: '收款账号', key: 'asset_accounts', @@ -71,8 +79,25 @@ export default function Show({ title }: { title?: string } = {}) { // }, ]; return ( - - loadShow()} /> + + + + + + + } + > +
* 您可在以下页签中对应管理:楼栋管理、楼栋划分、收款账号;
+
diff --git a/src/pages/asset/components/AssetAccounts.tsx b/src/pages/asset/components/AssetAccounts.tsx index 4d29893..3ab4e2f 100644 --- a/src/pages/asset/components/AssetAccounts.tsx +++ b/src/pages/asset/components/AssetAccounts.tsx @@ -37,7 +37,7 @@ export default function ReceiptAccounts(props: MyBetaModalFormProps) { // options={false} columns={[ { - title: '配置id', + title: 'ID', dataIndex: 'id', // width: 360, }, 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 0609bf5..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, @@ -8,64 +9,84 @@ import { import { ProCard, ProDescriptions } from '@ant-design/pro-components'; import { Space } from 'antd'; -export default function info(props: MyBetaModalFormProps) { +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 deleted file mode 100644 index 701c760..0000000 --- a/src/pages/asset/components/Basic.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { MyBetaModalFormProps } from '@/common'; -import { ProCard, ProDescriptions } from '@ant-design/pro-components'; -import { Space } from 'antd'; -import AssetUpdate from '../modals/AssetUpdate'; -import BindCompany from './modals/BindCompany'; - -export default function info(props: MyBetaModalFormProps) { - return ( - - - - - -
{props?.item?.name}
- -
-
- - -
{props?.item?.company?.name}
- -
-
-
-
-
- ); -} diff --git a/src/pages/asset/components/ChargeStandard.tsx b/src/pages/asset/components/ChargeStandard.tsx new file mode 100644 index 0000000..2ec8416 --- /dev/null +++ b/src/pages/asset/components/ChargeStandard.tsx @@ -0,0 +1,131 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyColumns, + MyProTableProps, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + HouseBillsTypeEnum, + HouseChargeStandardsCalculationMethodEnum, + HouseChargeStandardsCalculationModeEnum, + HouseChargeStandardsCalculationPeriodEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import ChargeStandardCreate from './modals/ChargeStandardCreate'; +import ChargeStandardHasHouse from './modals/ChargeStandardHasHouse'; +import ChargeStandardUpdate from './modals/ChargeStandardUpdate'; + +export default function ReceiptAccounts(props: MyBetaModalFormProps) { + return ( + <> + + MyProTableProps.request( + { + ...params, + asset_projects_id: props?.item?.id, + }, + sort, + Apis.HouseCharage.HouseChargeStandards.List, + ) + } + toolBarRender={(action) => [ + , + ]} + // options={false} + columns={[ + { + title: 'ID', + dataIndex: 'id', + }, + { + title: '收费标准名称', + dataIndex: 'name', + search: false, + }, + MyColumns.EnumTag({ + title: '收费项目', + dataIndex: 'charge_type', + valueEnum: HouseBillsTypeEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '计量单位', + dataIndex: 'calculation_method', + valueEnum: HouseChargeStandardsCalculationMethodEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '计费模式', + dataIndex: 'calculation_mode', + valueEnum: HouseChargeStandardsCalculationModeEnum, + search: false, + }), + { + title: '单价', + dataIndex: 'price', + search: false, + }, + MyColumns.EnumTag({ + title: '账单计费周期', + dataIndex: 'calculation_period', + valueEnum: HouseChargeStandardsCalculationPeriodEnum, + search: false, + }), + { + title: '账单自动生成日期', + dataIndex: 'auto_date', + search: false, + }, + { + title: '是否分摊', + dataIndex: 'is_apportionment', + search: false, + render(_, record) { + return `${record?.is_apportionment ? '是' : '否'} `; + }, + }, + + // MyColumns.UpdatedAt(), + // MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + + Apis.HouseCharage.HouseChargeStandards.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + + ); +} 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/ChargeStandardCreate.tsx b/src/pages/asset/components/modals/ChargeStandardCreate.tsx new file mode 100644 index 0000000..a81d43e --- /dev/null +++ b/src/pages/asset/components/modals/ChargeStandardCreate.tsx @@ -0,0 +1,451 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + HouseBillsTypeEnum, + HouseChargeStandardsApportionmentMethodEnum, + HouseChargeStandardsCalculationMethodEnum, + HouseChargeStandardsCalculationModeEnum, + HouseChargeStandardsCalculationPeriodEnum, + HouseChargeStandardsPriceAlgorithmEnum, + HouseChargeStandardsTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +import { useRef } from 'react'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const actionRef = useRef(); + + return ( + + {...MyModalFormProps.props} + title={`创建收费标准`} + wrapperCol={{ span: 24 }} + width="600px" + 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.HouseCharage.HouseChargeStandards.Store({ + ...values, + asset_projects_id: props?.item?.id, + type: + values.charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + values.charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? HouseChargeStandardsTypeEnum.House.value + : HouseChargeStandardsTypeEnum.Meter.value, + is_apportionment: + values.charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + values.charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? 1 + : 0, + // 按套 + calculation_mode: + values?.calculation_method === + HouseChargeStandardsCalculationMethodEnum.PerUnit.value + ? HouseChargeStandardsCalculationModeEnum.FixedAmount.value + : values?.calculation_mode, + // 按固定金额 + price_algorithm: + values?.calculation_mode === + HouseChargeStandardsCalculationModeEnum.FixedAmount.value || + values?.calculation_method === + HouseChargeStandardsCalculationMethodEnum.PerUnit.value + ? HouseChargeStandardsPriceAlgorithmEnum.Fixed.value + : values?.price_algorithm, + tiered_rates: values.tiered_rates?.map((res: any) => { + return { + ...res, + }; + }), + // 避免计费模式切换导致的价格异常 + price: + values?.price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Fixed.value + ? values.price + : 0, + }) + .then(() => { + props.reload?.(); + message.success('收费标准创建成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + { + key: 'name', + title: '收费标准名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'charge_type', + title: '收费项目', + colProps: { span: 24 }, + valueEnum: HouseBillsTypeEnum, + required: true, + }), + { + name: ['charge_type'], + valueType: 'dependency', + columns: ({ charge_type }: any) => { + return charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? [ + MyFormItems.EnumRadio({ + key: 'calculation_method', + title: '分摊方式', + colProps: { span: 18 }, + valueEnum: HouseChargeStandardsApportionmentMethodEnum, + required: true, + }), + ] + : []; + }, + }, + + // Selects?.AssetProjects({ + // key: 'asset_projects_id', + // title: '项目', + // colProps: { span: 12 }, + // formItemProps: { ...rulesHelper.text }, + // }), + { + name: ['charge_type'], + valueType: 'dependency', + columns: ({ charge_type }: any) => { + return charge_type === HouseBillsTypeEnum.PropertyFee.value || + charge_type === HouseBillsTypeEnum.MaintenanceFund.value + ? [ + MyFormItems.EnumRadio({ + key: 'calculation_method', + title: '计量单位', + colProps: { span: 16 }, + valueEnum: () => { + let obj: any = JSON.parse( + JSON.stringify( + HouseChargeStandardsCalculationMethodEnum, + ), + ); + delete obj.ElectricityUsage; + delete obj.WaterUsage; + return obj; + }, + required: true, + }), + ] + : charge_type === HouseBillsTypeEnum.WaterFee.value || + charge_type === HouseBillsTypeEnum.ElectricityFee.value || + charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? [ + MyFormItems.EnumRadio({ + key: 'calculation_method', + title: '计量单位', + colProps: { span: 16 }, + valueEnum: () => { + let obj: any = JSON.parse( + JSON.stringify( + HouseChargeStandardsCalculationMethodEnum, + ), + ); + delete obj.ChargeableArea; + delete obj.BuiltArea; + delete obj.InsideArea; + delete obj.PerUnit; + return obj; + }, + required: true, + }), + ] + : []; + }, + }, + { + name: ['calculation_method'], + valueType: 'dependency', + columns: ({ calculation_method }: any) => { + return calculation_method === + HouseChargeStandardsCalculationMethodEnum.PerUnit.value + ? [ + { + key: 'price', + title: '固定单价', + colProps: { span: 10 }, + fieldProps: { + addonAfter: '元', + }, + formItemProps: { ...rulesHelper.number }, + }, + ] + : !calculation_method && + calculation_method !== + HouseChargeStandardsCalculationMethodEnum.PerUnit.value + ? [] + : [ + MyFormItems.EnumRadio({ + key: 'calculation_mode', + title: '计费模式', + colProps: { span: 12 }, + valueEnum: HouseChargeStandardsCalculationModeEnum, + required: true, + }), + ]; + }, + }, + + { + name: ['calculation_mode'], + valueType: 'dependency', + columns: ({ calculation_mode }: any) => { + return calculation_mode === + HouseChargeStandardsCalculationModeEnum.FixedAmount.value + ? [ + { + key: 'price', + title: '固定单价', + colProps: { span: 10 }, + fieldProps: { + addonAfter: '元', + }, + formItemProps: { ...rulesHelper.number }, + }, + ] + : calculation_mode === + HouseChargeStandardsCalculationModeEnum.QuantityPrice.value + ? [ + MyFormItems.EnumRadio({ + key: 'price_algorithm', + title: '计费算法', + colProps: { span: 14 }, + valueEnum: HouseChargeStandardsPriceAlgorithmEnum, + required: true, + // fieldProps: { + // onChange: () => { + // // 切换计费算法时清空阶梯配置 + // form.setFieldValue('scheme', undefined); + // }, + // }, + }), + { + name: ['price_algorithm'], + valueType: 'dependency', + columns: ({ price_algorithm }: any) => { + return price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Fixed.value + ? [ + { + key: 'price', + title: '固定单价', + colProps: { span: 10 }, + fieldProps: { + addonAfter: '元', + }, + formItemProps: { ...rulesHelper.number }, + }, + ] + : price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Tiered.value + ? [ + { + valueType: 'formList', + dataIndex: 'tiered_rates', + title: '阶梯标准', + formItemProps: { ...rulesHelper.array }, + initialValue: [ + { + start: 0, + end: null, + price: null, + }, + ], + fieldProps: { + actionRef: actionRef, + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + key: 'min_quantity', + colProps: { span: 10 }, + title: '起始值', + valueType: 'number', + fieldProps: { + min: 0, + addonBefore: ( + _: any, + { + field, + }: { field: { index: number[] } }, + ) => `第${field.index[1] + 1}阶梯`, + }, + width: '100%', + formItemProps: { ...rulesHelper.number }, + }, + { + key: 'max_quantity', + colProps: { span: 6 }, + title: '结束值', + valueType: 'number', + width: '100%', + formItemProps: { ...rulesHelper.number }, + fieldProps: { maxLength: 12 }, + }, + { + key: 'price', + colProps: { span: 8 }, + title: '阶梯单价', + valueType: 'number', + fieldProps: { + addonAfter: '元', + min: 0, + }, + formItemProps: { ...rulesHelper.number }, + }, + ], + }, + ], + }, + ] + : price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Peak.value + ? [ + { + valueType: 'formList', + dataIndex: 'tiered_rates', + title: '阶梯标准', + formItemProps: { ...rulesHelper.array }, + initialValue: [ + { + start: 0, + end: null, + price: null, + }, + ], + fieldProps: { + actionRef: actionRef, + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + key: 'min_quantity', + colProps: { span: 10 }, + title: '起始值', + valueType: 'number', + fieldProps: { + min: 0, + addonBefore: ( + _: any, + { + field, + }: { field: { name: number[] } }, + ) => `第${field.name[1] + 1}阶梯`, + }, + width: '100%', + formItemProps: { ...rulesHelper.number }, + }, + { + key: 'max_quantity', + colProps: { span: 6 }, + title: '结束值', + valueType: 'number', + width: '100%', + formItemProps: { ...rulesHelper.number }, + fieldProps: { maxLength: 12 }, + }, + { + key: 'price', + colProps: { span: 8 }, + title: '阶梯单价', + valueType: 'number', + fieldProps: { + addonAfter: '元', + min: 0, + }, + formItemProps: { ...rulesHelper.number }, + }, + ], + }, + ], + }, + ] + : []; + }, + }, + ] + : []; + }, + }, + { + name: ['price', 'price_algorithm'], + valueType: 'dependency', + columns: ({ price, price_algorithm }: any) => { + return price || + price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Tiered.value || + price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Peak.value + ? [ + { + valueType: 'group', + columns: [ + MyFormItems.EnumRadio({ + key: 'calculation_period', + title: '账单计费周期', + colProps: { span: 14 }, + valueEnum: HouseChargeStandardsCalculationPeriodEnum, + required: true, + }), + { + key: 'auto_date', + title: '账单自动生成日期', + colProps: { span: 10 }, + valueType: 'date', + width: '100%', + }, + { + key: 'remark', + title: '备注', + colProps: { span: 24 }, + valueType: 'textarea', + fieldProps: { + rows: 4, + maxLength: 500, + showCount: true, + }, + }, + ], + }, + ] + : []; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/asset/components/modals/ChargeStandardHasHouse.tsx b/src/pages/asset/components/modals/ChargeStandardHasHouse.tsx new file mode 100644 index 0000000..fbd06f7 --- /dev/null +++ b/src/pages/asset/components/modals/ChargeStandardHasHouse.tsx @@ -0,0 +1,730 @@ +import { MyBetaModalFormProps, MyButtons, renderTextHelper } from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { Apis } from '@/gen/Apis'; +import { + HouseBillsTypeEnum, + HouseChargeStandardsCalculationModeEnum, + HouseChargeStandardsCalculationPeriodEnum, +} from '@/gen/Enums'; +import { ProCard } from '@ant-design/pro-components'; +import { + Alert, + Button, + Checkbox, + message, + Space, + Tree, + Typography, +} from 'antd'; +import { CheckboxChangeEvent } from 'antd/es/checkbox'; +import type { DataNode } from 'antd/es/tree'; +import { useEffect, useRef, useState } from 'react'; + +const { Title } = Typography; + +interface TreeNodeType extends DataNode { + id: number; + key: string; + title: string; + isLeaf?: boolean; + children?: TreeNodeType[]; + asset_buildings_id?: number; + asset_units_id?: number; +} + +// 扩展 MyBetaModalFormProps 接口,添加 onCancel 属性 +interface ChargeStandardHasHouseProps extends MyBetaModalFormProps { + onCancel?: () => void; +} + +export default function ChargeStandardHasHouse( + props: ChargeStandardHasHouseProps, +) { + const [treeData, setTreeData] = useState([]); + const [expandedKeys, setExpandedKeys] = useState([]); + const [checkedKeys, setCheckedKeys] = useState([]); + const [selectedKeys, setSelectedKeys] = useState([]); + const [autoExpandParent, setAutoExpandParent] = useState(true); + const [loading, setLoading] = useState(false); + const [selectAll, setSelectAll] = useState(false); + const [selectedHouses, setSelectedHouses] = useState< + { id: number; name: string }[] + >([]); + const modalRef: any = useRef(null); + + // 加载楼栋数据 + const loadBuildings = async () => { + setLoading(true); + + try { + const res = await Apis.Asset.AssetBuildings.List({ + asset_projects_id: props?.item?.asset_projects_id, + }); + if (res?.data) { + const buildings = res.data.map((building: any) => ({ + id: building.id, + key: `building-${building.id}`, + title: building.name, + children: [], + isLeaf: false, + })); + setTreeData(buildings); + } + } catch (error) { + console.error('加载楼栋失败:', error); + } finally { + setLoading(false); + } + }; + + // 加载单元数据 + const loadUnits = async (buildingId: number, buildingKey: string) => { + setLoading(true); + try { + const res = await Apis.Asset.AssetUnits.List({ + asset_projects_id: props?.item?.asset_projects_id, + asset_buildings_id: buildingId, + }); + + if (res?.data) { + const units = res.data.map((unit: any) => ({ + id: unit.id, + key: `unit-${unit.id}`, + title: unit.name, + children: [], + isLeaf: false, + asset_buildings_id: buildingId, + })); + + // 更新树形数据 + const newTreeData = [...treeData]; + const buildingNode = newTreeData.find( + (node) => node.key === buildingKey, + ); + if (buildingNode) { + buildingNode.children = units; + } + + setTreeData(newTreeData); + } + } catch (error) { + console.error('加载单元失败:', error); + } finally { + setLoading(false); + } + }; + + // 加载房屋数据 + const loadHouses = async ( + buildingId: number, + unitId: number, + unitKey: string, + ) => { + setLoading(true); + try { + const res = await Apis.Asset.AssetHouses.List({ + asset_projects_id: props?.item?.asset_projects_id, + asset_buildings_id: buildingId, + asset_units_id: unitId, + }); + + if (res?.data) { + const houses = res.data.map((house: any) => ({ + id: house.id, + key: `house-${house.id}`, + title: `${house.name} (${house.floor}层)`, + isLeaf: true, + asset_buildings_id: buildingId, + asset_units_id: unitId, + })); + + // 更新树形数据 + const newTreeData = [...treeData]; + const buildingNode = newTreeData.find( + (node) => + node.asset_buildings_id === undefined && node.id === buildingId, + ); + + if (buildingNode && buildingNode.children) { + const unitNode = buildingNode.children.find( + (node) => node.key === unitKey, + ); + if (unitNode) { + unitNode.children = houses; + } + } + + setTreeData(newTreeData); + } + } catch (error) { + console.error('加载房屋失败:', error); + } finally { + setLoading(false); + } + }; + + // 初始化加载数据 + useEffect(() => { + if (props?.item?.asset_projects_id) { + loadBuildings(); + } else { + console.warn('缺少 asset_projects_id 参数'); + } + }, [props?.item?.id]); + + // 处理节点展开 + const onExpand = (expandedKeysValue: React.Key[]) => { + setExpandedKeys(expandedKeysValue); + setAutoExpandParent(false); + }; + + // 处理节点选中 + const onCheck = async ( + checkedKeysValue: + | React.Key[] + | { checked: React.Key[]; halfChecked: React.Key[] }, + ) => { + // 处理不同格式的返回值 + const keys = Array.isArray(checkedKeysValue) + ? checkedKeysValue + : checkedKeysValue.checked; + + // 获取之前的选中状态,用于比较变化 + const prevKeys = new Set(checkedKeys); + const newKeys = new Set(keys); + + // 找出新选中的节点 + const newlyCheckedKeys = [...newKeys].filter((key) => !prevKeys.has(key)); + + // 找出新取消选中的节点 + const uncheckedKeys = [...prevKeys].filter((key) => !newKeys.has(key)); + + // 处理新选中的节点 + for (const key of newlyCheckedKeys) { + const keyStr = key.toString(); + + // 如果选中的是楼栋 + if (keyStr.startsWith('building-')) { + const buildingNode = treeData.find((node) => node.key === key); + if (buildingNode) { + // 调用接口获取该楼栋下所有房屋 + await loadBuildingHouses(buildingNode.id); + } + } + + // 如果选中的是单元 + else if (keyStr.startsWith('unit-')) { + // 查找该单元所属的楼栋和单元ID + for (const building of treeData) { + const unitNode = building.children?.find((unit) => unit.key === key); + if (unitNode) { + // 调用接口获取该单元下所有房屋 + await loadUnitHouses(building.id, unitNode.id); + break; + } + } + } + } + + // 如果有节点被取消选中,同步取消其所有子节点 + if (uncheckedKeys.length > 0) { + const keysToRemove = new Set(); + const findChildKeys = (nodes: TreeNodeType[], parentKey: React.Key) => { + nodes.forEach((node) => { + if (node.key === parentKey) { + // 将当前节点及其所有子节点的key加入待移除集合 + const collectKeys = (n: TreeNodeType) => { + keysToRemove.add(n.key); + if (n.children) { + n.children.forEach(collectKeys); + } + }; + collectKeys(node); + } else if (node.children) { + findChildKeys(node.children, parentKey); + } + }); + }; + + uncheckedKeys.forEach((key) => { + findChildKeys(treeData, key); + }); + + // 从选中keys中移除所有需要取消的节点 + const finalKeys = keys.filter((key) => !keysToRemove.has(key)); + setCheckedKeys(finalKeys); + + // 更新selectedHouses,移除被取消选中的房屋 + const houseKeysToRemove = new Set(); + keysToRemove.forEach((key) => { + if (key.toString().startsWith('house-')) { + houseKeysToRemove.add(key.toString().replace('house-', '')); + } + }); + + const updatedHouses = selectedHouses.filter( + (house) => !houseKeysToRemove.has(house.id.toString()), + ); + + setSelectedHouses(updatedHouses); + } else { + setCheckedKeys(keys); + } + + // 收集所有选中的房屋 + const selectedHousesList: { + id: number; + name: string; + buildingName?: string; + unitName?: string; + }[] = [...selectedHouses]; + + // 遍历树形数据,收集选中节点下的所有房屋 + const collectHouses = (nodes: TreeNodeType[], checkedKeys: React.Key[]) => { + nodes.forEach((node) => { + if (checkedKeys.includes(node.key)) { + if (node.isLeaf) { + // 如果是房屋节点,检查是否已经存在 + const houseId = node.id; + const exists = selectedHousesList.some( + (house) => house.id === houseId, + ); + + if (!exists) { + // 查找楼栋和单元信息 + let buildingName = ''; + let unitName = ''; + + // 查找楼栋和单元 + for (const building of treeData) { + if (building.id === node.asset_buildings_id) { + buildingName = building.title as string; + + // 查找单元 + const unit = building.children?.find( + (u) => u.id === node.asset_units_id, + ); + if (unit) { + unitName = unit.title as string; + } + break; + } + } + + // 添加到选中列表 + selectedHousesList.push({ + id: houseId, + name: `${buildingName} ${unitName} ${node.title}(${houseId})`, + buildingName, + unitName, + }); + } + } else { + // 如果是楼栋或单元节点,递归收集其下的所有房屋 + if (node.children) { + collectHouses(node.children, checkedKeys); + } + } + } + }); + }; + + collectHouses(treeData, keys); + + setSelectedHouses(selectedHousesList); + setSelectAll( + selectedHousesList.length > 0 && + selectedHousesList.length === + treeData.reduce( + (total, building) => + total + + (building.children?.reduce( + (unitTotal, unit) => unitTotal + (unit.children?.length || 0), + 0, + ) || 0), + 0, + ), + ); + }; + + // 处理节点选择 + const onSelect = (selectedKeysValue: React.Key[]) => { + setSelectedKeys(selectedKeysValue); + }; + + // 处理动态加载数据 + const onLoadData = async (node: TreeNodeType) => { + if (node.isLeaf) { + return Promise.resolve(); + } + + // 加载楼栋下的单元 + if (node.key.toString().startsWith('building-')) { + console.log('node.key', node.key); + // 从key中提取buildingId,格式为'building-{id}' + const buildingId = parseInt( + node.key.toString().replace('building-', ''), + 10, + ); + await loadUnits(buildingId, node.key as string); + + // 如果楼栋被选中,加载并选中其下所有单元和房屋 + if (checkedKeys.includes(node.key)) { + // 直接调用loadBuildingHouses加载该楼栋下所有房屋 + await loadBuildingHouses(buildingId); + } + return Promise.resolve(); + } + + // 加载单元下的房屋 + if (node.key.toString().startsWith('unit-')) { + // 从key中提取unitId,格式为'unit-{id}' + const unitId = parseInt(node.key.toString().replace('unit-', ''), 10); + const buildingId = node.asset_buildings_id as number; + await loadHouses(buildingId, unitId, node.key as string); + + // 如果单元被选中,选中其下所有房屋 + if (checkedKeys.includes(node.key)) { + // 直接调用loadUnitHouses加载该单元下所有房屋 + await loadUnitHouses(buildingId, unitId); + } + return Promise.resolve(); + } + + return Promise.resolve(); + }; + + // 加载所有房屋数据 + const loadAllHouses = async () => { + setLoading(true); + try { + const res = await Apis.Asset.AssetHouses.List({ + asset_projects_id: props?.item?.asset_projects_id, + }); + + if (res?.data) { + const allHouseKeys: React.Key[] = []; + const allHouses: { + id: number; + name: string; + buildingName: string; + unitName: string; + }[] = []; + + // 创建映射以快速查找楼栋和单元名称 + const buildingMap = new Map(); + const unitMap = new Map(); + + // 填充楼栋映射 + treeData.forEach((building) => { + buildingMap.set(building.id, building.title); + building.children?.forEach((unit) => { + unitMap.set(unit.id, unit.title); + }); + }); + + res.data.forEach((house: any) => { + const houseKey = `house-${house.id}`; + allHouseKeys.push(houseKey); + + const buildingName = buildingMap.get(house.asset_buildings_id) || ''; + const unitName = unitMap.get(house.asset_units_id) || ''; + + allHouses.push({ + id: house.id, + name: `${buildingName} ${unitName} ${house.name}(${house.id})`, + buildingName: buildingName as string, + unitName: unitName as string, + }); + }); + + setCheckedKeys(allHouseKeys); + setSelectedHouses(allHouses); + } + } catch (error) { + console.error('加载所有房屋失败:', error); + message.error('加载所有房屋失败'); + } finally { + setLoading(false); + } + }; + + // 加载楼栋下所有房屋 + const loadBuildingHouses = async (buildingId: number) => { + setLoading(true); + try { + const res = await Apis.Asset.AssetHouses.List({ + asset_projects_id: props?.item?.asset_projects_id, + asset_buildings_id: buildingId, + }); + + if (res?.data) { + const buildingHouseKeys: React.Key[] = []; + const buildingHouses: { + id: number; + name: string; + buildingName: string; + unitName: string; + }[] = []; + + // 获取楼栋名称 + const building = treeData.find((b) => b.id === buildingId); + const buildingName = building?.title || ''; + + // 创建单元映射 + const unitMap = new Map(); + building?.children?.forEach((unit) => { + unitMap.set(unit.id, unit.title); + }); + + res.data.forEach((house: any) => { + const houseKey = `house-${house.id}`; + buildingHouseKeys.push(houseKey); + + const unitName = unitMap.get(house.asset_units_id) || ''; + + buildingHouses.push({ + id: house.id, + name: `${buildingName} ${unitName} ${house.name}(${house.id})`, + buildingName: buildingName as string, + unitName: unitName as string, + }); + }); + + // 合并当前选中的keys和新的keys + const newCheckedKeys = Array.from( + new Set([...checkedKeys, ...buildingHouseKeys]), + ); + setCheckedKeys(newCheckedKeys); + + // 合并当前选中的房屋和新的房屋 + const existingIds = new Set(selectedHouses.map((h) => h.id)); + const newHouses = buildingHouses.filter((h) => !existingIds.has(h.id)); + setSelectedHouses([...selectedHouses, ...newHouses]); + } + } catch (error) { + console.error('加载楼栋房屋失败:', error); + message.error('加载楼栋房屋失败'); + } finally { + setLoading(false); + } + }; + + // 加载单元下所有房屋 + const loadUnitHouses = async (buildingId: number, unitId: number) => { + setLoading(true); + try { + const res = await Apis.Asset.AssetHouses.List({ + asset_projects_id: props?.item?.asset_projects_id, + asset_buildings_id: buildingId, + asset_units_id: unitId, + }); + + if (res?.data) { + const unitHouseKeys: React.Key[] = []; + const unitHouses: { + id: number; + name: string; + buildingName: string; + unitName: string; + }[] = []; + + // 获取楼栋和单元名称 + const building = treeData.find((b) => b.id === buildingId); + const buildingName = building?.title || ''; + + const unit = building?.children?.find((u) => u.id === unitId); + const unitName = unit?.title || ''; + + res.data.forEach((house: any) => { + const houseKey = `house-${house.id}`; + unitHouseKeys.push(houseKey); + + unitHouses.push({ + id: house.id, + name: `${buildingName} ${unitName} ${house.name}(${house.id})`, + buildingName: buildingName as string, + unitName: unitName as string, + }); + }); + + // 合并当前选中的keys和新的keys + const newCheckedKeys = Array.from( + new Set([...checkedKeys, ...unitHouseKeys]), + ); + setCheckedKeys(newCheckedKeys); + + // 合并当前选中的房屋和新的房屋 + const existingIds = new Set(selectedHouses.map((h) => h.id)); + const newHouses = unitHouses.filter((h) => !existingIds.has(h.id)); + setSelectedHouses([...selectedHouses, ...newHouses]); + } + } catch (error) { + console.error('加载单元房屋失败:', error); + message.error('加载单元房屋失败'); + } finally { + setLoading(false); + } + }; + + // 处理全选 + const handleSelectAll = async (e: CheckboxChangeEvent) => { + setSelectAll(e.target.checked); + + if (e.target.checked) { + // 调用接口获取所有房屋 + await loadAllHouses(); + } else { + // 取消全选 + setCheckedKeys([]); + setSelectedHouses([]); + } + }; + + // 提交选中的房屋 + const handleSubmit = async () => { + if (selectedHouses.length === 0) { + message.warning('请至少选择一个房屋'); + return; + } + + try { + setLoading(true); + // 将 number[] 转换为 string[] + const houses_ids = selectedHouses.map((house) => house.id.toString()); + + await Apis.HouseCharage.HouseChargeHasHouses.Store({ + house_charge_standards_id: props?.item?.id, + houses_ids, + }); + + message.success('绑定房屋成功'); + props?.reload?.(); + props?.onCancel?.(); + } catch (error) { + console.error('绑定房屋失败:', error); + message.error('绑定房屋失败'); + } finally { + setLoading(false); + } + }; + + return ( + + } + node={ + + + <div> + <div>收费标准名称:{props?.item?.name || '标准名称'}</div> + <Space> + <renderTextHelper.Tag + Enums={HouseBillsTypeEnum} + value={props?.item?.charge_type} + key="type" + /> + <renderTextHelper.Tag + Enums={HouseChargeStandardsCalculationModeEnum} + value={props?.item?.calculation_mode} + key="type" + /> + <renderTextHelper.Tag + Enums={HouseChargeStandardsCalculationPeriodEnum} + value={props?.item?.calculation_period} + key="type" + /> + </Space> + </div> + + + + } + > +
+
+
+ + 全选 + +
+ + {loading &&
加载中...
} + + +
+ +
+
+ 已选房屋 ({selectedHouses.length}) +
+ +
+ {selectedHouses.length > 0 ? ( +
    + {selectedHouses.map((house) => ( +
  • {house.name}
  • + ))} +
+ ) : ( +
+ 暂无选中房屋{' '} +
+ )} +
+
+
+ +
+ + + + +
+
+ } + /> + ); +} diff --git a/src/pages/asset/components/modals/ChargeStandardUpdate.tsx b/src/pages/asset/components/modals/ChargeStandardUpdate.tsx new file mode 100644 index 0000000..6f9d9ae --- /dev/null +++ b/src/pages/asset/components/modals/ChargeStandardUpdate.tsx @@ -0,0 +1,446 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + HouseBillsTypeEnum, + HouseChargeStandardsApportionmentMethodEnum, + HouseChargeStandardsCalculationMethodEnum, + HouseChargeStandardsCalculationModeEnum, + HouseChargeStandardsCalculationPeriodEnum, + HouseChargeStandardsPriceAlgorithmEnum, + HouseChargeStandardsTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +import { useRef } from 'react'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const actionRef = useRef(); + + return ( + + {...MyModalFormProps.props} + title={props.title} + wrapperCol={{ span: 24 }} + width="600px" + trigger={ + + } + form={form} + key={new Date().getTime()} + onOpenChange={(open: any) => { + if (open) { + form.setFieldsValue(props?.item); // 编辑赋值 + } + }} + onFinish={async (values) => + Apis.HouseCharage.HouseChargeStandards.Update({ + ...values, + asset_projects_id: props?.item?.asset_projects_id, + + type: + values.charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + values.charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? HouseChargeStandardsTypeEnum.House.value + : HouseChargeStandardsTypeEnum.Meter.value, + is_apportionment: + values.charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + values.charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? 1 + : 0, + // 按套 + calculation_mode: + values?.calculation_method === + HouseChargeStandardsCalculationMethodEnum.PerUnit.value + ? HouseChargeStandardsCalculationModeEnum.FixedAmount.value + : values?.calculation_mode, + // 按固定金额 + price_algorithm: + values?.calculation_mode === + HouseChargeStandardsCalculationModeEnum.FixedAmount.value || + values?.calculation_method === + HouseChargeStandardsCalculationMethodEnum.PerUnit.value + ? HouseChargeStandardsPriceAlgorithmEnum.Fixed.value + : values?.price_algorithm, + id: props?.item?.id, + tiered_rates: values.tiered_rates?.map((res: any) => { + return { + ...res, + }; + }), + // 避免计费模式切换导致的价格异常 + price: + values?.price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Fixed.value + ? values.price + : 0, + }) + .then(() => { + props.reload?.(); + message.success('收费标准编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'name', + title: '收费标准名称', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'charge_type', + title: '收费项目', + colProps: { span: 24 }, + valueEnum: HouseBillsTypeEnum, + required: true, + }), + { + name: ['charge_type'], + valueType: 'dependency', + columns: ({ charge_type }: any) => { + return charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? [ + MyFormItems.EnumRadio({ + key: 'calculation_method', + title: '分摊方式', + colProps: { span: 18 }, + valueEnum: HouseChargeStandardsApportionmentMethodEnum, + required: true, + }), + ] + : []; + }, + }, + + { + name: ['charge_type'], + valueType: 'dependency', + columns: ({ charge_type }: any) => { + return charge_type === HouseBillsTypeEnum.PropertyFee.value || + charge_type === HouseBillsTypeEnum.MaintenanceFund.value + ? [ + MyFormItems.EnumRadio({ + key: 'calculation_method', + title: '计量单位', + colProps: { span: 16 }, + valueEnum: () => { + let obj: any = JSON.parse( + JSON.stringify( + HouseChargeStandardsCalculationMethodEnum, + ), + ); + delete obj.ElectricityUsage; + delete obj.WaterUsage; + return obj; + }, + required: true, + }), + ] + : charge_type === HouseBillsTypeEnum.WaterFee.value || + charge_type === HouseBillsTypeEnum.ElectricityFee.value || + charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? [ + MyFormItems.EnumRadio({ + key: 'calculation_method', + title: '计量单位', + colProps: { span: 16 }, + valueEnum: () => { + let obj: any = JSON.parse( + JSON.stringify( + HouseChargeStandardsCalculationMethodEnum, + ), + ); + delete obj.ChargeableArea; + delete obj.BuiltArea; + delete obj.InsideArea; + delete obj.PerUnit; + return obj; + }, + required: true, + }), + ] + : []; + }, + }, + { + name: ['calculation_method'], + valueType: 'dependency', + columns: ({ calculation_method }: any) => { + return calculation_method === + HouseChargeStandardsCalculationMethodEnum.PerUnit.value + ? [ + { + key: 'price', + title: '固定单价', + colProps: { span: 10 }, + fieldProps: { + addonAfter: '元', + }, + formItemProps: { ...rulesHelper.number }, + }, + ] + : !calculation_method && + calculation_method !== + HouseChargeStandardsCalculationMethodEnum.PerUnit.value + ? [] + : [ + MyFormItems.EnumRadio({ + key: 'calculation_mode', + title: '计费模式', + colProps: { span: 12 }, + valueEnum: HouseChargeStandardsCalculationModeEnum, + required: true, + }), + ]; + }, + }, + + { + name: ['calculation_mode'], + valueType: 'dependency', + columns: ({ calculation_mode }: any) => { + return calculation_mode === + HouseChargeStandardsCalculationModeEnum.FixedAmount.value + ? [ + { + key: 'price', + title: '固定单价', + colProps: { span: 10 }, + fieldProps: { + addonAfter: '元', + }, + formItemProps: { ...rulesHelper.number }, + }, + ] + : calculation_mode === + HouseChargeStandardsCalculationModeEnum.QuantityPrice.value + ? [ + MyFormItems.EnumRadio({ + key: 'price_algorithm', + title: '计费算法', + colProps: { span: 14 }, + valueEnum: HouseChargeStandardsPriceAlgorithmEnum, + required: true, + // fieldProps: { + // onChange: () => { + // // 切换计费算法时清空阶梯配置 + // form.setFieldValue('scheme', undefined); + // }, + // }, + }), + { + name: ['price_algorithm'], + valueType: 'dependency', + columns: ({ price_algorithm }: any) => { + return price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Fixed.value + ? [ + { + key: 'price', + title: '固定单价', + colProps: { span: 10 }, + fieldProps: { + addonAfter: '元', + }, + formItemProps: { ...rulesHelper.number }, + }, + ] + : price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Tiered.value + ? [ + { + valueType: 'formList', + dataIndex: 'tiered_rates', + title: '阶梯标准', + formItemProps: { ...rulesHelper.array }, + // initialValue: [ + // { + // start: 0, + // end: null, + // price: null, + // }, + // ], + fieldProps: { + actionRef: actionRef, + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + key: 'min_quantity', + colProps: { span: 10 }, + title: '起始值', + valueType: 'number', + fieldProps: { + min: 0, + addonBefore: ( + _: any, + { + field, + }: { field: { index: number[] } }, + ) => `第${field.index[1] + 1}阶梯`, + }, + width: '100%', + formItemProps: { ...rulesHelper.number }, + }, + { + key: 'max_quantity', + colProps: { span: 6 }, + title: '结束值', + valueType: 'number', + width: '100%', + formItemProps: { ...rulesHelper.number }, + fieldProps: { maxLength: 12 }, + }, + { + key: 'price', + colProps: { span: 8 }, + title: '阶梯单价', + valueType: 'number', + fieldProps: { + addonAfter: '元', + min: 0, + }, + formItemProps: { ...rulesHelper.number }, + }, + ], + }, + ], + }, + ] + : price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Peak.value + ? [ + { + valueType: 'formList', + dataIndex: 'tiered_rates', + title: '阶梯标准', + formItemProps: { ...rulesHelper.array }, + // initialValue: [ + // { + // start: 0, + // end: null, + // price: null, + // }, + // ], + fieldProps: { + actionRef: actionRef, + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + key: 'min_quantity', + colProps: { span: 10 }, + title: '起始值', + valueType: 'number', + fieldProps: { + min: 0, + addonBefore: ( + _: any, + { + field, + }: { field: { name: number[] } }, + ) => `第${field.name[1] + 1}阶梯`, + }, + width: '100%', + formItemProps: { ...rulesHelper.number }, + }, + { + key: 'max_quantity', + colProps: { span: 6 }, + title: '结束值', + valueType: 'number', + width: '100%', + formItemProps: { ...rulesHelper.number }, + fieldProps: { maxLength: 12 }, + }, + { + key: 'price', + colProps: { span: 8 }, + title: '阶梯单价', + valueType: 'number', + fieldProps: { + addonAfter: '元', + min: 0, + }, + formItemProps: { ...rulesHelper.number }, + }, + ], + }, + ], + }, + ] + : []; + }, + }, + ] + : []; + }, + }, + { + name: ['price', 'price_algorithm'], + valueType: 'dependency', + columns: ({ price, price_algorithm }: any) => { + return price || + price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Tiered.value || + price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Peak.value + ? [ + { + valueType: 'group', + columns: [ + MyFormItems.EnumRadio({ + key: 'calculation_period', + title: '账单计费周期', + colProps: { span: 14 }, + valueEnum: HouseChargeStandardsCalculationPeriodEnum, + required: true, + }), + { + key: 'auto_date', + title: '账单自动生成日期', + colProps: { span: 10 }, + valueType: 'date', + width: '100%', + }, + { + key: 'remark', + title: '备注', + colProps: { span: 24 }, + valueType: 'textarea', + fieldProps: { + rows: 4, + maxLength: 500, + showCount: true, + }, + }, + ], + }, + ] + : []; + }, + }, + ]} + /> + ); +} 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 6e52104..31443e7 100644 --- a/src/pages/asset/components/modals/HousesCreate.tsx +++ b/src/pages/asset/components/modals/HousesCreate.tsx @@ -9,7 +9,6 @@ import { Apis } from '@/gen/Apis'; import { AssetHousesOrientationEnum, AssetHousesOwnershipTypeEnum, - AssetHousesStatusEnum, AssetHousesUsageEnum, } from '@/gen/Enums'; import { BetaSchemaForm } from '@ant-design/pro-components'; @@ -24,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) => { @@ -53,14 +52,20 @@ export default function Create(props: MyBetaModalFormProps) { colProps: { span: 6 }, formItemProps: { ...rulesHelper.text }, }, + MyFormItems.EnumRadio({ + key: 'ownership_type', + title: '房屋属性', + colProps: { span: 24 }, + valueEnum: AssetHousesOwnershipTypeEnum, + // required: true, + }), MyFormItems.EnumRadio({ key: 'usage', title: '用途', - colProps: { span: 18 }, + colProps: { span: 24 }, valueEnum: AssetHousesUsageEnum, required: true, }), - { key: 'floor', title: '楼层', @@ -162,35 +167,29 @@ export default function Create(props: MyBetaModalFormProps) { valueEnum: AssetHousesOrientationEnum, // required: true, }), - MyFormItems.EnumRadio({ - key: 'status', - title: '房屋状态', - colProps: { span: 6 }, - // valueEnum: AssetHousesStatusEnum, - // required: true, - valueEnum: () => { - let obj: any = JSON.parse(JSON.stringify(AssetHousesStatusEnum)); - delete obj.SelfOccupied; - delete obj.Rented; - delete obj.Vacant; - return obj; - }, - }), - MyFormItems.EnumSelect({ - key: 'ownership_type', - title: '产权性质', - colProps: { span: 6 }, - valueEnum: AssetHousesOwnershipTypeEnum, - // required: true, - }), - { - key: 'ownership_term', - title: '产权年限', - fieldProps: { - addonAfter: '年', - }, - colProps: { span: 6 }, - }, + // MyFormItems.EnumRadio({ + // key: 'status', + // title: '房屋状态', + // colProps: { span: 6 }, + // // valueEnum: AssetHousesStatusEnum, + // // required: true, + // valueEnum: () => { + // let obj: any = JSON.parse(JSON.stringify(AssetHousesStatusEnum)); + // delete obj.SelfOccupied; + // delete obj.Rented; + // delete obj.Vacant; + // return obj; + // }, + // }), + + // { + // key: 'ownership_term', + // title: '产权年限', + // fieldProps: { + // addonAfter: '年', + // }, + // colProps: { span: 6 }, + // }, ]} /> ); diff --git a/src/pages/asset/components/modals/HousesUpdate.tsx b/src/pages/asset/components/modals/HousesUpdate.tsx index d78e434..8584567 100644 --- a/src/pages/asset/components/modals/HousesUpdate.tsx +++ b/src/pages/asset/components/modals/HousesUpdate.tsx @@ -10,7 +10,6 @@ import { Apis } from '@/gen/Apis'; import { AssetHousesOrientationEnum, AssetHousesOwnershipTypeEnum, - AssetHousesStatusEnum, AssetHousesUsageEnum, } from '@/gen/Enums'; import { BetaSchemaForm } from '@ant-design/pro-components'; @@ -25,7 +24,7 @@ export default function Update(props: MyBetaModalFormProps) { wrapperCol={{ span: 24 }} width="800px" trigger={ - + } form={form} key={new Date().getTime()} @@ -87,25 +86,31 @@ export default function Update(props: MyBetaModalFormProps) { colProps: { span: 6 }, formItemProps: { ...rulesHelper.number }, }), + { + key: 'name', + title: '房号', + colProps: { span: 6 }, + formItemProps: { ...rulesHelper.text }, + }, ], }, ]; }, }, - { - key: 'name', - title: '房号', - colProps: { span: 6 }, - formItemProps: { ...rulesHelper.text }, - }, + MyFormItems.EnumRadio({ + key: 'ownership_type', + title: '房屋属性', + colProps: { span: 24 }, + valueEnum: AssetHousesOwnershipTypeEnum, + // required: true, + }), MyFormItems.EnumRadio({ key: 'usage', title: '用途', - colProps: { span: 18 }, + colProps: { span: 24 }, valueEnum: AssetHousesUsageEnum, required: true, }), - { key: 'floor', title: '楼层', @@ -207,35 +212,20 @@ export default function Update(props: MyBetaModalFormProps) { valueEnum: AssetHousesOrientationEnum, // required: true, }), - MyFormItems.EnumRadio({ - key: 'status', - title: '房屋状态', - colProps: { span: 6 }, - // valueEnum: AssetHousesStatusEnum, - // required: true, - valueEnum: () => { - let obj: any = JSON.parse(JSON.stringify(AssetHousesStatusEnum)); - delete obj.SelfOccupied; - delete obj.Rented; - delete obj.Vacant; - return obj; - }, - }), - MyFormItems.EnumSelect({ - key: 'ownership_type', - title: '产权性质', - colProps: { span: 6 }, - valueEnum: AssetHousesOwnershipTypeEnum, - // required: true, - }), - { - key: 'ownership_term', - title: '产权年限', - fieldProps: { - addonAfter: '年', - }, - colProps: { span: 6 }, - }, + // MyFormItems.EnumRadio({ + // key: 'status', + // title: '房屋状态', + // colProps: { span: 6 }, + // // valueEnum: AssetHousesStatusEnum, + // // required: true, + // valueEnum: () => { + // let obj: any = JSON.parse(JSON.stringify(AssetHousesStatusEnum)); + // delete obj.SelfOccupied; + // delete obj.Rented; + // delete obj.Vacant; + // return obj; + // }, + // }), ]} /> ); 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 915de63..c36d0c1 100644 --- a/src/pages/asset/index.tsx +++ b/src/pages/asset/index.tsx @@ -10,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 Create from './modals/AssetCreate'; +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(); // 注册当前页面为标签页 @@ -30,12 +32,12 @@ export default function Index({ title = '项目管理' }) { } // headerTitle="项目列表" toolBarRender={(action) => [ - , + , ]} columns={[ MyColumns.ID(), MyColumns.EnumTag({ - title: '项目类型', + title: '类型', dataIndex: 'property_type', valueEnum: AssetProjectsPropertyTypeEnum, search: false, @@ -81,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', @@ -95,8 +106,10 @@ export default function Index({ title = '项目管理' }) { MyColumns.Option({ render: (_, item: any, index, action) => ( + + { navigate(`/asset/${item.id}`); }} diff --git a/src/pages/asset/modals/AssetCreate.tsx b/src/pages/asset/modals/AssetCreate.tsx index eac36f7..f65644a 100644 --- a/src/pages/asset/modals/AssetCreate.tsx +++ b/src/pages/asset/modals/AssetCreate.tsx @@ -27,14 +27,22 @@ export default function Create(props: MyBetaModalFormProps) { wrapperCol={{ span: 24 }} width="600px" trigger={} + key={new Date().getTime()} form={form} onOpenChange={(open: any) => { if (open) { form.resetFields(); // 清空表单数据 + form.setFieldsValue({ + companies_id: props?.item?.id, + }); } }} onFinish={async (values) => - Apis.Asset.AssetProjects.Store(values) + Apis.Asset.AssetProjects.Store({ + ...values, + longitude: values?.location ? values.location.split(',')[0] : '', + latitude: values?.location ? values.location.split(',')[1] : '', + }) .then(() => { props.reload?.(); message.success(props.title + '成功'); @@ -124,6 +132,23 @@ export default function Create(props: MyBetaModalFormProps) { }, colProps: { span: 8 }, }, + { + title: '项目经纬度', + dataIndex: 'location', + colProps: { span: 24 }, + fieldProps: { + addonAfter: ( + { + window.open( + 'https://api.map.baidu.com/lbsapi/getpoint/index.html', + ); + }} + /> + ), + }, + }, ]} /> ); diff --git a/src/pages/asset/modals/AssetUpdate.tsx b/src/pages/asset/modals/AssetUpdate.tsx index 542ad78..002ab97 100644 --- a/src/pages/asset/modals/AssetUpdate.tsx +++ b/src/pages/asset/modals/AssetUpdate.tsx @@ -6,7 +6,6 @@ import { rulesHelper, } from '@/common'; import { Address } from '@/components/Address'; -import { Selects } from '@/components/Select'; import { Apis } from '@/gen/Apis'; import { AssetProjectsChargeEnum, @@ -29,9 +28,13 @@ export default function Update(props: MyBetaModalFormProps) { width="600px" key={new Date().getTime()} form={form} - onOpenChange={(open: any) => { + onOpenChange={(open: any, props: any) => { if (open && props.item) { form.setFieldsValue(props.item); + form.setFieldValue( + 'location', + `${props.item?.longitude},${props.item?.latitude}`, + ); } }} request={() => @@ -46,7 +49,12 @@ export default function Update(props: MyBetaModalFormProps) { }) } onFinish={async (values) => - Apis.Asset.AssetProjects.Update({ ...values, id: props.item?.id ?? 0 }) + Apis.Asset.AssetProjects.Update({ + ...values, + id: props.item?.id ?? 0, + longitude: values?.location ? values.location.split(',')[0] : '', + latitude: values?.location ? values.location.split(',')[1] : '', + }) .then(() => { props.reload?.(); message.success(props.title + '成功'); @@ -66,12 +74,12 @@ export default function Update(props: MyBetaModalFormProps) { title: '项目别名', colProps: { span: 12 }, }, - Selects?.Companies({ - key: 'companies_id', - title: '所属机构', - colProps: { span: 24 }, - formItemProps: { ...rulesHelper.number }, - }), + // Selects?.Companies({ + // key: 'companies_id', + // title: '所属机构', + // colProps: { span: 24 }, + // formItemProps: { ...rulesHelper.number }, + // }), Address.Cascader({ key: 'casacader', title: '选择地址', @@ -136,6 +144,23 @@ export default function Update(props: MyBetaModalFormProps) { }, colProps: { span: 8 }, }, + { + title: '项目经纬度', + dataIndex: 'location', + colProps: { span: 24 }, + fieldProps: { + addonAfter: ( + { + window.open( + 'https://api.map.baidu.com/lbsapi/getpoint/index.html', + ); + }} + /> + ), + }, + }, ]} /> ); diff --git a/src/pages/asset_houses/index.tsx b/src/pages/asset_houses/index.tsx index a61ccd2..bb6fc6c 100644 --- a/src/pages/asset_houses/index.tsx +++ b/src/pages/asset_houses/index.tsx @@ -1,23 +1,26 @@ import { + MyButtons, MyColumns, MyPageContainer, MyProTableProps, usePageTabs, } from '@/common'; +import { MyExport } from '@/components/MyExport'; import { Apis } from '@/gen/Apis'; import { - AssetHousesOrientationEnum, AssetHousesOwnershipTypeEnum, - AssetHousesStatusEnum, 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/components/modals/HousesShow'; import HousesUpdate from '../asset/components/modals/HousesUpdate'; export default function Index({ title = '房屋列表' }) { + const [getParams, setParams] = useState({}); + const navigate = useNavigate(); // 注册当前页面为标签页 usePageTabs({ @@ -28,15 +31,35 @@ export default function Index({ title = '房屋列表' }) { - MyProTableProps.request(params, sort, Apis.Asset.AssetHouses.List) - } + request={async (params, sort) => { + 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', - ellipsis: true, }, MyColumns.EnumTag({ @@ -57,7 +80,9 @@ export default function Index({ title = '房屋列表' }) { title: '建筑面积', dataIndex: 'built_area', render(_, record) { - return `${record?.built_area || ''} m²`; + return `${ + record?.built_area ? record?.built_area + ' m²' : '-' + } `; }, search: false, }, @@ -65,7 +90,9 @@ export default function Index({ title = '房屋列表' }) { title: '套内面积', dataIndex: 'inside_area', render(_, record) { - return `${record?.inside_area || ''} m²`; + return `${ + record?.inside_area ? record?.inside_area + ' m²' : '-' + } `; }, search: false, }, @@ -73,31 +100,33 @@ export default function Index({ title = '房屋列表' }) { title: '计费面积', dataIndex: 'chargeable_area', render(_, record) { - return `${record?.chargeable_area || ''} m²`; + return `${ + record?.chargeable_area ? record?.chargeable_area + ' m²' : '-' + } `; }, search: false, }, { title: '户型', render(_, record) { - return `${record?.room || ''}室${record?.hall || ''}厅${ - record?.bathroom || '' - }卫${record?.kitchen || ''}厨${record?.balcony || ''}阳台`; + return `${record?.room || 'x'}室${record?.hall || 'x'}厅${ + record?.bathroom || 'x' + }卫${record?.kitchen || 'x'}厨${record?.balcony || 'x'}阳台`; }, search: false, }, - MyColumns.EnumTag({ - title: '朝向', - dataIndex: 'orientation', - valueEnum: AssetHousesOrientationEnum, - search: false, - }), - MyColumns.EnumTag({ - title: '房屋状态', - dataIndex: 'status', - valueEnum: AssetHousesStatusEnum, - search: false, - }), + // MyColumns.EnumTag({ + // title: '朝向', + // dataIndex: 'orientation', + // valueEnum: AssetHousesOrientationEnum, + // search: false, + // }), + // MyColumns.EnumTag({ + // title: '房屋状态', + // dataIndex: 'status', + // valueEnum: AssetHousesStatusEnum, + // search: false, + // }), MyColumns.EnumTag({ title: '产权性质', dataIndex: 'ownership_type', @@ -105,14 +134,14 @@ export default function Index({ title = '房屋列表' }) { search: false, }), - { - title: '产权年限', - dataIndex: 'ownership_term', - render(_, record) { - return `${record?.ownership_term || '-'} 年`; - }, - search: false, - }, + // { + // title: '产权年限', + // dataIndex: 'ownership_term', + // render(_, record) { + // return `${record?.ownership_term || '-'} 年`; + // }, + // search: false, + // }, MyColumns.Option({ render: (_, item: any, index, action) => ( @@ -122,6 +151,13 @@ export default function Index({ title = '房屋列表' }) { reload={action?.reload} title="编辑" /> + + Apis.Asset.AssetHouses.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> ), }), diff --git a/src/pages/banner/index.tsx b/src/pages/banner/index.tsx index b63c5c8..6d61d9e 100644 --- a/src/pages/banner/index.tsx +++ b/src/pages/banner/index.tsx @@ -14,7 +14,7 @@ import BannerCreate from './modals/BannerCreate'; import BannerShow from './modals/BannerShow'; import BannerUpdate from './modals/BannerUpdate'; -export default function Index({ title = '投放内容' }) { +export default function Index({ title = '内容管理' }) { const navigate = useNavigate(); // 注册当前页面为标签页 diff --git a/src/pages/banner/modals/BannerCreate.tsx b/src/pages/banner/modals/BannerCreate.tsx index f606a9d..291bfa8 100644 --- a/src/pages/banner/modals/BannerCreate.tsx +++ b/src/pages/banner/modals/BannerCreate.tsx @@ -20,10 +20,14 @@ export default function Create(props: MyBetaModalFormProps) { wrapperCol={{ span: 24 }} width="600px" trigger={} + key={new Date().getTime()} form={form} onOpenChange={(open: any) => { if (open) { form.resetFields(); // 清空表单数据 + form.setFieldsValue({ + banner_spaces_id: props.item?.banner_spaces_id, + }); } }} onFinish={async (values) => @@ -41,6 +45,10 @@ export default function Create(props: MyBetaModalFormProps) { title: '选择广告位', colProps: { span: 12 }, formItemProps: { ...rulesHelper.text }, + fieldProps: { + showSearch: true, + optionFilterProp: 'label', + }, }), { key: 'name', diff --git a/src/pages/banner_space/components/BannerList.tsx b/src/pages/banner_space/components/BannerList.tsx index c64e740..8c7386f 100644 --- a/src/pages/banner_space/components/BannerList.tsx +++ b/src/pages/banner_space/components/BannerList.tsx @@ -32,7 +32,10 @@ export default function Index({ ...rest }) { toolBarRender={(action) => [ , diff --git a/src/pages/banner_space/index.tsx b/src/pages/banner_space/index.tsx index f921bd1..8671939 100644 --- a/src/pages/banner_space/index.tsx +++ b/src/pages/banner_space/index.tsx @@ -13,7 +13,7 @@ import { Space } from 'antd'; import BannerSpaceCreate from './modals/BannerSpaceCreate'; import BannerSpaceUpdate from './modals/BannerSpaceUpdate'; -export default function Index({ title = '投放位置' }) { +export default function Index({ title = '点位管理' }) { const navigate = useNavigate(); // 注册当前页面为标签页 diff --git a/src/pages/banner_space/modals/BannerSpaceCreate.tsx b/src/pages/banner_space/modals/BannerSpaceCreate.tsx index def0cfe..c3117de 100644 --- a/src/pages/banner_space/modals/BannerSpaceCreate.tsx +++ b/src/pages/banner_space/modals/BannerSpaceCreate.tsx @@ -18,6 +18,7 @@ export default function Create(props: MyBetaModalFormProps) { wrapperCol={{ span: 24 }} width="500px" trigger={} + key={new Date().getTime()} onFinish={async (values) => Apis.Banner.BannerSpaces.Store(values) .then(() => { 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/charge_standard/$id.tsx b/src/pages/charge_standard/$id.tsx new file mode 100644 index 0000000..ea63d30 --- /dev/null +++ b/src/pages/charge_standard/$id.tsx @@ -0,0 +1,52 @@ +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 { useEffect, useState } from 'react'; +import ChargeInfo from './components/ChargeInfo'; +import HasHouse from './components/HasHouse'; + +export default function Show({ title }: { title?: string } = {}) { + const { id } = useParams<{ id: string }>(); + const [data, setShow] = useState({}); + + // 注册当前页面为标签页 + const { addTab } = usePageTabs({ + tabKey: `charge-standard-${id}`, + tabLabel: '收费标准详情', + }); + + const loadShow = () => { + let paramsId: any = { id: id ?? 0 }; + Apis.HouseCharage.HouseChargeStandards.Show(paramsId).then((res) => { + setShow(res?.data); + }); + }; + + useEffect(() => { + loadShow(); + }, [id]); + + let items = [ + { + label: '关联房屋', + key: '1', + closable: false, + children: ( + loadShow()} + /> + ), + }, + ]; + return ( + + + + + + + ); +} diff --git a/src/pages/charge_standard/components/ChargeInfo.tsx b/src/pages/charge_standard/components/ChargeInfo.tsx new file mode 100644 index 0000000..9e48fe4 --- /dev/null +++ b/src/pages/charge_standard/components/ChargeInfo.tsx @@ -0,0 +1,52 @@ +import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { + HouseBillsTypeEnum, + HouseChargeStandardsCalculationModeEnum, + HouseChargeStandardsCalculationPeriodEnum, +} from '@/gen/Enums'; +import { ProCard, ProDescriptions } from '@ant-design/pro-components'; +import { Space } from 'antd'; + +export default function info(props: MyBetaModalFormProps) { + const { item } = props; + + return ( + + + + + {item?.name} + + + {item?.asset_project?.name} + + + + + + + + + + + + + {item?.remark} + + + + + ); +} diff --git a/src/pages/charge_standard/components/HasHouse.tsx b/src/pages/charge_standard/components/HasHouse.tsx new file mode 100644 index 0000000..234c1e5 --- /dev/null +++ b/src/pages/charge_standard/components/HasHouse.tsx @@ -0,0 +1,86 @@ +import { MyButtons, MyColumns, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import BannerCreate from '@/pages/banner/modals/BannerCreate'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import { useEffect, useRef } from 'react'; + +export default function Index({ ...rest }) { + const actionLooks = useRef(); + useEffect(() => { + actionLooks?.current.reloadAndRest(); + }, [rest.loadmore]); + + return ( + <> + > + {...MyProTableProps.props} + actionRef={actionLooks} + request={async (params, sort) => + MyProTableProps.request( + { + ...params, + house_charge_standards_id: rest.item?.id, + }, + sort, + Apis.HouseCharage.HouseChargeHasHouses.List, + ) + } + toolBarRender={(action) => [ + , + ]} + search={false} + columns={[ + MyColumns.ID(), + { + title: '房屋名称', + dataIndex: 'full_name', + }, + { + title: '项目名称', + dataIndex: 'project_name', + }, + { + title: '楼栋名称', + dataIndex: 'building_name', + }, + { + title: '单元名称', + dataIndex: 'unit_name', + }, + { + title: '房号', + dataIndex: 'name', + }, + + { + title: '绑定时间', + dataIndex: 'updated_at', + search: false, + }, + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + Apis.HouseCharage.HouseChargeHasHouses.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/charge_standard/index.tsx b/src/pages/charge_standard/index.tsx new file mode 100644 index 0000000..b3e5ddd --- /dev/null +++ b/src/pages/charge_standard/index.tsx @@ -0,0 +1,145 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, + usePageTabs, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + HouseBillsTypeEnum, + HouseChargeStandardsCalculationMethodEnum, + HouseChargeStandardsCalculationModeEnum, + HouseChargeStandardsCalculationPeriodEnum, +} from '@/gen/Enums'; +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 ChargeCreate from './modals/ChargeCreate'; + +export default function Index({ title = '收费标准' }) { + const navigate = useNavigate(); + + // 注册当前页面为标签页 + usePageTabs({ + tabKey: 'house-charge', + tabLabel: title, + }); + + return ( + + + MyProTableProps.request( + params, + sort, + Apis.HouseCharage.HouseChargeStandards.List, + ) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID(), + { + title: '关联项目', + dataIndex: ['asset_project', 'name'], + search: { + transform: (value) => { + return { project_name: value }; + }, + }, + }, + { + title: '收费标准名称', + dataIndex: 'name', + search: false, + }, + MyColumns.EnumTag({ + title: '收费项目', + dataIndex: 'charge_type', + valueEnum: HouseBillsTypeEnum, + }), + MyColumns.EnumTag({ + title: '计量单位', + dataIndex: 'calculation_method', + valueEnum: HouseChargeStandardsCalculationMethodEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '计费模式', + dataIndex: 'calculation_mode', + valueEnum: HouseChargeStandardsCalculationModeEnum, + search: false, + }), + { + title: '单价', + dataIndex: 'price', + search: false, + }, + MyColumns.EnumTag({ + title: '账单计费周期', + dataIndex: 'calculation_period', + valueEnum: HouseChargeStandardsCalculationPeriodEnum, + search: false, + }), + { + title: '账单自动生成日期', + dataIndex: 'auto_date', + search: false, + }, + { + title: '是否分摊', + dataIndex: 'is_apportionment', + search: false, + render(_, record) { + return `${record?.is_apportionment ? '是' : '否'} `; + }, + }, + + // MyColumns.UpdatedAt(), + // MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + { + navigate(`/charge_standard/${item.id}`); + }} + /> + + + + Apis.HouseCharage.HouseChargeStandards.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/charge_standard/modals/ChargeCreate.tsx b/src/pages/charge_standard/modals/ChargeCreate.tsx new file mode 100644 index 0000000..19a8699 --- /dev/null +++ b/src/pages/charge_standard/modals/ChargeCreate.tsx @@ -0,0 +1,458 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + HouseBillsTypeEnum, + HouseChargeStandardsApportionmentMethodEnum, + HouseChargeStandardsCalculationMethodEnum, + HouseChargeStandardsCalculationModeEnum, + HouseChargeStandardsCalculationPeriodEnum, + HouseChargeStandardsPriceAlgorithmEnum, + HouseChargeStandardsTypeEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +import { useRef } from 'react'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const actionRef = useRef(); + + return ( + + {...MyModalFormProps.props} + title={`创建收费标准`} + wrapperCol={{ span: 24 }} + width="600px" + 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.HouseCharage.HouseChargeStandards.Store({ + ...values, + asset_projects_id: props?.item?.id, + type: + values.charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + values.charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? HouseChargeStandardsTypeEnum.House.value + : HouseChargeStandardsTypeEnum.Meter.value, + is_apportionment: + values.charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + values.charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? 1 + : 0, + // 按套 + calculation_mode: + values?.calculation_method === + HouseChargeStandardsCalculationMethodEnum.PerUnit.value + ? HouseChargeStandardsCalculationModeEnum.FixedAmount.value + : values?.calculation_mode, + // 按固定金额 + price_algorithm: + values?.calculation_mode === + HouseChargeStandardsCalculationModeEnum.FixedAmount.value || + values?.calculation_method === + HouseChargeStandardsCalculationMethodEnum.PerUnit.value + ? HouseChargeStandardsPriceAlgorithmEnum.Fixed.value + : values?.price_algorithm, + tiered_rates: values.tiered_rates?.map((res: any) => { + return { + ...res, + }; + }), + // 避免计费模式切换导致的价格异常 + price: + values?.price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Fixed.value + ? values.price + : 0, + }) + .then(() => { + props.reload?.(); + message.success('收费标准创建成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + Selects?.AssetProjects({ + key: 'asset_projects_id', + title: '项目', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + { + key: 'name', + title: '收费标准名称', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + MyFormItems.EnumRadio({ + key: 'charge_type', + title: '收费项目', + colProps: { span: 24 }, + valueEnum: HouseBillsTypeEnum, + required: true, + }), + { + name: ['charge_type'], + valueType: 'dependency', + columns: ({ charge_type }: any) => { + return charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? [ + MyFormItems.EnumRadio({ + key: 'calculation_method', + title: '分摊方式', + colProps: { span: 18 }, + valueEnum: HouseChargeStandardsApportionmentMethodEnum, + required: true, + }), + ] + : []; + }, + }, + + // Selects?.AssetProjects({ + // key: 'asset_projects_id', + // title: '项目', + // colProps: { span: 12 }, + // formItemProps: { ...rulesHelper.text }, + // }), + { + name: ['charge_type'], + valueType: 'dependency', + columns: ({ charge_type }: any) => { + return charge_type === HouseBillsTypeEnum.PropertyFee.value || + charge_type === HouseBillsTypeEnum.MaintenanceFund.value + ? [ + MyFormItems.EnumRadio({ + key: 'calculation_method', + title: '计量单位', + colProps: { span: 16 }, + valueEnum: () => { + let obj: any = JSON.parse( + JSON.stringify( + HouseChargeStandardsCalculationMethodEnum, + ), + ); + delete obj.ElectricityUsage; + delete obj.WaterUsage; + return obj; + }, + required: true, + }), + ] + : charge_type === HouseBillsTypeEnum.WaterFee.value || + charge_type === HouseBillsTypeEnum.ElectricityFee.value || + charge_type === HouseBillsTypeEnum.SharedWaterFee.value || + charge_type === HouseBillsTypeEnum.SharedElectricityFee.value + ? [ + MyFormItems.EnumRadio({ + key: 'calculation_method', + title: '计量单位', + colProps: { span: 16 }, + valueEnum: () => { + let obj: any = JSON.parse( + JSON.stringify( + HouseChargeStandardsCalculationMethodEnum, + ), + ); + delete obj.ChargeableArea; + delete obj.BuiltArea; + delete obj.InsideArea; + delete obj.PerUnit; + return obj; + }, + required: true, + }), + ] + : []; + }, + }, + { + name: ['calculation_method'], + valueType: 'dependency', + columns: ({ calculation_method }: any) => { + return calculation_method === + HouseChargeStandardsCalculationMethodEnum.PerUnit.value + ? [ + { + key: 'price', + title: '固定单价', + colProps: { span: 10 }, + fieldProps: { + addonAfter: '元', + }, + formItemProps: { ...rulesHelper.number }, + }, + ] + : !calculation_method && + calculation_method !== + HouseChargeStandardsCalculationMethodEnum.PerUnit.value + ? [] + : [ + MyFormItems.EnumRadio({ + key: 'calculation_mode', + title: '计费模式', + colProps: { span: 12 }, + valueEnum: HouseChargeStandardsCalculationModeEnum, + required: true, + }), + ]; + }, + }, + + { + name: ['calculation_mode'], + valueType: 'dependency', + columns: ({ calculation_mode }: any) => { + return calculation_mode === + HouseChargeStandardsCalculationModeEnum.FixedAmount.value + ? [ + { + key: 'price', + title: '固定单价', + colProps: { span: 10 }, + fieldProps: { + addonAfter: '元', + }, + formItemProps: { ...rulesHelper.number }, + }, + ] + : calculation_mode === + HouseChargeStandardsCalculationModeEnum.QuantityPrice.value + ? [ + MyFormItems.EnumRadio({ + key: 'price_algorithm', + title: '计费算法', + colProps: { span: 14 }, + valueEnum: HouseChargeStandardsPriceAlgorithmEnum, + required: true, + // fieldProps: { + // onChange: () => { + // // 切换计费算法时清空阶梯配置 + // form.setFieldValue('scheme', undefined); + // }, + // }, + }), + { + name: ['price_algorithm'], + valueType: 'dependency', + columns: ({ price_algorithm }: any) => { + return price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Fixed.value + ? [ + { + key: 'price', + title: '固定单价', + colProps: { span: 10 }, + fieldProps: { + addonAfter: '元', + }, + formItemProps: { ...rulesHelper.number }, + }, + ] + : price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Tiered.value + ? [ + { + valueType: 'formList', + dataIndex: 'tiered_rates', + title: '阶梯标准', + formItemProps: { ...rulesHelper.array }, + initialValue: [ + { + start: 0, + end: null, + price: null, + }, + ], + fieldProps: { + actionRef: actionRef, + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + key: 'start', + colProps: { span: 10 }, + title: '起始值', + valueType: 'number', + fieldProps: { + min: 0, + addonBefore: ( + _: any, + { + field, + }: { field: { index: number[] } }, + ) => `第${field.index[1] + 1}阶梯`, + }, + width: '100%', + formItemProps: { ...rulesHelper.number }, + }, + { + key: 'end', + colProps: { span: 6 }, + title: '结束值', + valueType: 'number', + width: '100%', + formItemProps: { ...rulesHelper.number }, + fieldProps: { maxLength: 12 }, + }, + { + key: 'price', + colProps: { span: 8 }, + title: '阶梯单价', + valueType: 'number', + fieldProps: { + addonAfter: '元', + min: 0, + }, + formItemProps: { ...rulesHelper.number }, + }, + ], + }, + ], + }, + ] + : price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Peak.value + ? [ + { + valueType: 'formList', + dataIndex: 'tiered_rates', + title: '阶梯标准', + formItemProps: { ...rulesHelper.array }, + initialValue: [ + { + start: 0, + end: null, + price: null, + }, + ], + fieldProps: { + actionRef: actionRef, + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + key: 'start', + colProps: { span: 10 }, + title: '起始值', + valueType: 'number', + fieldProps: { + min: 0, + addonBefore: ( + _: any, + { + field, + }: { field: { name: number[] } }, + ) => `第${field.name[1] + 1}阶梯`, + }, + width: '100%', + formItemProps: { ...rulesHelper.number }, + }, + { + key: 'end', + colProps: { span: 6 }, + title: '结束值', + valueType: 'number', + width: '100%', + formItemProps: { ...rulesHelper.number }, + fieldProps: { maxLength: 12 }, + }, + { + key: 'price', + colProps: { span: 8 }, + title: '阶梯单价', + valueType: 'number', + fieldProps: { + addonAfter: '元', + min: 0, + }, + formItemProps: { ...rulesHelper.number }, + }, + ], + }, + ], + }, + ] + : []; + }, + }, + ] + : []; + }, + }, + { + name: ['price', 'price_algorithm'], + valueType: 'dependency', + columns: ({ price, price_algorithm }: any) => { + return price || + price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Tiered.value || + price_algorithm === + HouseChargeStandardsPriceAlgorithmEnum.Peak.value + ? [ + { + valueType: 'group', + columns: [ + MyFormItems.EnumRadio({ + key: 'calculation_period', + title: '账单计费周期', + colProps: { span: 14 }, + valueEnum: HouseChargeStandardsCalculationPeriodEnum, + required: true, + }), + { + key: 'auto_date', + title: '账单自动生成日期', + colProps: { span: 10 }, + valueType: 'date', + width: '100%', + }, + { + key: 'remark', + title: '备注', + colProps: { span: 24 }, + valueType: 'textarea', + fieldProps: { + rows: 4, + maxLength: 500, + showCount: true, + }, + }, + ], + }, + ] + : []; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/company/$id.tsx b/src/pages/company/$id.tsx index 01f9851..52d8e52 100644 --- a/src/pages/company/$id.tsx +++ b/src/pages/company/$id.tsx @@ -2,15 +2,17 @@ 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 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 Projects from './components/Projects'; import ReceiptAccounts from './components/ReceiptAccounts'; +import CompanyUpdate from './modals/CompanyUpdate'; export default function Show({ title }: { title?: string } = {}) { const { id } = useParams<{ id: string }>(); @@ -19,7 +21,7 @@ export default function Show({ title }: { title?: string } = {}) { // 注册当前页面为标签页 const { addTab } = usePageTabs({ tabKey: `company-show-${id}`, - tabLabel: data?.short_name || title || '资产详情', + tabLabel: '配置:' + (data?.short_name || title || '资产详情'), }); const loadShow = () => { let paramsId: any = { id: id ?? 0 }; @@ -41,37 +43,37 @@ export default function Show({ title }: { title?: string } = {}) { let items = [ { - label: '项目管理', + label: '1-项目配置', key: '1', closable: false, - children: , + children: , }, { - label: '组织管理', + label: '2-组织配置', key: '2', closable: false, children: , }, { - label: '岗位管理', + label: '3-岗位配置', key: '3', closable: false, children: , }, { - label: '员工管理', + label: '4-员工配置', key: '4', closable: false, children: , }, { - label: '收款账号', + label: '5-账号配置', key: '5', closable: false, children: , }, { - label: '应用管理', + label: '6-应用配置', key: '6', closable: false, children: , @@ -79,7 +81,24 @@ export default function Show({ title }: { title?: string } = {}) { ]; return ( - + {/* */} + + + + + } + > +
+ * 您可在以下页签中对应配置:项目、组织、岗位、员工、账号、应用; +
+
diff --git a/src/pages/company/components/Projects.tsx b/src/pages/company/components/Assets.tsx similarity index 88% rename from src/pages/company/components/Projects.tsx rename to src/pages/company/components/Assets.tsx index cf2e441..e20111a 100644 --- a/src/pages/company/components/Projects.tsx +++ b/src/pages/company/components/Assets.tsx @@ -9,6 +9,7 @@ import { AssetProjectsPropertyTypeEnum, AssetProjectsStatusEnum, } from '@/gen/Enums'; +import AssetCreate from '@/pages/asset/modals/AssetCreate'; import { ProTable } from '@ant-design/pro-components'; import { Space } from 'antd'; import { useNavigate } from 'react-router-dom'; @@ -27,16 +28,16 @@ export default function Index(props: MyBetaModalFormProps) { Apis.Asset.AssetProjects.List, ) } - // toolBarRender={(action) => [ - // , - // ]} + toolBarRender={(action) => [ + , + ]} // search={false} - options={false} + // options={false} columns={[ MyColumns.ID(), { diff --git a/src/pages/company/components/ComponentsInfo.tsx b/src/pages/company/components/ComponentsInfo.tsx index 109270c..ced50f0 100644 --- a/src/pages/company/components/ComponentsInfo.tsx +++ b/src/pages/company/components/ComponentsInfo.tsx @@ -1,62 +1,69 @@ import { MyBetaModalFormProps, renderTextHelper } from '@/common'; +import { MyModal } from '@/components/MyModal'; import { CompaniesMerchantTypeEnum } from '@/gen/Enums'; import { ProCard, ProDescriptions } from '@ant-design/pro-components'; import { Space } from 'antd'; -import CompanyUpdate from '../modals/CompanyUpdate'; export default function info(props: MyBetaModalFormProps) { return ( - - - - - {props?.item?.short_name} - - - - {props?.item?.name} - - - - - - + + + + + {props?.item?.short_name} + + + + {props?.item?.name} + {/* */} + + + + + - - {props?.item?.business_license_number} - + + {props?.item?.business_license_number} + - - {props?.item?.contact_name} - - - {props?.item?.contact_phone} - - - {props?.item?.contact_email} - - - {props?.item?.province || ''} - {props?.item?.city || ''} - {props?.item?.district || ''} - {props?.item?.address || ''} - - - {props?.item?.created_at} - - - {props?.item?.updated_at} - - - - + + {props?.item?.contact_name} + + + {props?.item?.contact_phone} + + + {props?.item?.contact_email} + + + {props?.item?.province || ''} + {props?.item?.city || ''} + {props?.item?.district || ''} + {props?.item?.address || ''} + + + {props?.item?.created_at} + + + {props?.item?.updated_at} + + +
+ + } + /> ); } diff --git a/src/pages/company/components/Employees.tsx b/src/pages/company/components/Employees.tsx index 0551abb..7c04237 100644 --- a/src/pages/company/components/Employees.tsx +++ b/src/pages/company/components/Employees.tsx @@ -25,7 +25,7 @@ export default function Index(props: MyBetaModalFormProps) { toolBarRender={(action) => [ , @@ -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 bbfe981..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) => [ @@ -33,14 +33,8 @@ export default function Organizations(props: MyBetaModalFormProps) { />, ]} // search={false} - options={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) => ( - - { if (open) { form.resetFields(); // 清空表单数据 + form.setFieldsValue({ + companies_id: props?.item?.id, + }); } }} onFinish={async (values: any) => @@ -40,17 +43,18 @@ export default function Create(props: MyBetaModalFormProps) { .catch(() => false) } columns={[ - // Selects?.Organizations({ - // title: '设置所属组织', - // params: { companies_id: props?.item?.companies_id }, - // key: 'organizations_id', - // formItemProps: { ...rulesHelper.text }, - // }), + Selects?.Companies({ + key: 'companies_id', + title: '所属机构', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + }), Selects?.OrganizationsTree({ title: '选择组织', key: 'organizations_id', params: { companies_id: props?.item?.companies_id }, colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, }), { key: 'name', diff --git a/src/pages/company/components/modals/EmployeeUpdate.tsx b/src/pages/company/components/modals/EmployeeUpdate.tsx index 5a32033..373774a 100644 --- a/src/pages/company/components/modals/EmployeeUpdate.tsx +++ b/src/pages/company/components/modals/EmployeeUpdate.tsx @@ -46,12 +46,6 @@ export default function Update(props: MyBetaModalFormProps) { .catch(() => false) } columns={[ - // Selects?.Organizations({ - // title: '所属组织', - // params: { companies_id: props?.item?.companies_id }, - // key: 'organizations_id', - // formItemProps: { ...rulesHelper.text }, - // }), Selects?.OrganizationsTree({ title: '选择组织', key: 'organizations_id', @@ -60,6 +54,7 @@ export default function Update(props: MyBetaModalFormProps) { fieldProps: { showSearch: true, }, + formItemProps: { ...rulesHelper.text }, }), { key: 'name', diff --git a/src/pages/company/components/modals/OrganizationChange.tsx b/src/pages/company/components/modals/OrganizationChange.tsx index 556e401..7e26393 100644 --- a/src/pages/company/components/modals/OrganizationChange.tsx +++ b/src/pages/company/components/modals/OrganizationChange.tsx @@ -11,7 +11,9 @@ export default function Update(props: MyBetaModalFormProps) { {...MyModalFormProps.props} title={`${props.title}调整`} form={form} - trigger={} + 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..0525449 100644 --- a/src/pages/company/components/modals/ReceiptAccountCreate.tsx +++ b/src/pages/company/components/modals/ReceiptAccountCreate.tsx @@ -30,7 +30,7 @@ export default function Create(props: MyBetaModalFormProps) { Apis.Company.CompanyReceiptAccounts.Store({ ...values, companies_id: props?.item?.id, - is_default: values.is_default ? 1 : 0, + is_default: 0, }) .then(() => { props.reload?.(); @@ -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..9ce19ba 100644 --- a/src/pages/company/components/modals/ReceiptAccountUpdate.tsx +++ b/src/pages/company/components/modals/ReceiptAccountUpdate.tsx @@ -31,6 +31,7 @@ export default function Update(props: MyBetaModalFormProps) { ...values, companies_id: props?.item?.companies_id, id: props.item?.id ?? 0, + is_default: 0, }) .then(() => { props.reload?.(); @@ -65,6 +66,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 47d2690..882bc74 100644 --- a/src/pages/company/index.tsx +++ b/src/pages/company/index.tsx @@ -6,11 +6,12 @@ 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'; +import ComponentsInfo from './components/ComponentsInfo'; import CompanyCreate from './modals/CompanyCreate'; +import CompanyUpdate from './modals/CompanyUpdate'; export default function Index({ title = '机构列表' }) { const navigate = useNavigate(); @@ -39,19 +40,20 @@ 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, @@ -61,15 +63,26 @@ export default function Index({ title = '机构列表' }) { MyColumns.Option({ render: (_, item: any, index, action) => ( + + { navigate(`/company/${item.id}`); }} /> - 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..8d1e024 100644 --- a/src/pages/company/modals/CompanyCreate.tsx +++ b/src/pages/company/modals/CompanyCreate.tsx @@ -47,16 +47,18 @@ 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: '联系人姓名', colProps: { span: 6 }, - // formItemProps: { ...rulesHelper.text }, + formItemProps: { ...rulesHelper.text }, }, { key: 'contact_phone', @@ -66,7 +68,7 @@ export default function Create(props: MyBetaModalFormProps) { fieldProps: { maxLength: 11, }, - // formItemProps: { ...rulesHelper.phone }, + formItemProps: { ...rulesHelper.phone }, }, { key: 'contact_email', diff --git a/src/pages/company/modals/CompanyUpdate.tsx b/src/pages/company/modals/CompanyUpdate.tsx index 7b72009..2737c9d 100644 --- a/src/pages/company/modals/CompanyUpdate.tsx +++ b/src/pages/company/modals/CompanyUpdate.tsx @@ -69,7 +69,7 @@ export default function Update(props: MyBetaModalFormProps) { key: 'contact_name', title: '联系人姓名', colProps: { span: 6 }, - // formItemProps: { ...rulesHelper.text }, + formItemProps: { ...rulesHelper.text }, }, { key: 'contact_phone', @@ -79,7 +79,7 @@ export default function Update(props: MyBetaModalFormProps) { fieldProps: { maxLength: 11, }, - // formItemProps: { ...rulesHelper.phone }, + formItemProps: { ...rulesHelper.phone }, }, { key: 'contact_email', diff --git a/src/pages/convenience_services/index.tsx b/src/pages/convenience_services/index.tsx new file mode 100644 index 0000000..59f2ca2 --- /dev/null +++ b/src/pages/convenience_services/index.tsx @@ -0,0 +1,115 @@ +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 BannerCreate 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/convenience_services/modals/ServiceCreate.tsx b/src/pages/convenience_services/modals/ServiceCreate.tsx new file mode 100644 index 0000000..ed5a013 --- /dev/null +++ b/src/pages/convenience_services/modals/ServiceCreate.tsx @@ -0,0 +1,109 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + 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'; +import { Form, message } from 'antd'; +import { useRef } from 'react'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const actionRef = useRef(); + + return ( + + {...MyModalFormProps.props} + title={`添加便民服务`} + wrapperCol={{ span: 24 }} + width="600px" + trigger={} + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + onFinish={async (values) => + Apis.Common.ConvenienceServices.Store(values) + .then(() => { + props.reload?.(); + message.success('添加便民服务成功'); + return true; + }) + .catch(() => false) + } + columns={[ + MyFormItems.EnumRadio({ + key: 'type', + title: '类型', + colProps: { span: 24 }, + valueEnum: ConvenienceServicesTypeEnum, + required: true, + }), + { + key: 'name', + title: '名称', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + Selects?.AssetProjects({ + key: 'asset_projects_id', + title: '项目', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + { + valueType: 'formList', + dataIndex: 'content', + title: '服务内容', + formItemProps: { ...rulesHelper.array }, + initialValue: [ + { + name: null, + phone: null, + }, + ], + fieldProps: { + actionRef: actionRef, + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + key: 'name', + colProps: { span: 12 }, + // title: '服务名称', + fieldProps: { + addonBefore: '联系对象', + }, + width: '100%', + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'phone', + colProps: { span: 12 }, + // title: '阶梯单价', + fieldProps: { + addonBefore: '联系电话', + }, + formItemProps: { ...rulesHelper.text }, + }, + ], + }, + ], + }, + ]} + /> + ); +} diff --git a/src/pages/convenience_services/modals/ServiceUpdate.tsx b/src/pages/convenience_services/modals/ServiceUpdate.tsx new file mode 100644 index 0000000..9cfb066 --- /dev/null +++ b/src/pages/convenience_services/modals/ServiceUpdate.tsx @@ -0,0 +1,112 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + 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'; +import { Form, message } from 'antd'; +import { useRef } from 'react'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const actionRef = useRef(); + + 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.Common.ConvenienceServices.Update({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success('编辑便民服务成功'); + return true; + }) + .catch(() => false) + } + columns={[ + MyFormItems.EnumRadio({ + key: 'type', + title: '类型', + colProps: { span: 24 }, + valueEnum: ConvenienceServicesTypeEnum, + required: true, + }), + { + key: 'name', + title: '名称', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + Selects?.AssetProjects({ + key: 'asset_projects_id', + title: '项目', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }), + { + valueType: 'formList', + dataIndex: 'content', + title: '服务内容', + formItemProps: { ...rulesHelper.array }, + initialValue: [ + { + name: null, + phone: null, + }, + ], + fieldProps: { + actionRef: actionRef, + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + { + key: 'name', + colProps: { span: 12 }, + // title: '服务名称', + fieldProps: { + addonBefore: '联系对象', + }, + width: '100%', + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'phone', + colProps: { span: 12 }, + // title: '阶梯单价', + fieldProps: { + addonBefore: '联系电话', + }, + formItemProps: { ...rulesHelper.text }, + }, + ], + }, + ], + }, + ]} + /> + ); +} diff --git a/src/pages/employees/index.tsx b/src/pages/employees/index.tsx index a4b61f5..4f7b76a 100644 --- a/src/pages/employees/index.tsx +++ b/src/pages/employees/index.tsx @@ -8,6 +8,7 @@ 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'; export default function Index({ title = '员工管理' }) { @@ -35,13 +36,9 @@ export default function Index({ title = '员工管理' }) { Apis.Company.CompanyEmployees.List, ) } - // toolBarRender={(action) => [ - // , - // ]} + toolBarRender={(action) => [ + , + ]} columns={[ MyColumns.ID(), { @@ -50,9 +47,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 43bf235..a848186 100644 --- a/src/pages/examine/house_registers_audit/modals/Audit.tsx +++ b/src/pages/examine/house_registers_audit/modals/Audit.tsx @@ -12,8 +12,7 @@ import { import { Apis } from '@/gen/Apis'; import { HouseOccupantsCardTypeEnum, - HouseOccupantsHouseRelationEnum, - HouseRegistersHouseStatusEnum, + HouseOccupantsResidentialRelationEnum, HouseRegistersStatusEnum, HouseRegistersTypeEnum, } from '@/gen/Enums'; @@ -32,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' }, }} @@ -57,17 +56,17 @@ export default function Update(props: MyBetaModalFormProps) { valueType: 'text', renderFormItem: () => ( - - + + {props?.item?.asset_house?.full_name || '-'} - + {/* - + */} 0 && ( - + { return ( @@ -148,7 +151,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 && ( diff --git a/src/pages/tabs-demo.tsx b/src/pages/tabs-demo.tsx deleted file mode 100644 index c88d1c6..0000000 --- a/src/pages/tabs-demo.tsx +++ /dev/null @@ -1,243 +0,0 @@ -import React from 'react'; -import { Button, Card, Space, Divider, Row, Col, Statistic, Alert } from 'antd'; -import { - PlusOutlined, - UserOutlined, - SettingOutlined, - HomeOutlined, - FileTextOutlined, - TeamOutlined -} from '@ant-design/icons'; -import { MyPageContainer, usePageTabs } from '@/common'; -import { history } from '@umijs/max'; - -/** - * 多标签页功能演示页面 - * 展示完整的标签页管理功能 - */ -export default function TabsDemo() { - const tabsApi = usePageTabs({ - tabKey: 'tabs-demo', - tabLabel: '标签页演示', - closable: false // 演示页面不可关闭 - }); - - // 模拟打开不同的页面标签 - const openTab = (key: string, label: string, path: string) => { - tabsApi.addTab({ - key, - label, - path, - closable: true - }); - // 注意:在实际项目中,这里应该使用 history.push(path) - // 由于这是演示,我们只是添加标签而不实际跳转 - console.log(`模拟跳转到: ${path}`); - }; - - const demoTabs = [ - { - key: 'employees', - label: '员工管理', - path: '/employees', - icon: , - description: '管理公司员工信息' - }, - { - key: 'companies', - label: '公司管理', - path: '/company/companies', - icon: , - description: '管理公司基本信息' - }, - { - key: 'house-bills', - label: '房屋账单', - path: '/house_bills', - icon: , - description: '查看和管理房屋账单' - }, - { - key: 'system-admins', - label: '系统管理员', - path: '/system/admins', - icon: , - description: '管理系统管理员账户' - }, - { - key: 'system-roles', - label: '角色管理', - path: '/system/sys_roles', - icon: , - description: '管理系统角色权限' - } - ]; - - return ( - - - - {/* 统计信息 */} - - - - } - /> - - - - - - - - - - } - /> - - - - - } - /> - - - - - {/* 快速打开标签页 */} - - - {demoTabs.map(tab => ( - - openTab(tab.key, tab.label, tab.path)} - style={{ cursor: 'pointer', textAlign: 'center' }} - > -
- {tab.icon} -
-
- {tab.label} -
-
- {tab.description} -
-
- - ))} -
-
- - {/* 标签页操作 */} - - - - - - - - - - - - - - - {/* 功能说明 */} - - - -

🎯 核心功能

-
    -
  • 多标签页支持:支持同时打开多个页面标签
  • -
  • 右键菜单:右键点击标签页显示操作菜单
  • -
  • 智能导航:关闭标签时自动切换到相邻标签
  • -
  • 状态持久化:标签页状态在组件间共享
  • -
  • 自定义样式:支持主题定制和样式覆盖
  • -
- - - -

🖱️ 右键菜单操作

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

💡 使用提示

-
    -
  • 点击上方的页面卡片可以快速打开对应的标签页
  • -
  • 右键点击任意标签页可以看到完整的操作菜单
  • -
  • 使用工具栏按钮可以批量操作标签页
  • -
  • 演示页面(当前页面)被设置为不可关闭
  • -
  • 在实际项目中,标签页会自动与路由系统集成
  • -
-
-
- ); -} \ No newline at end of file diff --git a/src/pages/work_order/modals/WorkOrderCreate.tsx b/src/pages/work_order/modals/WorkOrderCreate.tsx index e8ce280..e45d8b2 100644 --- a/src/pages/work_order/modals/WorkOrderCreate.tsx +++ b/src/pages/work_order/modals/WorkOrderCreate.tsx @@ -45,19 +45,12 @@ export default function WorkOrderCreate(props: MyBetaModalFormProps) { required: true, }), - { - key: 'title', - title: '工单标题', - colProps: { span: 18 }, - formItemProps: { ...rulesHelper.text }, - }, - MyFormItems.EnumSelect({ - key: 'level', - title: '优先级', - colProps: { span: 6 }, - valueEnum: HouseWorkOrdersLevelEnum, - required: true, - }), + // { + // key: 'title', + // title: '工单标题', + // colProps: { span: 18 }, + // formItemProps: { ...rulesHelper.text }, + // }, { key: 'content', title: '工单描述', @@ -68,7 +61,13 @@ export default function WorkOrderCreate(props: MyBetaModalFormProps) { placeholder: '请详细描述工单内容', }, }, - + MyFormItems.EnumRadio({ + key: 'level', + title: '优先级', + colProps: { span: 24 }, + valueEnum: HouseWorkOrdersLevelEnum, + required: true, + }), { valueType: 'dependency', name: ['asset_projects_id', 'asset_buildings_id', 'asset_units_id'], @@ -147,7 +146,7 @@ export default function WorkOrderCreate(props: MyBetaModalFormProps) { { key: 'reporter_phone', title: '上报人手机', - formItemProps: { ...rulesHelper.phone }, + // formItemProps: { ...rulesHelper.phone }, colProps: { span: 12 }, fieldProps: { placeholder: '请输入手机号码',