diff --git a/src/common/utils/rulesHelper.ts b/src/common/utils/rulesHelper.ts index e2c27ef..c407cf4 100644 --- a/src/common/utils/rulesHelper.ts +++ b/src/common/utils/rulesHelper.ts @@ -127,4 +127,28 @@ export const rulesHelper = { }), ] as Rule[], }, + + getMonthStartDate(date: string) { + //获取当月的开始日期 + if (date) { + const targetDate = new Date(date); + // 设置为当月第一天 + targetDate.setDate(1); + return targetDate.toISOString().split('T')[0]; + } else { + return undefined; + } + }, + getMonthEndDate(date: string) { + //获取当月的结束日期 + if (date) { + const targetDate = new Date(date); + // 设置为下个月第一天,然后减去一天得到当月最后一天 + targetDate.setMonth(targetDate.getMonth() + 1, 1); + targetDate.setDate(targetDate.getDate() - 1); + return targetDate.toISOString().split('T')[0]; + } else { + return undefined; + } + }, }; diff --git a/src/components/Select.tsx b/src/components/Select.tsx index ea73717..b6d129a 100644 --- a/src/components/Select.tsx +++ b/src/components/Select.tsx @@ -381,7 +381,7 @@ export const Selects = { }); res?.data?.map((l: any) => { l.label = - l.company_name + '-' + l.company_bank + '-' + l.company_account; + l.company_name + '_' + l.company_bank + '_' + l.company_account; }); return res?.data; }, diff --git a/src/components/TransferUnits.tsx b/src/components/TransferUnits.tsx index 08b7ad7..6167b8f 100644 --- a/src/components/TransferUnits.tsx +++ b/src/components/TransferUnits.tsx @@ -9,6 +9,7 @@ const MyTransferUnits = (props: any) => { if (props?.item?.asset_projects_id) { Apis.Asset.AssetUnits.GridSelect({ asset_projects_id: props?.item?.asset_projects_id, + type: props?.item?.type, }) .then((res) => { setLoading(true); diff --git a/src/gen/ApiTypes.d.ts b/src/gen/ApiTypes.d.ts index df54f66..9f5efbf 100644 --- a/src/gen/ApiTypes.d.ts +++ b/src/gen/ApiTypes.d.ts @@ -292,6 +292,7 @@ declare namespace ApiTypes { }; type Select = { "keywords"?: string; // 关键词 + "companies_id"?: number; // 机构id }; } namespace AssetUnits { @@ -338,6 +339,7 @@ declare namespace ApiTypes { "asset_projects_id"?: number; // 所属项目id,[ref:asset_projects] "asset_buildings_id"?: number; // 所属楼栋id,[ref:asset_buildings] "keywords"?: string; // 关键词 + "type"?: number; // 类型:1, 排除已添加的 }; } } @@ -700,6 +702,9 @@ declare namespace ApiTypes { "organizations_id"?: number; // 所属组织id,[ref:organizations] "keywords"?: string; // 关键词 }; + type Import = { + "upload_file": mimes:xlsx,xls; // 上传文件 + }; } namespace CompanyPositions { type List = { @@ -896,6 +901,101 @@ declare namespace ApiTypes { } } namespace Customer { + namespace CustomerMomentCategories { + type List = { + "name"?: string; // 模糊搜索:名称 + "parent_id"?: number; // 父级ID + }; + type Store = { + "name": string; // 分类名称 + "is_use"?: number; // 是否启用:0=禁用,1=启用 + "parent_id"?: number; // 父级id,[ref:customer_moment_categories] + }; + type Update = { + "id": number; // id + "name": string; // 分类名称 + "is_use"?: number; // 是否启用:0=禁用,1=启用 + "parent_id"?: number; // + }; + type Show = { + "id": number; // id + }; + type SoftDelete = { + "id": number; // id + }; + type Restore = { + "id": number; // id + }; + type Delete = { + "id": number; // id + }; + type SelectTree = { + "keywords"?: string; // - + "parent_id"?: number; // - + }; + } + namespace CustomerMoments { + type List = { + "admin_name"?: string; // 模糊搜索:创建人名称 + "channel"?: string; // 发送渠道,[enum:CustomerMomentsChannelEnum] + "push_time"?: Date; // 推送时间 + "push_status"?: string; // 推送状态,[enum:CustomerMomentsPushStatusEnum] + "one_moment_categories_id"?: number; // 内容一级分类id,[ref:customer_moment_categories] + "two_moment_categories_id"?: number; // 内容二级分类id,[ref:customer_moment_categories] + "content"?: string; // 模糊搜索:内容 + }; + type Store = { + "channel": string; // 发送渠道,[enum:CustomerMomentsChannelEnum] + "push_type": string; // 推送类型,[enum:CustomerMomentsPushTypeEnum] + "scheduled_time"?: Date; // 定时发送时间 + "task_end_type": string; // 任务结束类型,[enum:CustomerMomentsTaskEndTypeEnum] + "task_days"?: number; // 任务天数 + "task_end_time"?: Date; // 任务结束时间 + "range_type": string; // 范围类型,[enum:CustomerMomentsRangeTypeEnum] + "range_data": string[]; // 范围数据(项目:项目ID,员工:员工ID,部门:部门ID,客户:客户ID) + "content": string; // 内容 + "content_type": string; // 内容类型,[enum:CustomerMomentsContentTypeEnum] + "skip_type"?: string; // 跳转类型,[enum:CustomerMomentsSkipTypeEnum] + "mini_program_app_id"?: string; // 小程序APPID + "skip_url"?: string; // 跳转链接 + "title"?: string; // 跳转标题 + "desc"?: string; // 描述 + "cover_image"?: string[]; // 封面图 + "attachments"?: string[]; // 附件 + "one_moment_categories_id": number; // 内容一级分类id,[ref:customer_moment_categories] + "two_moment_categories_id": number; // 内容二级分类id,[ref:customer_moment_categories] + "companies_id": number; // 公司id,[ref:companies] + }; + type Update = { + "id": number; // id + "channel": string; // 发送渠道,[enum:CustomerMomentsChannelEnum] + "push_type": string; // 推送类型,[enum:CustomerMomentsPushTypeEnum] + "scheduled_time"?: Date; // 定时发送时间 + "task_end_type": string; // 任务结束类型,[enum:CustomerMomentsTaskEndTypeEnum] + "task_days"?: number; // 任务天数 + "task_end_time"?: Date; // 任务结束时间 + "range_type": string; // 范围类型,[enum:CustomerMomentsRangeTypeEnum] + "range_data": string[]; // 范围数据(项目:项目ID,员工:员工ID,部门:部门ID,客户:客户ID) + "content": string; // 内容 + "content_type": string; // 内容类型,[enum:CustomerMomentsContentTypeEnum] + "skip_type"?: string; // 跳转类型,[enum:CustomerMomentsSkipTypeEnum] + "mini_program_app_id"?: string; // 小程序APPID + "skip_url"?: string; // 跳转链接 + "title"?: string; // 跳转标题 + "desc"?: string; // 描述 + "cover_image"?: string[]; // 封面图 + "attachments"?: string[]; // 附件 + "one_moment_categories_id": number; // 内容一级分类id,[ref:customer_moment_categories] + "two_moment_categories_id": number; // 内容二级分类id,[ref:customer_moment_categories] + "companies_id": number; // 公司id,[ref:companies] + }; + type Show = { + "id": number; // id + }; + type Send = { + "id": number; // id + }; + } namespace CustomerOpinions { type List = { "type"?: string; // 类型,[enum:CustomerOpinionsTypeEnum] @@ -975,6 +1075,7 @@ declare namespace ApiTypes { "charge_type": string; // 收费类型,[enum:HouseBillsTypeEnum] "calculation_mode": string; // 计费模式,[enum:HouseChargeStandardsCalculationModeEnum] "calculation_method": string; // 计量方式,[enum:HouseChargeStandardsCalculationMethodEnum] + "company_receipt_accounts_id": number; // 收款账户id,[ref:company_receipt_accounts] "price_algorithm": string; // 单价算法,[enum:HouseChargeStandardsPriceAlgorithmEnum] "price"?: number; // 单价 "calculation_period"?: string; // 计费周期,[enum:HouseChargeStandardsCalculationPeriodEnum] @@ -999,6 +1100,7 @@ declare namespace ApiTypes { "charge_type": string; // 收费类型,[enum:HouseBillsTypeEnum] "calculation_mode": string; // 计费模式,[enum:HouseChargeStandardsCalculationModeEnum] "calculation_method": string; // 计量方式,[enum:HouseChargeStandardsCalculationMethodEnum] + "company_receipt_accounts_id": number; // 收款账户id,[ref:company_receipt_accounts] "price_algorithm": string; // 单价算法,[enum:HouseChargeStandardsPriceAlgorithmEnum] "price"?: number; // 单价 "calculation_period"?: string; // 计费周期,[enum:HouseChargeStandardsCalculationPeriodEnum] @@ -1128,6 +1230,8 @@ declare namespace ApiTypes { "asset_projects_id": number; // 项目id,[ref:asset_projects] "title": string; // 标题 "content": string; // 内容 + "publish_type": string; // 发布类型,[MsgPropertyAnnouncementsPublishTypeEnum] + "schedule_publish_at"?: Date; // 计划发布时间 "is_publish"?: boolean; // 是否发布 "publish_at"?: Date; // 发布时间 "sort"?: number; // 排序 @@ -1137,6 +1241,8 @@ declare namespace ApiTypes { "asset_projects_id": number; // 项目id,[ref:asset_projects] "title": string; // 标题 "content": string; // 内容 + "publish_type": string; // 发布类型,[MsgPropertyAnnouncementsPublishTypeEnum] + "schedule_publish_at"?: Date; // 计划发布时间 "is_publish"?: boolean; // 是否发布 "publish_at"?: Date; // 发布时间 "sort"?: number; // 排序 diff --git a/src/gen/Apis.ts b/src/gen/Apis.ts index 93433d4..cd98bb9 100644 --- a/src/gen/Apis.ts +++ b/src/gen/Apis.ts @@ -399,6 +399,12 @@ export const Apis = { Select(data?: ApiTypes.Company.CompanyEmployees.Select): Promise { return request('admin/company/company_employees/select', { data }); }, + Import(data: ApiTypes.Company.CompanyEmployees.Import): Promise { + return request('admin/company/company_employees/import', { data }); + }, + DownloadTemplate(): Promise { + return request('admin/company/company_employees/download_template', {responseType: 'blob',}); + }, }, CompanyPositions: { List(data?: ApiTypes.Company.CompanyPositions.List): Promise { @@ -523,6 +529,49 @@ export const Apis = { }, }, Customer: { + CustomerMomentCategories: { + List(data?: ApiTypes.Customer.CustomerMomentCategories.List): Promise { + return request('admin/customer/customer_moment_categories/list', { data }); + }, + Store(data: ApiTypes.Customer.CustomerMomentCategories.Store): Promise { + return request('admin/customer/customer_moment_categories/store', { data }); + }, + Update(data: ApiTypes.Customer.CustomerMomentCategories.Update): Promise { + return request('admin/customer/customer_moment_categories/update', { data }); + }, + Show(data: ApiTypes.Customer.CustomerMomentCategories.Show): Promise { + return request('admin/customer/customer_moment_categories/show', { data }); + }, + SoftDelete(data: ApiTypes.Customer.CustomerMomentCategories.SoftDelete): Promise { + return request('admin/customer/customer_moment_categories/soft_delete', { data }); + }, + Restore(data: ApiTypes.Customer.CustomerMomentCategories.Restore): Promise { + return request('admin/customer/customer_moment_categories/restore', { data }); + }, + Delete(data: ApiTypes.Customer.CustomerMomentCategories.Delete): Promise { + return request('admin/customer/customer_moment_categories/delete', { data }); + }, + SelectTree(data?: ApiTypes.Customer.CustomerMomentCategories.SelectTree): Promise { + return request('admin/customer/customer_moment_categories/select_tree', { data }); + }, + }, + CustomerMoments: { + List(data?: ApiTypes.Customer.CustomerMoments.List): Promise { + return request('admin/customer/customer_moments/list', { data }); + }, + Store(data: ApiTypes.Customer.CustomerMoments.Store): Promise { + return request('admin/customer/customer_moments/store', { data }); + }, + Update(data: ApiTypes.Customer.CustomerMoments.Update): Promise { + return request('admin/customer/customer_moments/update', { data }); + }, + Show(data: ApiTypes.Customer.CustomerMoments.Show): Promise { + return request('admin/customer/customer_moments/show', { data }); + }, + Send(data: ApiTypes.Customer.CustomerMoments.Send): Promise { + return request('admin/customer/customer_moments/send', { data }); + }, + }, CustomerOpinions: { List(data?: ApiTypes.Customer.CustomerOpinions.List): Promise { return request('admin/customer/customer_opinions/list', { data }); diff --git a/src/gen/Enums.ts b/src/gen/Enums.ts index 8e5f44e..7301387 100644 --- a/src/gen/Enums.ts +++ b/src/gen/Enums.ts @@ -126,7 +126,7 @@ export const BannersTypeEnum= { // 缓存类型 export const CacheTypeEnum= { - 'MobilePhoneVerificationCode': {"text":"手机验证码","color":"#1f86c5","value":"MobilePhoneVerificationCode"}, + 'MobilePhoneVerificationCode': {"text":"手机验证码","color":"#69355c","value":"MobilePhoneVerificationCode"}, }; // CompaniesMerchantTypeEnum @@ -189,6 +189,56 @@ export const CustomerBacklogsTypeEnum= { 'ContractTodo': {"text":"合同待办","color":"#722ed1","value":"ContractTodo"}, }; +// CustomerMomentTasksStatusEnum +export const CustomerMomentTasksStatusEnum= { + 'NotSent': {"text":"未发","color":"#FF4500","value":"NotSent"}, + 'Sent': {"text":"已发","color":"#32CD32","value":"Sent"}, +}; + +// CustomerMomentsChannelEnum +export const CustomerMomentsChannelEnum= { + 'MomentCorp': {"text":"朋友圈(企业)","color":"#1E90FF","value":"MomentCorp"}, + 'MomentPersonal': {"text":"朋友圈(个人)","color":"#32CD32","value":"MomentPersonal"}, + 'CustomerDirectCorp': {"text":"客户1对1消息群发(企业)","color":"#FFA500","value":"CustomerDirectCorp"}, + 'CustomerGroupCorp': {"text":"客户群群发(企业)","color":"#FF69B4","value":"CustomerGroupCorp"}, +}; + +// CustomerMomentsContentTypeEnum +export const CustomerMomentsContentTypeEnum= { + 'Image': {"text":"图片消息","color":"#1E90FF","value":"Image"}, + 'Link': {"text":"转载链接消息","color":"#32CD32","value":"Link"}, + 'MiniProgram': {"text":"跳小程序","color":"#FFA500","value":"MiniProgram"}, + 'Video': {"text":"视频消息","color":"#FF69B4","value":"Video"}, +}; + +// CustomerMomentsPushStatusEnum +export const CustomerMomentsPushStatusEnum= { + 'NotPushed': {"text":"未推送","color":"#FF4500","value":"NotPushed"}, + 'Pushed': {"text":"已推送","color":"#32CD32","value":"Pushed"}, +}; + +// CustomerMomentsPushTypeEnum +export const CustomerMomentsPushTypeEnum= { + 'ManualPush': {"text":"手动推送","color":"#1E90FF","value":"ManualPush"}, + 'ScheduledPush': {"text":"定时推送","color":"#32CD32","value":"ScheduledPush"}, +}; + +// CustomerMomentsRangeTypeEnum +export const CustomerMomentsRangeTypeEnum= { + 'Project': {"text":"按项目推送","color":"#1E90FF","value":"Project"}, +}; + +// CustomerMomentsSkipTypeEnum +export const CustomerMomentsSkipTypeEnum= { + 'H5': {"text":"H5","color":"#1E90FF","value":"H5"}, +}; + +// CustomerMomentsTaskEndTypeEnum +export const CustomerMomentsTaskEndTypeEnum= { + 'AfterNDays': {"text":"发送后N天","color":"#1E90FF","value":"AfterNDays"}, + 'ScheduledEnd': {"text":"定时结束","color":"#32CD32","value":"ScheduledEnd"}, +}; + // CustomerOpinionsTypeEnum export const CustomerOpinionsTypeEnum= { 'FeatureException': {"text":"功能异常","color":"#ff0000","value":"FeatureException"}, @@ -468,6 +518,12 @@ export const HouseWorkOrdersTypeEnum= { 'Complaint': {"text":"投诉","color":"#aa00ff","value":"Complaint"}, }; +// MsgPropertyAnnouncementsPublishTypeEnum +export const MsgPropertyAnnouncementsPublishTypeEnum= { + 'Manual': {"text":"手动","color":"#4caf50","value":"Manual"}, + 'Schedule': {"text":"定时","color":"#2196f3","value":"Schedule"}, +}; + // OrganizationsTypeEnum export const OrganizationsTypeEnum= { 'Group': {"text":"集团","color":"#007bff","value":"Group"}, diff --git a/src/pages/archive/index.tsx b/src/pages/archive/index.tsx index 0193f93..c6c8695 100644 --- a/src/pages/archive/index.tsx +++ b/src/pages/archive/index.tsx @@ -133,7 +133,7 @@ export default function Index({ title = '房屋档案' }) { { - navigate(`/archive/${item.id}`); + navigate(`/archive/show/${item.id}`); }} /> {!item?.house_occupants?.length ? ( diff --git a/src/pages/archive/$id.tsx b/src/pages/archive/show/$id.tsx similarity index 91% rename from src/pages/archive/$id.tsx rename to src/pages/archive/show/$id.tsx index 40bb179..7d0c324 100644 --- a/src/pages/archive/$id.tsx +++ b/src/pages/archive/show/$id.tsx @@ -4,10 +4,10 @@ import { ProCard } from '@ant-design/pro-components'; import { useParams } from '@umijs/max'; import { Badge, Tabs } from 'antd'; import { useEffect, useState } from 'react'; -import HouseInfo from './components/HouseInfo'; -import OccupantsHistory from './components/OccupantsHistory'; -import OccupantsNow from './components/OccupantsNow'; -import RegistersList from './components/RegistersList'; +import HouseInfo from '../components/HouseInfo'; +import OccupantsHistory from '../components/OccupantsHistory'; +import OccupantsNow from '../components/OccupantsNow'; +import RegistersList from '../components/RegistersList'; export default function Show({ title = '房屋档案' }) { const { id } = useParams<{ id: string }>(); diff --git a/src/pages/asset/grids/modals/GridCreate copy 2.tsx b/src/pages/asset/grids/modals/GridCreate copy 2.tsx deleted file mode 100644 index c5cf04d..0000000 --- a/src/pages/asset/grids/modals/GridCreate copy 2.tsx +++ /dev/null @@ -1,216 +0,0 @@ -import { - MyBetaModalFormProps, - MyButtons, - MyModalFormProps, - rulesHelper, -} from '@/common'; -import { Selects } from '@/components/Select'; -import { Apis } from '@/gen/Apis'; -import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; -import { Form, message } from 'antd'; -import { useState } from 'react'; - -export default function Create(props: MyBetaModalFormProps) { - const [form] = Form.useForm(); - const [transferData, setTransferData] = useState([]); - const [targetKeys, setTargetKeys] = useState([]); - - // 获取Transfer数据源 - // useEffect(() => { - // const asset_projects_id = props?.item?.id || 0; - // if (asset_projects_id) { - // Apis.Asset.AssetUnits.GridSelect({ asset_projects_id }) - // .then((res) => { - // const data = - // res.data?.map((item: any) => ({ - // key: item.value?.toString(), - // title: item.label, - // description: item.label, - // })) || []; - // setTransferData(data); - // }) - // .catch(() => { - // setTransferData([]); - // }); - // } - // }, [props?.item?.id]); - - return ( - - {...MyModalFormProps.props} - title={`范围添加`} - width="700px" - layout="horizontal" - labelCol={{ span: 4 }} - wrapperCol={{ span: 24 }} - labelAlign="right" - trigger={ - - } - form={form} - key={new Date().getTime()} - onOpenChange={(open: any) => { - if (open) { - form.resetFields(); // 清空表单数据 - form.setFieldsValue({ - asset_projects_id: props?.item?.id, - }); - } - }} - onFinish={async (values: any) => { - (values.asset_projects_id = - values?.asset_projects_id || props?.item?.id), - values?.grid_ranges?.map((res: { asset_projects_id: string }) => { - res.asset_projects_id = props?.item?.id; - }); - return Apis.Grid.Grids.Store({ - ...values, - }) - .then(() => { - props.reload?.(); - message.success('网格添加成功'); - return true; - }) - .catch(() => false); - }} - columns={[ - ...(props?.item?.id - ? [] - : [ - Selects?.AssetProjects({ - key: 'asset_projects_id', - title: '选择项目', - colProps: { span: 24 }, - required: true, - }), - ]), - - { - valueType: 'dependency', - name: ['asset_projects_id'], - columns: ({ asset_projects_id }) => { - return [ - { - valueType: 'group', - columns: [ - Selects?.GetGridMark({ - key: 'grid_mark', - title: '范围标识', - params: { - asset_projects_id: - asset_projects_id || props?.item?.id || 0, - }, - colProps: { span: 24 }, - formItemProps: { ...rulesHelper.text }, - }), - { - valueType: 'formList', - dataIndex: 'grid_ranges', - colProps: { span: 24 }, - initialValue: [''], - formItemProps: { ...rulesHelper.array }, - fieldProps: { - copyIconProps: false, - creatorButtonProps: { - creatorButtonText: '添加楼栋单元', - }, - itemRender: ( - { listDom, action }: any, - { index }: { index: number }, - ) => { - return ( - - {listDom} - - ); - }, - }, - columns: [ - { - valueType: 'dependency', - name: ['asset_buildings_id', 'asset_units_id'], - columns: ({ asset_buildings_id }) => { - return [ - { - valueType: 'group', - columns: [ - Selects?.AssetBuildings({ - key: 'asset_buildings_id', - title: '选择楼栋', - params: { - asset_projects_id: props?.item?.id, - }, - colProps: { span: 12 }, - formItemProps: { ...rulesHelper.number }, - fieldProps: { - showSearch: true, - onChange: (value: any) => { - // 获取当前表单的所有值 - const formValues = form.getFieldsValue(); - const gridRanges = - formValues.grid_ranges || []; - - // 清空所有行的asset_units_id,因为楼栋变化会影响所有单元选择 - const updatedGridRanges = gridRanges.map( - (item: any, index: number) => { - if ( - item.asset_buildings_id === value - ) { - return { - ...item, - asset_units_id: undefined, - }; - } - return item; - }, - ); - // 更新表单值 - form.setFieldsValue({ - grid_ranges: updatedGridRanges, - }); - }, - }, - }), - ...(asset_buildings_id - ? [ - Selects?.GridUnits({ - key: 'asset_units_id', - title: '选择单元', - params: { - asset_projects_id: props?.item?.id, - asset_buildings_id: - asset_buildings_id, - }, - colProps: { span: 12 }, - formItemProps: { ...rulesHelper.text }, - fieldProps: { - showSearch: true, - }, - }), - ] - : []), - ], - }, - ]; - }, - }, - ], - }, - ], - }, - ]; - }, - }, - ]} - /> - ); -} diff --git a/src/pages/asset/grids/modals/GridCreate copy.tsx b/src/pages/asset/grids/modals/GridCreate copy.tsx deleted file mode 100644 index 17ed601..0000000 --- a/src/pages/asset/grids/modals/GridCreate copy.tsx +++ /dev/null @@ -1,157 +0,0 @@ -import { - MyBetaModalFormProps, - MyButtons, - MyModalFormProps, - rulesHelper, -} from '@/common'; -import { Selects } from '@/components/Select'; -import { Apis } from '@/gen/Apis'; -import { BetaSchemaForm } from '@ant-design/pro-components'; -import { Form, message } from 'antd'; -import { useEffect, useState } from 'react'; - -export default function Create(props: MyBetaModalFormProps) { - const [form] = Form.useForm(); - const [transferData, setTransferData] = useState([]); - const [targetKeys, setTargetKeys] = useState([]); - - // 获取Transfer数据源 - useEffect(() => { - const asset_projects_id = props?.item?.id || 0; - if (asset_projects_id) { - Apis.Asset.AssetUnits.GridSelect({ asset_projects_id }) - .then((res) => { - const data = - res.data?.map((item: any) => ({ - key: item.value?.toString(), - title: item.label, - description: item.label, - })) || []; - setTransferData(data); - }) - .catch(() => { - setTransferData([]); - }); - } - }, [props?.item?.id]); - - console.log(props.item, 'pppp'); - return ( - - {...MyModalFormProps.props} - title={`范围添加`} - width="700px" - layout="horizontal" - labelCol={{ span: 4 }} - wrapperCol={{ span: 24 }} - labelAlign="right" - trigger={ - - } - form={form} - key={new Date().getTime()} - onOpenChange={(open: any) => { - if (open) { - form.resetFields(); // 清空表单数据 - form.setFieldsValue({ - asset_projects_id: props?.item?.id, - }); - } - }} - onFinish={async (values: any) => { - values?.grid_ranges?.map((res: { asset_projects_id: string }) => { - res.asset_projects_id = props?.item?.id; - }); - return Apis.Grid.Grids.Store({ - ...values, - }) - .then(() => { - props.reload?.(); - message.success('网格添加成功'); - return true; - }) - .catch(() => false); - }} - columns={[ - ...(props?.item?.id - ? [] - : [ - Selects?.AssetProjects({ - key: 'asset_projects_id', - title: '选择项目', - colProps: { span: 24 }, - required: true, - }), - ]), - - { - valueType: 'dependency', - name: ['asset_projects_id'], - columns: ({ asset_projects_id }) => { - return [ - { - valueType: 'group', - columns: [ - Selects?.GetGridMark({ - key: 'grid_mark', - title: '范围标识', - params: { - asset_projects_id: - asset_projects_id || props?.item?.id || 0, - }, - colProps: { span: 24 }, - formItemProps: { ...rulesHelper.text }, - }), - Selects?.GridUnits({ - key: 'grid_units_id', - title: '选择单元', - params: { - asset_projects_id: - asset_projects_id || props?.item?.id || 0, - }, - colProps: { span: 24 }, - formItemProps: { ...rulesHelper.text }, - }), - // { - // valueType: 'formItem', - // dataIndex: 'grid_units_id', - // title: '选择单元', - // colProps: { span: 24 }, - // formItemProps: { ...rulesHelper.text }, - // renderFormItem: () => ( - // { - // setTargetKeys(nextTargetKeys as string[]); - // form.setFieldValue('grid_units_id', nextTargetKeys); - // }} - // render={(item) => item.title} - // titles={['可选单元', '已选单元']} - // showSearch - // listStyle={{ - // width: 250, - // height: 300, - // }} - // operations={['选择', '移除']} - // locale={{ - // itemUnit: '项', - // itemsUnit: '项', - // searchPlaceholder: '请输入搜索内容', - // notFoundContent: '列表为空', - // }} - // /> - // ), - // }, - ], - }, - ]; - }, - }, - ]} - /> - ); -} diff --git a/src/pages/asset/grids/modals/GridCreate.tsx b/src/pages/asset/grids/modals/GridCreate.tsx index 01068b7..3d005e3 100644 --- a/src/pages/asset/grids/modals/GridCreate.tsx +++ b/src/pages/asset/grids/modals/GridCreate.tsx @@ -85,6 +85,7 @@ export default function Create(props: MyBetaModalFormProps) { item={{ asset_projects_id: props?.item?.id || asset_projects_id, + type: 1, }} /> ), diff --git a/src/pages/asset/list/index.tsx b/src/pages/asset/list/index.tsx index 7d94b71..850bb88 100644 --- a/src/pages/asset/list/index.tsx +++ b/src/pages/asset/list/index.tsx @@ -10,8 +10,8 @@ import { AssetProjectsPropertyTypeEnum } from '@/gen/Enums'; import { ProTable } from '@ant-design/pro-components'; import { Space } from 'antd'; import { useNavigate } from 'react-router-dom'; -import AssetInfo from './components/AssetInfo'; import AssetCreate from './modals/AssetCreate'; +import AssetInfo from './modals/AssetInfo'; import AssetUpdate from './modals/AssetUpdate'; export default function Index({ title = '项目列表' }) { diff --git a/src/pages/asset/list/components/AssetInfo.tsx b/src/pages/asset/list/modals/AssetInfo.tsx similarity index 91% rename from src/pages/asset/list/components/AssetInfo.tsx rename to src/pages/asset/list/modals/AssetInfo.tsx index 65b917b..1d03416 100644 --- a/src/pages/asset/list/components/AssetInfo.tsx +++ b/src/pages/asset/list/modals/AssetInfo.tsx @@ -14,11 +14,16 @@ export default function AssetInfo(props: MyBetaModalFormProps) { - + + + +
{props?.item?.company?.name}
+
+
@@ -29,12 +34,6 @@ export default function AssetInfo(props: MyBetaModalFormProps) {
- - -
{props?.item?.company?.name}
-
-
- {props?.item?.province || ''} {props?.item?.city || ''} @@ -77,9 +76,9 @@ export default function AssetInfo(props: MyBetaModalFormProps) { {props?.item?.closure_date} - {/* - {props?.item?.created_at} - */} + + {props?.item?.created_at} + {props?.item?.updated_at} diff --git a/src/pages/asset/list/components/modals/BindCompany.tsx b/src/pages/asset/list/modals/BindCompany.tsx similarity index 100% rename from src/pages/asset/list/components/modals/BindCompany.tsx rename to src/pages/asset/list/modals/BindCompany.tsx diff --git a/src/pages/asset/list/show/$id.tsx b/src/pages/asset/list/show/$id.tsx index a321712..f8834fa 100644 --- a/src/pages/asset/list/show/$id.tsx +++ b/src/pages/asset/list/show/$id.tsx @@ -4,15 +4,15 @@ import { ProCard } from '@ant-design/pro-components'; import { useParams } from '@umijs/max'; import { Space, Tabs } from 'antd'; import { useEffect, useState } from 'react'; -import Announcement from '../components/Announcement'; -import AssetAccounts from '../components/AssetAccounts'; -import MyAssetBuildings from '../components/AssetBuildings'; -import AssetGrid from '../components/AssetGrid'; -import AssetInfo from '../components/AssetInfo'; -import ChargeStandard from '../components/ChargeStandard'; -import ConvenienceServices from '../components/ConvenienceServices'; -import BindCompany from '../components/modals/BindCompany'; +import AssetInfo from '../modals/AssetInfo'; import AssetUpdate from '../modals/AssetUpdate'; +import BindCompany from '../modals/BindCompany'; +import Announcement from '../table/Announcement'; +import AssetAccounts from '../table/AssetAccounts'; +import MyAssetBuildings from '../table/AssetBuildings'; +import AssetGrid from '../table/AssetGrid'; +import ChargeStandard from '../table/ChargeStandard'; +import ConvenienceServices from '../table/ConvenienceServices'; export default function Show({ title }: { title?: string } = {}) { const { id } = useParams<{ id: string }>(); diff --git a/src/pages/asset/list/components/Announcement.tsx b/src/pages/asset/list/table/Announcement.tsx similarity index 100% rename from src/pages/asset/list/components/Announcement.tsx rename to src/pages/asset/list/table/Announcement.tsx diff --git a/src/pages/asset/list/components/AssetAccounts.tsx b/src/pages/asset/list/table/AssetAccounts.tsx similarity index 100% rename from src/pages/asset/list/components/AssetAccounts.tsx rename to src/pages/asset/list/table/AssetAccounts.tsx diff --git a/src/pages/asset/list/components/AssetBuildings.tsx b/src/pages/asset/list/table/AssetBuildings.tsx similarity index 100% rename from src/pages/asset/list/components/AssetBuildings.tsx rename to src/pages/asset/list/table/AssetBuildings.tsx diff --git a/src/pages/asset/list/components/AssetGrid.tsx b/src/pages/asset/list/table/AssetGrid.tsx similarity index 100% rename from src/pages/asset/list/components/AssetGrid.tsx rename to src/pages/asset/list/table/AssetGrid.tsx diff --git a/src/pages/asset/list/components/ChargeStandard.tsx b/src/pages/asset/list/table/ChargeStandard.tsx similarity index 69% rename from src/pages/asset/list/components/ChargeStandard.tsx rename to src/pages/asset/list/table/ChargeStandard.tsx index c4717f9..5741008 100644 --- a/src/pages/asset/list/components/ChargeStandard.tsx +++ b/src/pages/asset/list/table/ChargeStandard.tsx @@ -10,14 +10,18 @@ import { HouseChargeStandardsCalculationMethodEnum, HouseChargeStandardsCalculationModeEnum, HouseChargeStandardsCalculationPeriodEnum, + HouseChargeStandardsPriceAlgorithmEnum, } from '@/gen/Enums'; +import ChargeStandardCreate from '@/pages/house_charge_standard/modals/ChargeStandardCreate'; +import ChargeStandardHasHouse from '@/pages/house_charge_standard/modals/ChargeStandardHasHouse'; +import ChargeStandardUpdate from '@/pages/house_charge_standard/modals/ChargeStandardUpdate'; import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; 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) { + const navigate = useNavigate(); + return ( <> + {record?.tiered_rates?.map((rate: any, index: number) => ( +
+ {rate?.min_quantity} - {rate?.max_quantity} : + {rate?.price} +
+ ))} + + ); + } + }, }, MyColumns.EnumTag({ title: '账单计费周期', @@ -94,12 +116,17 @@ export default function ReceiptAccounts(props: MyBetaModalFormProps) { return `${record?.is_apportionment ? '是' : '否'} `; }, }, - // MyColumns.UpdatedAt(), // MyColumns.CreatedAt(), MyColumns.Option({ render: (_, item: any, index, action) => ( + { + navigate(`/house_charge_standard/show/${item.id}`); + }} + /> [ + , , ]} columns={[ @@ -78,6 +89,7 @@ export default function Index({ title = '员工管理' }) { reload={action?.reload} title={title} /> + Apis.Common.Admins.Delete({ id: item.id }).then(() => diff --git a/src/pages/company/employees/modals/Change.tsx b/src/pages/company/employees/modals/Change.tsx new file mode 100644 index 0000000..9b0b060 --- /dev/null +++ b/src/pages/company/employees/modals/Change.tsx @@ -0,0 +1,58 @@ +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="500px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + onFinish={async (values: any) => + Apis.Company.CompanyEmployees.Update({ + ...values, + id: props.item?.id ?? 0, + name: props.item?.name ?? '', + phone: props.item?.phone ?? '', + organizations_id: + values?.organizations_id?.[values.organizations_id.length - 1], + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + Selects?.OrganizationsTree({ + title: '选择组织', + key: 'organizations_id', + params: { companies_id: props?.item?.companies_id }, + colProps: { span: 24 }, + fieldProps: { + showSearch: true, + }, + formItemProps: { ...rulesHelper.text }, + }), + ]} + /> + ); +} diff --git a/src/pages/company/employees/modals/EmployeeCreate.tsx b/src/pages/company/employees/modals/EmployeeCreate.tsx index d2c78fa..3a5e503 100644 --- a/src/pages/company/employees/modals/EmployeeCreate.tsx +++ b/src/pages/company/employees/modals/EmployeeCreate.tsx @@ -49,15 +49,35 @@ export default function Create(props: MyBetaModalFormProps) { title: '公司', colProps: { span: 24 }, required: true, + fieldProps: { + onChange: (val: any) => { + form.setFieldsValue({ + organizations_id: undefined, + positions_id: undefined, + }); + }, + }, }), ]), - Selects?.OrganizationsTree({ - title: '选择组织', - key: 'organizations_id', - params: { companies_id: props?.item?.companies_id }, - colProps: { span: 24 }, - formItemProps: { ...rulesHelper.text }, - }), + + { + valueType: 'dependency', + name: ['companies_id'], + columns: ({ companies_id }) => { + return [ + Selects?.OrganizationsTree({ + title: '选择组织', + key: 'organizations_id', + params: { + companies_id: companies_id || props?.item?.companies_id || 0, + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + ]; + }, + }, + { key: 'name', title: '姓名', @@ -81,12 +101,23 @@ export default function Create(props: MyBetaModalFormProps) { valueEnum: SexEnum, required: true, }), - Selects?.Positions({ - title: '岗位', - params: { companies_id: props?.item?.companies_id }, - key: 'positions_id', - formItemProps: { ...rulesHelper.text }, - }), + { + valueType: 'dependency', + name: ['companies_id'], + columns: ({ companies_id }) => { + return [ + Selects?.Positions({ + title: '岗位', + params: { + companies_id: companies_id || props?.item?.companies_id || 0, + }, + key: 'positions_id', + formItemProps: { ...rulesHelper.text }, + }), + ]; + }, + }, + // { // key: 'password', // title: '密码', diff --git a/src/pages/company/employees/modals/EmployeeUpdate.tsx b/src/pages/company/employees/modals/EmployeeUpdate.tsx index 373774a..19cd914 100644 --- a/src/pages/company/employees/modals/EmployeeUpdate.tsx +++ b/src/pages/company/employees/modals/EmployeeUpdate.tsx @@ -46,16 +46,6 @@ export default function Update(props: MyBetaModalFormProps) { .catch(() => false) } columns={[ - Selects?.OrganizationsTree({ - title: '选择组织', - key: 'organizations_id', - params: { companies_id: props?.item?.companies_id }, - colProps: { span: 24 }, - fieldProps: { - showSearch: true, - }, - formItemProps: { ...rulesHelper.text }, - }), { key: 'name', title: '姓名', diff --git a/src/pages/company/list/table/Assets.tsx b/src/pages/company/list/table/Assets.tsx index 09b74de..8123f56 100644 --- a/src/pages/company/list/table/Assets.tsx +++ b/src/pages/company/list/table/Assets.tsx @@ -77,7 +77,7 @@ export default function Index(props: MyBetaModalFormProps) { { - navigate(`/asset/${item.id}`); + navigate(`/asset/list/show/${item.id}`); }} /> diff --git a/src/pages/company/organizations/index.tsx b/src/pages/company/organizations/index.tsx index b8d9dc4..8db39a3 100644 --- a/src/pages/company/organizations/index.tsx +++ b/src/pages/company/organizations/index.tsx @@ -48,13 +48,13 @@ export default function Index({ title = '组织列表' }) { ]} columns={[ { - title: '机构', - dataIndex: ['company', 'name'], + title: '组织ID', + dataIndex: 'id', search: false, }, { - title: '组织ID', - dataIndex: 'id', + title: '机构', + dataIndex: ['company', 'name'], search: false, }, { diff --git a/src/pages/examine/house_registers_audit/index.tsx b/src/pages/examine/house_registers_audit/index.tsx index f089c9f..0b78043 100644 --- a/src/pages/examine/house_registers_audit/index.tsx +++ b/src/pages/examine/house_registers_audit/index.tsx @@ -40,7 +40,7 @@ export default function Index({ title = '登记审核' }) { }, }, render: (text, record) => ( - navigate(`/archive/${record.model_id}`)}> + navigate(`/archive/show/${record.model_id}`)}> {text} ), diff --git a/src/pages/examine/house_registers_audit/modals/Audit.tsx b/src/pages/examine/house_registers_audit/modals/Audit.tsx index 670f921..5e8b385 100644 --- a/src/pages/examine/house_registers_audit/modals/Audit.tsx +++ b/src/pages/examine/house_registers_audit/modals/Audit.tsx @@ -64,7 +64,7 @@ export default function Update(props: MyBetaModalFormProps) { - navigate(`/archive/${props?.item?.model_id}`) + navigate(`/archive/show/${props?.item?.model_id}`) } > {props?.item?.asset_house?.full_name || '-'} diff --git a/src/pages/house_charge_standard/components/ChargeInfo.tsx b/src/pages/house_charge_standard/components/ChargeInfo.tsx index 9e48fe4..4766f23 100644 --- a/src/pages/house_charge_standard/components/ChargeInfo.tsx +++ b/src/pages/house_charge_standard/components/ChargeInfo.tsx @@ -14,12 +14,13 @@ export default function info(props: MyBetaModalFormProps) { - - {item?.name} - - + {item?.asset_project?.name} + + {item?.name} + + (); diff --git a/src/pages/house_charge_standard/index.tsx b/src/pages/house_charge_standard/index.tsx index f53cc2e..5c1ccca 100644 --- a/src/pages/house_charge_standard/index.tsx +++ b/src/pages/house_charge_standard/index.tsx @@ -11,13 +11,15 @@ import { HouseChargeStandardsCalculationMethodEnum, HouseChargeStandardsCalculationModeEnum, HouseChargeStandardsCalculationPeriodEnum, + HouseChargeStandardsPriceAlgorithmEnum, } from '@/gen/Enums'; import { ProTable } from '@ant-design/pro-components'; import { useNavigate } from '@umijs/max'; import { Space } from 'antd'; -import ChargeStandardHasHouse from '../asset/list/components/modals/ChargeStandardHasHouse'; -import ChargeStandardUpdate from '../asset/list/components/modals/ChargeStandardUpdate'; -import ChargeCreate from './modals/ChargeCreate'; + +import ChargeStandardCreate from './modals/ChargeStandardCreate'; +import ChargeStandardHasHouse from './modals/ChargeStandardHasHouse'; +import ChargeStandardUpdate from './modals/ChargeStandardUpdate'; export default function Index({ title = '收费标准' }) { const navigate = useNavigate(); @@ -45,7 +47,11 @@ export default function Index({ title = '收费标准' }) { ) } toolBarRender={(action) => [ - , + , ]} columns={[ MyColumns.ID(), @@ -59,12 +65,12 @@ export default function Index({ title = '收费标准' }) { }, }, { - title: '收费标准名称', + title: '收费名称', dataIndex: 'name', search: false, }, MyColumns.EnumTag({ - title: '收费项目', + title: '收费项', dataIndex: 'charge_type', valueEnum: HouseBillsTypeEnum, }), @@ -80,10 +86,32 @@ export default function Index({ title = '收费标准' }) { valueEnum: HouseChargeStandardsCalculationModeEnum, search: false, }), + MyColumns.EnumTag({ + title: '计费算法', + dataIndex: 'price_algorithm', + valueEnum: HouseChargeStandardsPriceAlgorithmEnum, + search: false, + }), { - title: '单价', + title: '价格', dataIndex: 'price', search: false, + render(_, record) { + if (record?.price_algorithm === 'Fixed') { + return record?.price; + } else { + return ( +
+ {record?.tiered_rates?.map((rate: any, index: number) => ( +
+ {rate?.min_quantity} - {rate?.max_quantity} : + {rate?.price} +
+ ))} +
+ ); + } + }, }, MyColumns.EnumTag({ title: '账单计费周期', @@ -112,7 +140,7 @@ export default function Index({ title = '收费标准' }) { { - navigate(`/house_charge_standard/${item.id}`); + navigate(`/house_charge_standard/show/${item.id}`); }} /> (); - - 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, - 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/asset/list/components/modals/ChargeStandardCreate.tsx b/src/pages/house_charge_standard/modals/ChargeStandardCreate.tsx similarity index 77% rename from src/pages/asset/list/components/modals/ChargeStandardCreate.tsx rename to src/pages/house_charge_standard/modals/ChargeStandardCreate.tsx index 79909a5..f634d61 100644 --- a/src/pages/asset/list/components/modals/ChargeStandardCreate.tsx +++ b/src/pages/house_charge_standard/modals/ChargeStandardCreate.tsx @@ -5,6 +5,7 @@ import { MyModalFormProps, rulesHelper, } from '@/common'; +import { Selects } from '@/components/Select'; import { Apis } from '@/gen/Apis'; import { HouseBillsTypeEnum, @@ -27,8 +28,13 @@ export default function Create(props: MyBetaModalFormProps) { {...MyModalFormProps.props} title={`创建收费标准`} + // wrapperCol={{ span: 24 }} + // 基础表单 + layout="horizontal" + labelCol={{ span: 4 }} wrapperCol={{ span: 24 }} - width="600px" + labelAlign="left" + width="680px" trigger={} form={form} key={new Date().getTime()} @@ -37,13 +43,10 @@ export default function Create(props: MyBetaModalFormProps) { 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({ + onFinish={async (values: any) => + Apis.HouseCharage.HouseChargeStandards.Store({ ...values, - asset_projects_id: props?.item?.id, + asset_projects_id: props?.item?.id || values?.asset_projects_id, type: values.charge_type === HouseBillsTypeEnum.PropertyFee.value || values.charge_type === HouseBillsTypeEnum.MaintenanceFund.value @@ -93,15 +96,43 @@ export default function Create(props: MyBetaModalFormProps) { message.success('收费标准创建成功'); return true; }) - .catch(() => false); - }} + .catch(() => false) + } columns={[ + ...(props?.item?.id + ? [] + : [ + Selects?.AssetProjects({ + key: 'asset_projects_id', + title: '选择项目', + colProps: { span: 24 }, + required: true, + }), + ]), + { key: 'name', - title: '收费标准名称', + title: '收费名称', colProps: { span: 24 }, formItemProps: { ...rulesHelper.text }, }, + { + valueType: 'dependency', + name: ['asset_projects_id'], + columns: ({ asset_projects_id }) => { + return [ + Selects?.ProjectAccounts({ + title: '收款账户', + key: 'company_receipt_accounts_id', + params: { + asset_projects_id: asset_projects_id || props?.item?.id || 0, + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + ]; + }, + }, MyFormItems.EnumRadio({ key: 'charge_type', title: '收费项目', @@ -119,7 +150,7 @@ export default function Create(props: MyBetaModalFormProps) { MyFormItems.EnumRadio({ key: 'calculation_method', title: '分摊方式', - colProps: { span: 18 }, + colProps: { span: 24 }, valueEnum: HouseChargeStandardsApportionmentMethodEnum, required: true, }), @@ -144,7 +175,7 @@ export default function Create(props: MyBetaModalFormProps) { MyFormItems.EnumRadio({ key: 'calculation_method', title: '计量单位', - colProps: { span: 16 }, + colProps: { span: 24 }, valueEnum: () => { let obj: any = JSON.parse( JSON.stringify( @@ -160,6 +191,8 @@ export default function Create(props: MyBetaModalFormProps) { onChange: () => { // 切换计量单位时清空计费模式 form.setFieldValue('calculation_mode', undefined); + form.setFieldValue('price', undefined); + form.setFieldValue('price_algorithm', undefined); }, }, }), @@ -172,7 +205,7 @@ export default function Create(props: MyBetaModalFormProps) { MyFormItems.EnumRadio({ key: 'calculation_method', title: '计量单位', - colProps: { span: 16 }, + colProps: { span: 24 }, valueEnum: () => { let obj: any = JSON.parse( JSON.stringify( @@ -190,6 +223,8 @@ export default function Create(props: MyBetaModalFormProps) { onChange: () => { // 切换计量单位时清空计费模式 form.setFieldValue('calculation_mode', undefined); + form.setFieldValue('price', undefined); + form.setFieldValue('price_algorithm', undefined); }, }, }), @@ -207,7 +242,7 @@ export default function Create(props: MyBetaModalFormProps) { { key: 'price', title: '固定单价', - colProps: { span: 10 }, + colProps: { span: 24 }, fieldProps: { addonAfter: '元', }, @@ -222,7 +257,7 @@ export default function Create(props: MyBetaModalFormProps) { MyFormItems.EnumRadio({ key: 'calculation_mode', title: '计费模式', - colProps: { span: 12 }, + colProps: { span: 24 }, // valueEnum: HouseChargeStandardsCalculationModeEnum, valueEnum: () => { let obj: any = JSON.parse( @@ -247,7 +282,7 @@ export default function Create(props: MyBetaModalFormProps) { { key: 'price', title: '固定单价', - colProps: { span: 10 }, + colProps: { span: 24 }, fieldProps: { addonAfter: '元', }, @@ -260,15 +295,16 @@ export default function Create(props: MyBetaModalFormProps) { MyFormItems.EnumRadio({ key: 'price_algorithm', title: '计费算法', - colProps: { span: 14 }, + colProps: { span: 24 }, valueEnum: HouseChargeStandardsPriceAlgorithmEnum, required: true, - // fieldProps: { - // onChange: () => { - // // 切换计费算法时清空阶梯配置 - // form.setFieldValue('scheme', undefined); - // }, - // }, + fieldProps: { + onChange: () => { + // 切换计费算法时清空阶梯配置 + form.setFieldValue('price', undefined); + form.setFieldValue('tiered_rates', undefined); + }, + }, }), { name: ['price_algorithm'], @@ -280,7 +316,7 @@ export default function Create(props: MyBetaModalFormProps) { { key: 'price', title: '固定单价', - colProps: { span: 10 }, + colProps: { span: 24 }, fieldProps: { addonAfter: '元', max: 99, @@ -448,17 +484,72 @@ export default function Create(props: MyBetaModalFormProps) { columns: [ MyFormItems.EnumRadio({ key: 'calculation_period', - title: '账单计费周期', - colProps: { span: 14 }, + title: '计费周期', + colProps: { span: 24 }, valueEnum: HouseChargeStandardsCalculationPeriodEnum, required: true, }), { key: 'auto_date', - title: '账单自动生成日期', - colProps: { span: 10 }, + title: '生成日期', + colProps: { span: 24 }, + tooltip: '系统将按该设置日期自动生成第一期的账单', valueType: 'date', width: '100%', + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'has_late_fee', + title: '启用滞纳金', + colProps: { span: 24 }, + valueType: 'switch', + width: '100%', + }, + { + name: ['has_late_fee'], + valueType: 'dependency', + columns: ({ has_late_fee }: any) => { + return has_late_fee + ? [ + { + key: 'late_fee_start_days', + title: '起算天数', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + mix: 1, + addonBefore: '生成账单后', + addonAfter: '天', + placeholder: + '请输入按账单生成后多少天后开始收取', + }, + }, + { + key: 'late_fee_rate', + title: '收取费率', + valueType: 'number', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + addonBefore: '每日', + addonAfter: '%', + max: 100, + }, + }, + { + key: 'late_fee_cap_days', + title: '封顶天数', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + mix: 1, + placeholder: '请输入封顶天数', + addonAfter: '天', + }, + }, + ] + : []; + }, }, { key: 'remark', @@ -466,8 +557,8 @@ export default function Create(props: MyBetaModalFormProps) { colProps: { span: 24 }, valueType: 'textarea', fieldProps: { - rows: 4, - maxLength: 500, + // rows: 2, + maxLength: 100, showCount: true, }, }, diff --git a/src/pages/asset/list/components/modals/ChargeStandardHasHouse.tsx b/src/pages/house_charge_standard/modals/ChargeStandardHasHouse.tsx similarity index 100% rename from src/pages/asset/list/components/modals/ChargeStandardHasHouse.tsx rename to src/pages/house_charge_standard/modals/ChargeStandardHasHouse.tsx diff --git a/src/pages/asset/list/components/modals/ChargeStandardUpdate.tsx b/src/pages/house_charge_standard/modals/ChargeStandardUpdate.tsx similarity index 76% rename from src/pages/asset/list/components/modals/ChargeStandardUpdate.tsx rename to src/pages/house_charge_standard/modals/ChargeStandardUpdate.tsx index 685864e..36733ab 100644 --- a/src/pages/asset/list/components/modals/ChargeStandardUpdate.tsx +++ b/src/pages/house_charge_standard/modals/ChargeStandardUpdate.tsx @@ -5,6 +5,7 @@ import { MyModalFormProps, rulesHelper, } from '@/common'; +import { Selects } from '@/components/Select'; import { Apis } from '@/gen/Apis'; import { HouseBillsTypeEnum, @@ -27,8 +28,13 @@ export default function Update(props: MyBetaModalFormProps) { {...MyModalFormProps.props} title={props.title} + // wrapperCol={{ span: 24 }} + // 基础表单 + layout="horizontal" + labelCol={{ span: 4 }} wrapperCol={{ span: 24 }} - width="600px" + labelAlign="left" + width="650px" trigger={ } @@ -97,10 +103,27 @@ export default function Update(props: MyBetaModalFormProps) { columns={[ { key: 'name', - title: '收费标准名称', + title: '收费名称', colProps: { span: 24 }, formItemProps: { ...rulesHelper.text }, }, + { + valueType: 'dependency', + name: ['asset_projects_id'], + columns: ({ asset_projects_id }) => { + return [ + Selects?.ProjectAccounts({ + title: '收款账户', + key: 'company_receipt_accounts_id', + params: { + asset_projects_id: asset_projects_id || props?.item?.id || 0, + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + ]; + }, + }, MyFormItems.EnumRadio({ key: 'charge_type', title: '收费项目', @@ -118,7 +141,7 @@ export default function Update(props: MyBetaModalFormProps) { MyFormItems.EnumRadio({ key: 'calculation_method', title: '分摊方式', - colProps: { span: 18 }, + colProps: { span: 24 }, valueEnum: HouseChargeStandardsApportionmentMethodEnum, required: true, }), @@ -127,6 +150,12 @@ export default function Update(props: MyBetaModalFormProps) { }, }, + // Selects?.AssetProjects({ + // key: 'asset_projects_id', + // title: '项目', + // colProps: { span: 12 }, + // formItemProps: { ...rulesHelper.text }, + // }), { name: ['charge_type'], valueType: 'dependency', @@ -137,7 +166,7 @@ export default function Update(props: MyBetaModalFormProps) { MyFormItems.EnumRadio({ key: 'calculation_method', title: '计量单位', - colProps: { span: 16 }, + colProps: { span: 24 }, valueEnum: () => { let obj: any = JSON.parse( JSON.stringify( @@ -153,6 +182,8 @@ export default function Update(props: MyBetaModalFormProps) { onChange: () => { // 切换计量单位时清空计费模式 form.setFieldValue('calculation_mode', undefined); + // form.setFieldValue('price', undefined); + form.setFieldValue('price_algorithm', undefined); }, }, }), @@ -165,7 +196,7 @@ export default function Update(props: MyBetaModalFormProps) { MyFormItems.EnumRadio({ key: 'calculation_method', title: '计量单位', - colProps: { span: 16 }, + colProps: { span: 24 }, valueEnum: () => { let obj: any = JSON.parse( JSON.stringify( @@ -183,6 +214,8 @@ export default function Update(props: MyBetaModalFormProps) { onChange: () => { // 切换计量单位时清空计费模式 form.setFieldValue('calculation_mode', undefined); + // form.setFieldValue('price', undefined); + form.setFieldValue('price_algorithm', undefined); }, }, }), @@ -200,7 +233,7 @@ export default function Update(props: MyBetaModalFormProps) { { key: 'price', title: '固定单价', - colProps: { span: 10 }, + colProps: { span: 24 }, fieldProps: { addonAfter: '元', }, @@ -215,7 +248,7 @@ export default function Update(props: MyBetaModalFormProps) { MyFormItems.EnumRadio({ key: 'calculation_mode', title: '计费模式', - colProps: { span: 12 }, + colProps: { span: 24 }, // valueEnum: HouseChargeStandardsCalculationModeEnum, valueEnum: () => { let obj: any = JSON.parse( @@ -240,7 +273,7 @@ export default function Update(props: MyBetaModalFormProps) { { key: 'price', title: '固定单价', - colProps: { span: 10 }, + colProps: { span: 24 }, fieldProps: { addonAfter: '元', }, @@ -253,15 +286,16 @@ export default function Update(props: MyBetaModalFormProps) { MyFormItems.EnumRadio({ key: 'price_algorithm', title: '计费算法', - colProps: { span: 14 }, + colProps: { span: 24 }, valueEnum: HouseChargeStandardsPriceAlgorithmEnum, required: true, - // fieldProps: { - // onChange: () => { - // // 切换计费算法时清空阶梯配置 - // form.setFieldValue('scheme', undefined); - // }, - // }, + fieldProps: { + onChange: () => { + // 切换计费算法时清空阶梯配置 + // form.setFieldValue('price', undefined); + // form.setFieldValue('tiered_rates', undefined); + }, + }, }), { name: ['price_algorithm'], @@ -273,9 +307,10 @@ export default function Update(props: MyBetaModalFormProps) { { key: 'price', title: '固定单价', - colProps: { span: 10 }, + colProps: { span: 24 }, fieldProps: { addonAfter: '元', + max: 99, }, formItemProps: { ...rulesHelper.number }, }, @@ -288,13 +323,13 @@ export default function Update(props: MyBetaModalFormProps) { dataIndex: 'tiered_rates', title: '阶梯标准', formItemProps: { ...rulesHelper.array }, - // initialValue: [ - // { - // start: 0, - // end: null, - // price: null, - // }, - // ], + initialValue: [ + { + min_quantity: 0, + max_quantity: null, + price: null, + }, + ], fieldProps: { actionRef: actionRef, copyIconProps: false, @@ -357,13 +392,13 @@ export default function Update(props: MyBetaModalFormProps) { dataIndex: 'tiered_rates', title: '阶梯标准', formItemProps: { ...rulesHelper.array }, - // initialValue: [ - // { - // start: 0, - // end: null, - // price: null, - // }, - // ], + initialValue: [ + { + min_quantity: 0, + max_quantity: null, + price: null, + }, + ], fieldProps: { actionRef: actionRef, copyIconProps: false, @@ -440,17 +475,72 @@ export default function Update(props: MyBetaModalFormProps) { columns: [ MyFormItems.EnumRadio({ key: 'calculation_period', - title: '账单计费周期', - colProps: { span: 14 }, + title: '计费周期', + colProps: { span: 24 }, valueEnum: HouseChargeStandardsCalculationPeriodEnum, required: true, }), { key: 'auto_date', - title: '账单自动生成日期', - colProps: { span: 10 }, + title: '生成日期', + colProps: { span: 24 }, + tooltip: '系统将按该设置日期自动生成第一期的账单', valueType: 'date', width: '100%', + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'has_late_fee', + title: '启用滞纳金', + colProps: { span: 24 }, + valueType: 'switch', + width: '100%', + }, + { + name: ['has_late_fee'], + valueType: 'dependency', + columns: ({ has_late_fee }: any) => { + return has_late_fee + ? [ + { + key: 'late_fee_start_days', + title: '起算天数', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + mix: 1, + addonBefore: '生成账单后', + addonAfter: '天', + placeholder: + '请输入按账单生成后多少天后开始收取', + }, + }, + { + key: 'late_fee_rate', + title: '收取费率', + valueType: 'number', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + addonBefore: '每日', + addonAfter: '%', + max: 100, + }, + }, + { + key: 'late_fee_cap_days', + title: '封顶天数', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + mix: 1, + placeholder: '请输入封顶天数', + addonAfter: '天', + }, + }, + ] + : []; + }, }, { key: 'remark', @@ -458,8 +548,8 @@ export default function Update(props: MyBetaModalFormProps) { colProps: { span: 24 }, valueType: 'textarea', fieldProps: { - rows: 4, - maxLength: 500, + // rows: 2, + maxLength: 100, showCount: true, }, }, diff --git a/src/pages/house_charge_standard/$id.tsx b/src/pages/house_charge_standard/show/$id.tsx similarity index 93% rename from src/pages/house_charge_standard/$id.tsx rename to src/pages/house_charge_standard/show/$id.tsx index 6dc1caf..4540bd0 100644 --- a/src/pages/house_charge_standard/$id.tsx +++ b/src/pages/house_charge_standard/show/$id.tsx @@ -4,8 +4,8 @@ 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'; +import ChargeInfo from '../components/ChargeInfo'; +import HasHouse from '../components/HasHouse'; export default function Show({ title }: { title?: string } = {}) { const { id } = useParams<{ id: string }>(); diff --git a/src/pages/house_charge_tasks copy/index.tsx b/src/pages/house_charge_tasks copy/index.tsx new file mode 100644 index 0000000..8e481db --- /dev/null +++ b/src/pages/house_charge_tasks copy/index.tsx @@ -0,0 +1,100 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, + usePageTabs, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { HouseChargeTaskDetailsStatusEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import ChargeTasksCreate from './modals/ChargeTasksCreate'; + +export default function Index({ title = '账单任务' }) { + // 注册当前页面为标签页 + usePageTabs({ + tabKey: 'house_charge_tasks', + tabLabel: title, + }); + + return ( + + + MyProTableProps.request( + params, + sort, + Apis.HouseCharage.HouseChargeTasks.List, + ) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + { + title: '任务ID', + dataIndex: 'house_charge_tasks_id', + search: false, + }, + MyColumns.EnumTag({ + title: '任务状态', + dataIndex: 'status', + valueEnum: HouseChargeTaskDetailsStatusEnum, + }), + { + title: '账单ID', + dataIndex: 'id', + search: false, + }, + { + title: '关联对象', + dataIndex: 'full_name', + search: false, + }, + { + title: '账单月份', + render: (_, record) => { + return `${record.year}-${String(record.month).padStart(2, '0')}`; + }, + }, + { + title: '计费开始日期', + dataIndex: ['house_charge_task', 'start_date'], + search: false, + }, + { + title: '计费结束日期', + dataIndex: ['house_charge_task', 'end_date'], + search: false, + }, + // MyColumns.UpdatedAt(), + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + Apis.HouseCharage.HouseChargeTaskDetails.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/house_charge_tasks copy/modals/ChargeTasksCreate.tsx b/src/pages/house_charge_tasks copy/modals/ChargeTasksCreate.tsx new file mode 100644 index 0000000..7f45601 --- /dev/null +++ b/src/pages/house_charge_tasks copy/modals/ChargeTasksCreate.tsx @@ -0,0 +1,116 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`创建${props.title}`} + width="480px" + layout="horizontal" + labelCol={{ span: 8 }} + wrapperCol={{ span: 16 }} + labelAlign="left" + trigger={} + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + onFinish={async (values) => + Apis.HouseCharage.HouseChargeTasks.Store(values) + .then(() => { + props.reload?.(); + message.success(props.title + '账单任务创建成功'); + return true; + }) + .catch(() => false) + } + columns={[ + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + onChange: (val: any) => { + form.setFieldsValue({ + house_charge_standards_id: undefined, + }); + }, + }, + }), + { + valueType: 'dependency', + name: ['asset_projects_id'], + columns: ({ asset_projects_id }) => { + return [ + Selects?.ChargeStandard({ + title: '选择收费标准', + key: 'house_charge_standards_id', + params: { + asset_projects_id: asset_projects_id, + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + showSearch: true, + }, + }), + ]; + }, + }, + { + key: 'month', + title: '选择生成月份', + valueType: 'date', + colProps: { span: 24 }, + fieldProps: { + picker: 'month', + format: 'YYYY-MM', + valueFormat: 'YYYY-MM', + style: { + width: '100%', + }, + }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'start_date', + title: '计费开始日期', + valueType: 'date', + colProps: { span: 24 }, + fieldProps: { + style: { + width: '100%', + }, + }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'end_date', + title: '计费结束日期', + valueType: 'date', + colProps: { span: 24 }, + fieldProps: { + style: { + width: '100%', + }, + }, + formItemProps: { ...rulesHelper.text }, + }, + ]} + /> + ); +} diff --git a/src/pages/house_charge_tasks/index.tsx b/src/pages/house_charge_tasks/index.tsx index d905970..a3ebd66 100644 --- a/src/pages/house_charge_tasks/index.tsx +++ b/src/pages/house_charge_tasks/index.tsx @@ -9,11 +9,12 @@ import { Apis } from '@/gen/Apis'; import { HouseChargeTaskDetailsStatusEnum } from '@/gen/Enums'; import { ProTable } from '@ant-design/pro-components'; import { Space } from 'antd'; +import ChargeTasksCreate from './modals/ChargeTasksCreate'; -export default function Index({ title = '任务结果' }) { +export default function Index({ title = '账单任务' }) { // 注册当前页面为标签页 usePageTabs({ - tabKey: 'charge_task_details', + tabKey: 'house_charge_tasks', tabLabel: title, }); @@ -21,7 +22,7 @@ export default function Index({ title = '任务结果' }) { [ - // , - // ]} + toolBarRender={(action) => [ + , + ]} columns={[ { title: '任务ID', diff --git a/src/pages/house_charge_tasks/modals/ChargeTasksCreate.tsx b/src/pages/house_charge_tasks/modals/ChargeTasksCreate.tsx index 199fa3b..5a0dff8 100644 --- a/src/pages/house_charge_tasks/modals/ChargeTasksCreate.tsx +++ b/src/pages/house_charge_tasks/modals/ChargeTasksCreate.tsx @@ -43,6 +43,13 @@ export default function Create(props: MyBetaModalFormProps) { key: 'asset_projects_id', colProps: { span: 24 }, formItemProps: { ...rulesHelper.text }, + fieldProps: { + onChange: (val: any) => { + form.setFieldsValue({ + house_charge_standards_id: undefined, + }); + }, + }, }), { valueType: 'dependency', @@ -76,6 +83,12 @@ export default function Create(props: MyBetaModalFormProps) { style: { width: '100%', }, + onChange: (e: any, dateString: string) => { + form.setFieldsValue({ + start_date: rulesHelper.getMonthStartDate(dateString), + end_date: rulesHelper.getMonthEndDate(dateString), + }); + }, }, formItemProps: { ...rulesHelper.text }, },