From b1e639e2a86bbea6a3d4a48c842ea5ca78c818ae Mon Sep 17 00:00:00 2001 From: uiuJun <> Date: Thu, 17 Jul 2025 13:58:54 +0800 Subject: [PATCH] fix --- src/components/Address.tsx | 7 +- src/components/Select.tsx | 71 +++++++- src/gen/ApiTypes.d.ts | 37 ++++- src/gen/Apis.ts | 18 +++ src/gen/Enums.ts | 9 +- .../asset_house/modals/AddOccupant.tsx | 2 +- .../modals/{Add.tsx => AddOwner.tsx} | 15 ++ .../asset_house/modals/OccupantsUpdate.tsx | 145 +++++++++++++++++ .../archive/asset_house/modals/Update.tsx | 151 ------------------ .../asset_house/table/OccupantsNow.tsx | 11 +- .../components/AssetAccounts.tsx | 7 +- .../asset_projects/components/AssetGrid.tsx | 2 +- src/pages/asset/asset_projects/index.tsx | 53 +++--- .../modals/AssetAccountsSelect.tsx | 8 +- .../asset_projects/modals/GridCreate.tsx | 4 +- .../asset_projects/modals/GridMannger.tsx | 6 +- .../asset_projects/modals/GridUpdate.tsx | 12 +- .../companies/components/Organizations.tsx | 7 + src/pages/company/companies/modals/Create.tsx | 2 +- .../companies/modals/EmployeesUpdate.tsx | 3 + .../companies/modals/OrganizationsChange.tsx | 49 ++++++ .../companies/modals/OrganizationsCreate.tsx | 3 +- .../companies/modals/OrganizationsUpdate.tsx | 15 +- .../companies/modals/PositionsCreate.tsx | 13 +- .../companies/modals/PositionsUpdate.tsx | 4 +- src/pages/company/companies/modals/Update.tsx | 14 +- src/pages/house_bills/modals/Create.tsx | 35 +++- 27 files changed, 462 insertions(+), 241 deletions(-) rename src/pages/archive/asset_house/modals/{Add.tsx => AddOwner.tsx} (91%) create mode 100644 src/pages/archive/asset_house/modals/OccupantsUpdate.tsx delete mode 100644 src/pages/archive/asset_house/modals/Update.tsx create mode 100644 src/pages/company/companies/modals/OrganizationsChange.tsx diff --git a/src/components/Address.tsx b/src/components/Address.tsx index 44ab41c..14b6f5f 100644 --- a/src/components/Address.tsx +++ b/src/components/Address.tsx @@ -1,4 +1,3 @@ -import { rulesHelper } from '@/common'; import { ProColumns, ProFormCascader, @@ -46,9 +45,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/Select.tsx b/src/components/Select.tsx index 00512e2..5ff8d05 100644 --- a/src/components/Select.tsx +++ b/src/components/Select.tsx @@ -110,7 +110,42 @@ export const Selects = { }, }; }, + // 单元下拉框 + GridUnits(props?: PropsType): ReturnType { + const { + title = '单元', + key = 'asset_buildings_id', + required = false, + hideInTable = true, + ...rest + } = props ?? {}; + return { + title: title, + key: key, + valueType: 'select', + hideInTable: hideInTable, + formItemProps: { ...(required ? rulesHelper.number : {}) }, + request: async (params) => + ( + await Apis.Asset.AssetUnits.GridSelect({ + keywords: params?.KeyWords, + asset_projects_id: params?.asset_projects_id, + asset_buildings_id: params?.asset_buildings_id, + ...params, + }) + ).data, + ...rest, + fieldProps: { + showSearch: true, + fieldNames: { + label: 'label', + value: 'value', + }, + ...rest?.fieldProps, + }, + }; + }, //网格标识 GetGridMark(props?: PropsType): ReturnType { const { @@ -194,7 +229,7 @@ export const Selects = { return { title: title, key: key, - valueType: 'treeSelect', + valueType: 'cascader', hideInTable: hideInTable, formItemProps: { ...(required ? rulesHelper.number : {}) }, request: async (params) => @@ -208,6 +243,7 @@ export const Selects = { ...rest, fieldProps: { showSearch: true, + changeOnSelect: true, fieldNames: { label: 'name', value: 'id', @@ -319,6 +355,39 @@ export const Selects = { }, }; }, + ProjectAccounts(props?: PropsType): ReturnType { + const { + title = '收款账户', + key = 'company_receipt_accounts_id', + required = false, + hideInTable = true, + ...rest + } = props ?? {}; + + return { + title: title, + key: key, + valueType: 'select', + hideInTable: hideInTable, + formItemProps: { ...(required ? rulesHelper.number : {}) }, + request: async (params) => + ( + await Apis.Company.CompanyProjectReceiptAccounts.Select({ + keywords: params?.KeyWords, + ...params, + }) + ).data, + ...rest, + fieldProps: { + showSearch: true, + fieldNames: { + label: 'label', + value: 'value', + }, + ...rest?.fieldProps, + }, + }; + }, //房屋 AssetHouses(props?: PropsType): ReturnType { const { diff --git a/src/gen/ApiTypes.d.ts b/src/gen/ApiTypes.d.ts index 02bcd9c..3c43d21 100644 --- a/src/gen/ApiTypes.d.ts +++ b/src/gen/ApiTypes.d.ts @@ -5,9 +5,30 @@ declare namespace ApiTypes { "asset_houses_id"?: number; // 资产房屋ID "status"?: string; // 状态,[enum:HouseOccupantsStatusEnum] }; + type Update = { + "id": number; // id + "name": string; // 客户姓名 + "phone": string; // 客户手机号 + "reserve_phone"?: string; // 备用电话 + "card_type"?: string; // 证件类型,[enum:HouseOccupantsCardTypeEnum] + "id_card"?: string; // 客户身份证号 + "card_front_image"?: string[]; // 身份证正面图片 + "card_back_image"?: string[]; // 身份证反面图片 + "address"?: string; // 客户地址 + "ownership_info"?: string[]; // 产权信息 + "house_relation"?: string; // 房客关系,[enum:HouseOccupantsHouseRelationEnum] + "relation_with_owner"?: string; // 与产权人关系,[enum:HouseOccupantsRelationWithOwnerEnum] + "is_live_in"?: number; // 是否在居住中 + "move_in_date"?: Date; // 入住时间 + "status"?: string; // 状态,[enum:HouseOccupantsStatusEnum] + "unbound_time"?: Date; // 解绑时间 + }; type Show = { "id": number; // id }; + type Delete = { + "id": number; // id + }; } namespace HouseRegisters { type List = { @@ -28,13 +49,18 @@ declare namespace ApiTypes { type Update = { "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 MoveOut = { + "house_occupants_id": number; // 房客id + }; + type RemoveOwner = { + "house_occupants_id": number; // 房客id + }; type Show = { "id": number; // id }; @@ -255,6 +281,11 @@ declare namespace ApiTypes { "asset_buildings_id"?: number; // 所属楼栋id,[ref:asset_buildings] "keywords"?: string; // 关键词 }; + type GridSelect = { + "asset_projects_id"?: number; // 所属项目id,[ref:asset_projects] + "asset_buildings_id"?: number; // 所属楼栋id,[ref:asset_buildings] + "keywords"?: string; // 关键词 + }; } } namespace Bill { @@ -513,6 +544,10 @@ declare namespace ApiTypes { type Delete = { "id": number; // id }; + type Select = { + "companies_id"?: number; // 所属机构id,[ref:companies] + "projects_id"?: number; // 所属项目id,[ref:asset_projects] + }; } namespace CompanyReceiptAccounts { type List = { diff --git a/src/gen/Apis.ts b/src/gen/Apis.ts index 54770a5..c5816da 100644 --- a/src/gen/Apis.ts +++ b/src/gen/Apis.ts @@ -7,9 +7,15 @@ export const Apis = { List(data?: ApiTypes.Archive.HouseOccupants.List): Promise { return request('admin/archive/house_occupants/list', { data }); }, + Update(data: ApiTypes.Archive.HouseOccupants.Update): Promise { + return request('admin/archive/house_occupants/update', { data }); + }, Show(data: ApiTypes.Archive.HouseOccupants.Show): Promise { return request('admin/archive/house_occupants/show', { data }); }, + Delete(data: ApiTypes.Archive.HouseOccupants.Delete): Promise { + return request('admin/archive/house_occupants/delete', { data }); + }, }, HouseRegisters: { List(data?: ApiTypes.Archive.HouseRegisters.List): Promise { @@ -21,6 +27,12 @@ export const Apis = { Update(data: ApiTypes.Archive.HouseRegisters.Update): Promise { return request('admin/archive/house_registers/update', { data }); }, + MoveOut(data: ApiTypes.Archive.HouseRegisters.MoveOut): Promise { + return request('admin/archive/house_registers/move_out', { data }); + }, + RemoveOwner(data: ApiTypes.Archive.HouseRegisters.RemoveOwner): Promise { + return request('admin/archive/house_registers/remove_owner', { data }); + }, Show(data: ApiTypes.Archive.HouseRegisters.Show): Promise { return request('admin/archive/house_registers/show', { data }); }, @@ -127,6 +139,9 @@ export const Apis = { Select(data?: ApiTypes.Asset.AssetUnits.Select): Promise { return request('admin/asset/asset_units/select', { data }); }, + GridSelect(data?: ApiTypes.Asset.AssetUnits.GridSelect): Promise { + return request('admin/asset/asset_units/grid_select', { data }); + }, }, }, Bill: { @@ -285,6 +300,9 @@ export const Apis = { Delete(data: ApiTypes.Company.CompanyProjectReceiptAccounts.Delete): Promise { return request('admin/company/company_project_receipt_accounts/delete', { data }); }, + Select(data?: ApiTypes.Company.CompanyProjectReceiptAccounts.Select): Promise { + return request('admin/company/company_project_receipt_accounts/select', { data }); + }, }, CompanyReceiptAccounts: { List(data?: ApiTypes.Company.CompanyReceiptAccounts.List): Promise { diff --git a/src/gen/Enums.ts b/src/gen/Enums.ts index e701d18..3c399c5 100644 --- a/src/gen/Enums.ts +++ b/src/gen/Enums.ts @@ -96,7 +96,7 @@ export const AssetUnitsBuildingTypeEnum= { // 缓存类型 export const CacheTypeEnum= { - 'MobilePhoneVerificationCode': {"text":"手机验证码","color":"#50ae15","value":"MobilePhoneVerificationCode"}, + 'MobilePhoneVerificationCode': {"text":"手机验证码","color":"#6c905c","value":"MobilePhoneVerificationCode"}, }; // CompaniesMerchantTypeEnum @@ -223,6 +223,13 @@ export const HouseRegistersHouseStatusEnum= { 'Vacant': {"text":"空置","color":"#dc3545","value":"Vacant"}, }; +// 房屋登记身份类型 +export const HouseRegistersIdentityTypeEnum= { + 'Owner': {"text":"产权人","color":"#2db7f5","value":"Owner"}, + 'Tenant': {"text":"租客","color":"#87d068","value":"Tenant"}, + 'CoResident': {"text":"同住人(亲属)","color":"#108ee9","value":"CoResident"}, +}; + // HouseRegistersStatusEnum export const HouseRegistersStatusEnum= { 'Pending': {"text":"待审","color":"#faad14","value":"Pending"}, diff --git a/src/pages/archive/asset_house/modals/AddOccupant.tsx b/src/pages/archive/asset_house/modals/AddOccupant.tsx index 82fc9a3..f1d4388 100644 --- a/src/pages/archive/asset_house/modals/AddOccupant.tsx +++ b/src/pages/archive/asset_house/modals/AddOccupant.tsx @@ -79,7 +79,7 @@ export default function Create(props: MyBetaModalFormProps) { columns: [ MyFormItems.EnumRadio({ key: 'house_relation', - title: '住户类型', + title: '房客关系', colProps: { span: 4 }, valueEnum: () => { let obj: any = JSON.parse( diff --git a/src/pages/archive/asset_house/modals/Add.tsx b/src/pages/archive/asset_house/modals/AddOwner.tsx similarity index 91% rename from src/pages/archive/asset_house/modals/Add.tsx rename to src/pages/archive/asset_house/modals/AddOwner.tsx index 776332e..d6a9e32 100644 --- a/src/pages/archive/asset_house/modals/Add.tsx +++ b/src/pages/archive/asset_house/modals/AddOwner.tsx @@ -8,6 +8,7 @@ import { import { Apis } from '@/gen/Apis'; import { HouseOccupantsCardTypeEnum, + HouseOccupantsHouseRelationEnum, HouseRegistersCustomerTypeEnum, } from '@/gen/Enums'; import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; @@ -44,6 +45,20 @@ export default function Create(props: MyBetaModalFormProps) { .catch(() => false) } columns={[ + MyFormItems.EnumRadio({ + key: 'house_relation', + title: '住户类型', + colProps: { span: 6 }, + valueEnum: () => { + let obj: any = JSON.parse( + JSON.stringify(HouseOccupantsHouseRelationEnum), + ); + delete obj.Resident; + delete obj.Tenant; + return obj; + }, + required: true, + }), MyFormItems.EnumRadio({ key: 'customer_type', title: '客户类型', diff --git a/src/pages/archive/asset_house/modals/OccupantsUpdate.tsx b/src/pages/archive/asset_house/modals/OccupantsUpdate.tsx new file mode 100644 index 0000000..88d8bcc --- /dev/null +++ b/src/pages/archive/asset_house/modals/OccupantsUpdate.tsx @@ -0,0 +1,145 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + HouseOccupantsHouseRelationEnum, + HouseOccupantsRelationWithOwnerEnum, +} from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + + return ( + + {...MyModalFormProps.props} + form={form} + title={`编辑`} + wrapperCol={{ span: 24 }} + width="600px" + trigger={} + onOpenChange={(open: any) => { + if (open) { + form.setFieldsValue(props?.item); // 编辑赋值 + } + }} + onFinish={async (values) => + Apis.Archive.HouseOccupants.Update({ + ...values, + id: props?.item?.id, + }) + .then(() => { + props.reload?.(); + message.success('楼栋编辑成功'); + return true; + }) + .catch(() => false) + } + 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; + return obj; + }, + required: true, + }), + { + name: ['house_relation'], + valueType: 'dependency', + columns: ({ house_relation }: any) => { + return house_relation === 'Resident' + ? [ + MyFormItems.EnumRadio({ + key: 'relation_with_owner', + title: '与产权人关系', + colProps: { span: 18 }, + valueEnum: () => { + let obj: any = JSON.parse( + JSON.stringify(HouseOccupantsRelationWithOwnerEnum), + ); + delete obj.Self; + return obj; + }, + required: true, + }), + ] + : [ + MyFormItems.EnumRadio({ + key: 'relation_with_owner', + title: '与租客关系', + colProps: { span: 18 }, + valueEnum: () => { + let obj: any = JSON.parse( + JSON.stringify(HouseOccupantsRelationWithOwnerEnum), + ); + delete obj.ContactPerson; + return obj; + }, + required: true, + }), + ]; + }, + }, + + { + title: '姓名', + dataIndex: 'name', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '手机号', + dataIndex: 'phone', + colProps: { span: 12 }, + fieldProps: { + maxLength: 11, + }, + formItemProps: { ...rulesHelper.phone }, + }, + { + title: '是否入住', + dataIndex: 'is_live_in', + colProps: { span: 12 }, + 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: 12 }, + fieldProps: { + style: { width: '100%' }, + }, + formItemProps: { ...rulesHelper.text }, + }, + ] + : [,]; + }, + }, + ], + }, + ]} + /> + ); +} diff --git a/src/pages/archive/asset_house/modals/Update.tsx b/src/pages/archive/asset_house/modals/Update.tsx deleted file mode 100644 index b5d92cf..0000000 --- a/src/pages/archive/asset_house/modals/Update.tsx +++ /dev/null @@ -1,151 +0,0 @@ -import { - MyBetaModalFormProps, - MyButtons, - MyFormItems, - MyModalFormProps, - rulesHelper, -} from '@/common'; -import { Address } from '@/components/Address'; -import { Selects } from '@/components/Select'; -import { Apis } from '@/gen/Apis'; -import { - AssetProjectsChargeEnum, - AssetProjectsEntrustTypeEnum, - AssetProjectsPropertyTypeEnum, - AssetProjectsStatusEnum, -} from '@/gen/Enums'; -import { BetaSchemaForm } from '@ant-design/pro-components'; -import { message } from 'antd'; - -export default function Update(props: MyBetaModalFormProps) { - return ( - - {...MyModalFormProps.props} - title={`编辑${props.title}`} - trigger={} - wrapperCol={{ span: 24 }} - width="800px" - request={() => - Promise.resolve({ - ...props.item, - casacader: [ - props.item?.province_id || '', - props.item?.city_id || '', - props.item?.area_id || '', - props.item?.street_id || '', - ], - }) - } - onFinish={async (values) => - Apis.Archive.HouseRegisters.Update({ - ...values, - id: props.item?.id ?? 0, - }) - .then(() => { - props.reload?.(); - message.success(props.title + '成功'); - return true; - }) - .catch(() => false) - } - columns={[ - { - key: 'name', - title: '项目名称', - colProps: { span: 12 }, - formItemProps: { ...rulesHelper.text }, - }, - { - key: 'alias_name', - title: '项目别名', - colProps: { span: 6 }, - }, - Selects?.Companies({ - key: 'companies_id', - title: '所属机构', - colProps: { span: 6 }, - formItemProps: { ...rulesHelper.number }, - }), - // { - // key: 'code', - // title: '项目编码', - // colProps: { span: 8 }, - // formItemProps: { ...rulesHelper.text }, - // }, - Address.Cascader({ - key: 'casacader', - title: '选择地址', - colProps: { span: 12 }, - keys: ['province', 'city', 'area', 'street'], - required: true, - }), - { - key: 'address', - title: '详细地址', - colProps: { span: 6 }, - formItemProps: { ...rulesHelper.text }, - }, - { - key: 'longitude', - title: '经度', - colProps: { span: 3 }, - }, - { - key: 'latitude', - title: '纬度', - colProps: { span: 3 }, - }, - MyFormItems.EnumSelect({ - key: 'property_type', - title: '项目类型', - colProps: { span: 6 }, - valueEnum: AssetProjectsPropertyTypeEnum, - // required: true, - }), - MyFormItems.EnumSelect({ - key: 'status', - title: '项目状态', - colProps: { span: 6 }, - valueEnum: AssetProjectsStatusEnum, - // required: true, - }), - MyFormItems.EnumSelect({ - key: 'entrust_type', - title: '委托类型', - colProps: { span: 6 }, - valueEnum: AssetProjectsEntrustTypeEnum, - // required: true, - }), - MyFormItems.EnumRadio({ - key: 'charge', - title: '收费方式', - colProps: { span: 6 }, - valueEnum: AssetProjectsChargeEnum, - // required: true, - }), - { - key: 'takeover_date', - title: '接管日期', - valueType: 'date', - fieldProps: { - style: { - width: '100%', - }, - }, - colProps: { span: 6 }, - }, - { - key: 'closure_date', - title: '封园日期', - valueType: 'date', - fieldProps: { - style: { - width: '100%', - }, - }, - colProps: { span: 6 }, - }, - ]} - /> - ); -} diff --git a/src/pages/archive/asset_house/table/OccupantsNow.tsx b/src/pages/archive/asset_house/table/OccupantsNow.tsx index efe1722..1b66f93 100644 --- a/src/pages/archive/asset_house/table/OccupantsNow.tsx +++ b/src/pages/archive/asset_house/table/OccupantsNow.tsx @@ -8,10 +8,11 @@ import { import { ProTable } from '@ant-design/pro-components'; import { Space } from 'antd'; import { useEffect, useRef } from 'react'; -import Add from '../modals/Add'; import AddOccupant from '../modals/AddOccupant'; +import AddOwner from '../modals/AddOwner'; import MoveIn from '../modals/MoveIn'; import MoveOut from '../modals/MoveOut'; +import OccupantsUpdate from '../modals/OccupantsUpdate'; import Transfer from '../modals/Transfer'; export default function Index({ ...rest }) { @@ -37,7 +38,7 @@ export default function Index({ ...rest }) { ) } toolBarRender={(action) => [ - ( - {/* */} + {item?.house_relation !== 'Owner' && ( + + )} {item?.is_live_in && ( )} diff --git a/src/pages/asset/asset_projects/components/AssetAccounts.tsx b/src/pages/asset/asset_projects/components/AssetAccounts.tsx index a8c1a61..0ec99af 100644 --- a/src/pages/asset/asset_projects/components/AssetAccounts.tsx +++ b/src/pages/asset/asset_projects/components/AssetAccounts.tsx @@ -36,8 +36,11 @@ export default function ReceiptAccounts(props: MyBetaModalFormProps) { ]} // options={false} columns={[ - MyColumns.ID(), - + { + title: '配置id', + dataIndex: 'id', + // width: 360, + }, { title: '收款账号名称', dataIndex: ['receipt_account', 'company_name'], diff --git a/src/pages/asset/asset_projects/components/AssetGrid.tsx b/src/pages/asset/asset_projects/components/AssetGrid.tsx index aba40f6..7dab76b 100644 --- a/src/pages/asset/asset_projects/components/AssetGrid.tsx +++ b/src/pages/asset/asset_projects/components/AssetGrid.tsx @@ -59,7 +59,7 @@ export default function Index({ ...rest }) { - Apis.Asset.AssetBuildings.Delete({ id: item.id }).then(() => + Apis.Grid.Grids.Delete({ id: item.id }).then(() => action?.reload(), ) } diff --git a/src/pages/asset/asset_projects/index.tsx b/src/pages/asset/asset_projects/index.tsx index 8510876..6c77655 100644 --- a/src/pages/asset/asset_projects/index.tsx +++ b/src/pages/asset/asset_projects/index.tsx @@ -5,12 +5,7 @@ import { MyProTableProps, } from '@/common'; import { Apis } from '@/gen/Apis'; -import { - AssetProjectsChargeEnum, - AssetProjectsEntrustTypeEnum, - AssetProjectsPropertyTypeEnum, - AssetProjectsStatusEnum, -} from '@/gen/Enums'; +import { AssetProjectsPropertyTypeEnum } from '@/gen/Enums'; import { ProTable } from '@ant-design/pro-components'; import { Space } from 'antd'; import { useNavigate } from 'react-router-dom'; @@ -41,14 +36,9 @@ export default function Index({ title = '项目管理' }) { title: '项目名称', dataIndex: 'name', }, - { - title: '项目别名', - dataIndex: 'alias_name', - }, // { - // title: '项目编码', - // dataIndex: 'code', - // search: false, + // title: '项目别名', + // dataIndex: 'alias_name', // }, { title: '地址', @@ -59,25 +49,24 @@ export default function Index({ title = '项目管理' }) { }, search: false, }, - MyColumns.EnumTag({ - title: '项目状态', - dataIndex: 'status', - valueEnum: AssetProjectsStatusEnum, - search: false, - }), - - MyColumns.EnumTag({ - title: '委托类型', - dataIndex: 'entrust_type', - valueEnum: AssetProjectsEntrustTypeEnum, - search: false, - }), - MyColumns.EnumTag({ - title: '收费方式', - dataIndex: 'charge', - valueEnum: AssetProjectsChargeEnum, - search: false, - }), + // MyColumns.EnumTag({ + // title: '项目状态', + // dataIndex: 'status', + // valueEnum: AssetProjectsStatusEnum, + // search: false, + // }), + // MyColumns.EnumTag({ + // title: '委托类型', + // dataIndex: 'entrust_type', + // valueEnum: AssetProjectsEntrustTypeEnum, + // search: false, + // }), + // MyColumns.EnumTag({ + // title: '收费方式', + // dataIndex: 'charge', + // valueEnum: AssetProjectsChargeEnum, + // search: false, + // }), MyColumns.SoftDelete({ title: '启/禁用', onRestore: Apis.Asset.AssetProjects.Restore, diff --git a/src/pages/asset/asset_projects/modals/AssetAccountsSelect.tsx b/src/pages/asset/asset_projects/modals/AssetAccountsSelect.tsx index e1f3662..8b8c9a3 100644 --- a/src/pages/asset/asset_projects/modals/AssetAccountsSelect.tsx +++ b/src/pages/asset/asset_projects/modals/AssetAccountsSelect.tsx @@ -14,17 +14,18 @@ export default function Index(props: MyBetaModalFormProps) { const [selectedProjectsIds, setSelectedProjectsIds] = useState([]); const onShowContactPhone = () => { Apis.Company.CompanyProjectReceiptAccounts.Store({ - companies_id: props?.item?.id ?? 0, + companies_id: props?.item?.companies_id ?? 0, projects_id: props?.item?.id, receipt_accounts_id: selectedProjectsIds[0], }) .then(() => { props.reload?.(); - message.success('添加成功!'); + message.success('收款账号添加成功!'); + // todo 关闭页面 }) .catch(() => false); }; - + console.log(props?.item, '0000'); return ( { props.reload?.(); - message.success(props.title + '成功'); + message.success('网格创建成功'); return true; }) .catch(() => false); @@ -105,7 +105,7 @@ export default function Create(props: MyBetaModalFormProps) { }, }, }), - Selects?.AssetUnits({ + Selects?.GridUnits({ key: 'asset_units_id', title: '选择单元', params: { diff --git a/src/pages/asset/asset_projects/modals/GridMannger.tsx b/src/pages/asset/asset_projects/modals/GridMannger.tsx index 6f444be..338e557 100644 --- a/src/pages/asset/asset_projects/modals/GridMannger.tsx +++ b/src/pages/asset/asset_projects/modals/GridMannger.tsx @@ -13,7 +13,6 @@ export default function Create( props: { buttonProps?: ButtonProps } & MyBetaModalFormProps, ) { const [form] = Form.useForm(); - return ( {...MyModalFormProps.props} @@ -27,13 +26,10 @@ export default function Create( if (open && props.item) { // 获取详情数据 Apis.Grid.Grids.Show({ - id: props?.item?.companies_id, + id: props?.item?.id, }).then((res) => { form.setFieldsValue({ ...res.data, - company_employees_id: res.data.company_has_managements?.map( - (item: any) => item.company_employees_id, - ), }); }); } diff --git a/src/pages/asset/asset_projects/modals/GridUpdate.tsx b/src/pages/asset/asset_projects/modals/GridUpdate.tsx index 5d83314..46a569a 100644 --- a/src/pages/asset/asset_projects/modals/GridUpdate.tsx +++ b/src/pages/asset/asset_projects/modals/GridUpdate.tsx @@ -11,11 +11,11 @@ import { Form, message } from 'antd'; export default function Update(props: MyBetaModalFormProps) { const [form] = Form.useForm(); - + console.log(props.item, 'pppp'); return ( {...MyModalFormProps.props} - title={`编辑`} + title={`网格编辑`} wrapperCol={{ span: 24 }} width="700px" trigger={} @@ -37,7 +37,7 @@ export default function Update(props: MyBetaModalFormProps) { }) .then(() => { props.reload?.(); - message.success('单元编辑成功'); + message.success('网格编辑成功'); return true; }) .catch(() => false); @@ -93,7 +93,7 @@ export default function Update(props: MyBetaModalFormProps) { key: 'asset_buildings_id', title: '选择楼栋', params: { - asset_projects_id: props?.item?.id, + asset_projects_id: props?.item?.asset_projects_id, }, colProps: { span: 12 }, formItemProps: { ...rulesHelper.number }, @@ -107,11 +107,11 @@ export default function Update(props: MyBetaModalFormProps) { }, }, }), - Selects?.AssetUnits({ + Selects?.GridUnits({ key: 'asset_units_id', title: '选择单元', params: { - asset_projects_id: props?.item?.id, + asset_projects_id: props?.item?.asset_projects_id, asset_buildings_id: asset_buildings_id, }, colProps: { span: 12 }, diff --git a/src/pages/company/companies/components/Organizations.tsx b/src/pages/company/companies/components/Organizations.tsx index ec6b387..2acb90b 100644 --- a/src/pages/company/companies/components/Organizations.tsx +++ b/src/pages/company/companies/components/Organizations.tsx @@ -8,6 +8,7 @@ import { Apis } from '@/gen/Apis'; import { OrganizationsTypeEnum } from '@/gen/Enums'; import { ProTable } from '@ant-design/pro-components'; import { Space } from 'antd'; +import OrganizationsChange from '../modals/OrganizationsChange'; import OrganizationsCreate from '../modals/OrganizationsCreate'; import OrganizationsUpdate from '../modals/OrganizationsUpdate'; @@ -72,11 +73,17 @@ export default function Organizations(props: MyBetaModalFormProps) { MyColumns.Option({ render: (_, item: any, index, action) => ( + + Apis.Company.Organizations.Delete({ id: item.id }).then( diff --git a/src/pages/company/companies/modals/Create.tsx b/src/pages/company/companies/modals/Create.tsx index 0c77ce0..aa7c6fc 100644 --- a/src/pages/company/companies/modals/Create.tsx +++ b/src/pages/company/companies/modals/Create.tsx @@ -71,7 +71,7 @@ export default function Create(props: MyBetaModalFormProps) { fieldProps: { maxLength: 11, }, - formItemProps: { ...rulesHelper.number }, + formItemProps: { ...rulesHelper.phone }, }, { key: 'contact_email', diff --git a/src/pages/company/companies/modals/EmployeesUpdate.tsx b/src/pages/company/companies/modals/EmployeesUpdate.tsx index 9ba5ed2..735fd31 100644 --- a/src/pages/company/companies/modals/EmployeesUpdate.tsx +++ b/src/pages/company/companies/modals/EmployeesUpdate.tsx @@ -76,6 +76,9 @@ export default function Update(props: MyBetaModalFormProps) { params: { companies_id: props?.item?.companies_id }, key: 'positions_id', formItemProps: { ...rulesHelper.text }, + fieldProps: { + showSearch: true, + }, }), // { // key: 'password', diff --git a/src/pages/company/companies/modals/OrganizationsChange.tsx b/src/pages/company/companies/modals/OrganizationsChange.tsx new file mode 100644 index 0000000..12716f9 --- /dev/null +++ b/src/pages/company/companies/modals/OrganizationsChange.tsx @@ -0,0 +1,49 @@ +import { MyBetaModalFormProps, MyButtons, MyModalFormProps } 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={`调整上级${props.title}`} + form={form} + trigger={ + + } + wrapperCol={{ span: 24 }} + width="500px" + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values: any) => + Apis.Company.Organizations.Update({ + ...values, + id: props.item?.id ?? 0, + name: props.item?.name, + type: props.item?.type, + parent_id: values?.parent_id?.[values.parent_id.length - 1], + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + Selects?.OrganizationsTree({ + title: '选择新的上级组织', + key: 'parent_id', + params: { companies_id: props?.item?.companies_id }, + colProps: { span: 24 }, + }), + ]} + /> + ); +} diff --git a/src/pages/company/companies/modals/OrganizationsCreate.tsx b/src/pages/company/companies/modals/OrganizationsCreate.tsx index 69b597b..a8990be 100644 --- a/src/pages/company/companies/modals/OrganizationsCreate.tsx +++ b/src/pages/company/companies/modals/OrganizationsCreate.tsx @@ -27,10 +27,11 @@ export default function Create(props: MyBetaModalFormProps) { form.resetFields(); // 清空表单数据 } }} - onFinish={async (values) => + onFinish={async (values: any) => Apis.Company.Organizations.Store({ ...values, companies_id: props?.item?.id, + parent_id: values?.parent_id?.[values.parent_id.length - 1], }) .then(() => { props.reload?.(); diff --git a/src/pages/company/companies/modals/OrganizationsUpdate.tsx b/src/pages/company/companies/modals/OrganizationsUpdate.tsx index 67ab696..bd88e5c 100644 --- a/src/pages/company/companies/modals/OrganizationsUpdate.tsx +++ b/src/pages/company/companies/modals/OrganizationsUpdate.tsx @@ -5,7 +5,6 @@ import { MyModalFormProps, rulesHelper, } from '@/common'; -import { Selects } from '@/components/Select'; import { Apis } from '@/gen/Apis'; import { OrganizationsTypeEnum } from '@/gen/Enums'; import { BetaSchemaForm } from '@ant-design/pro-components'; @@ -30,7 +29,7 @@ export default function Update(props: MyBetaModalFormProps) { Apis.Company.Organizations.Update({ ...values, id: props.item?.id ?? 0, - parent_id: values?.parent_id ?? 0, + // parent_id: values?.parent_id ?? 0, }) .then(() => { props.reload?.(); @@ -53,12 +52,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 }, - }), + // Selects?.OrganizationsTree({ + // title: '上级组织', + // key: 'parent_id', + // params: { companies_id: props?.item?.companies_id }, + // colProps: { span: 24 }, + // }), ]} /> ); diff --git a/src/pages/company/companies/modals/PositionsCreate.tsx b/src/pages/company/companies/modals/PositionsCreate.tsx index e804c55..1f29172 100644 --- a/src/pages/company/companies/modals/PositionsCreate.tsx +++ b/src/pages/company/companies/modals/PositionsCreate.tsx @@ -6,16 +6,23 @@ import { } from '@/common'; import { Apis } from '@/gen/Apis'; import { BetaSchemaForm } from '@ant-design/pro-components'; -import { message } from 'antd'; +import { Form, message } from 'antd'; export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); return ( {...MyModalFormProps.props} title={`添加岗位`} wrapperCol={{ span: 24 }} width="500px" + form={form} trigger={} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} onFinish={async (values) => Apis.Company.CompanyPositions.Store({ ...values, @@ -37,13 +44,13 @@ export default function Create(props: MyBetaModalFormProps) { { key: 'name', title: '岗位名称', - colProps: { span: 12 }, + colProps: { span: 24 }, formItemProps: { ...rulesHelper.text }, }, { key: 'code', title: '岗位编号', - colProps: { span: 12 }, + colProps: { span: 24 }, // formItemProps: { ...rulesHelper.text }, }, // { diff --git a/src/pages/company/companies/modals/PositionsUpdate.tsx b/src/pages/company/companies/modals/PositionsUpdate.tsx index 3554ad4..59d1ca6 100644 --- a/src/pages/company/companies/modals/PositionsUpdate.tsx +++ b/src/pages/company/companies/modals/PositionsUpdate.tsx @@ -40,13 +40,13 @@ export default function Update(props: MyBetaModalFormProps) { { key: 'name', title: '岗位名称', - colProps: { span: 12 }, + colProps: { span: 24 }, formItemProps: { ...rulesHelper.text }, }, { key: 'code', title: '岗位编号', - colProps: { span: 12 }, + colProps: { span: 24 }, // formItemProps: { ...rulesHelper.text }, }, // { diff --git a/src/pages/company/companies/modals/Update.tsx b/src/pages/company/companies/modals/Update.tsx index e36b4bf..a233c0c 100644 --- a/src/pages/company/companies/modals/Update.tsx +++ b/src/pages/company/companies/modals/Update.tsx @@ -1,13 +1,11 @@ import { MyBetaModalFormProps, MyButtons, - MyFormItems, MyModalFormProps, rulesHelper, } from '@/common'; import { Address } from '@/components/Address'; import { Apis } from '@/gen/Apis'; -import { CompaniesMerchantTypeEnum } from '@/gen/Enums'; import { BetaSchemaForm } from '@ant-design/pro-components'; import { Form, message } from 'antd'; @@ -18,13 +16,7 @@ export default function Update(props: MyBetaModalFormProps) { {...MyModalFormProps.props} title={`编辑${props.title}`} form={form} - trigger={ - - } + trigger={} wrapperCol={{ span: 24 }} width="800px" onOpenChange={(open: any) => { @@ -104,14 +96,14 @@ export default function Update(props: MyBetaModalFormProps) { Address.Cascader({ key: 'casacader', title: '选择地址', - colProps: { span:16 }, + colProps: { span: 16 }, keys: ['province', 'city', 'area', 'street'], required: true, }), { key: 'address', title: '详细地址', - colProps: { span:8 }, + colProps: { span: 8 }, }, ]} /> diff --git a/src/pages/house_bills/modals/Create.tsx b/src/pages/house_bills/modals/Create.tsx index 0a424c0..a16e9af 100644 --- a/src/pages/house_bills/modals/Create.tsx +++ b/src/pages/house_bills/modals/Create.tsx @@ -149,7 +149,7 @@ export default function Create(props: MyBetaModalFormProps) { fieldProps: { picker: 'month', format: 'YYYY-MM', - valueFormat: 'YYYY-MM', + valueFormat: 'YYYY-MM-01', style: { width: '100%', }, @@ -178,7 +178,40 @@ export default function Create(props: MyBetaModalFormProps) { width: '100%', }, }, + formItemProps: { ...rulesHelper.text }, }, + { + valueType: 'dependency', + name: ['asset_projects_id'], + columns: ({ asset_projects_id }) => { + return [ + { + valueType: 'group', + columns: [ + Selects?.ProjectAccounts({ + key: 'company_receipt_accounts_id', + title: '选择收款账户', + params: { + projects_id: asset_projects_id, + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + showSearch: true, + onChange: () => { + form.setFieldsValue({ + asset_units_id: undefined, + asset_floors_id: undefined, + }); + }, + }, + }), + ], + }, + ]; + }, + }, + { key: 'late_start_date', title: '滞纳金起算日期',