diff --git a/src/common/utils/day.ts b/src/common/utils/day.ts index 6c76a88..3cb56b6 100644 --- a/src/common/utils/day.ts +++ b/src/common/utils/day.ts @@ -49,3 +49,7 @@ export function GetFromNow(time: string) { //获取时间距离现在的时间 return time ? dayjs(time).fromNow() : ''; } + +export function getTodayDate(): string { + return dayjs().format('YYYY-MM-DD'); +} diff --git a/src/common/utils/mapConfig.ts b/src/common/utils/mapConfig.ts new file mode 100644 index 0000000..987fcb2 --- /dev/null +++ b/src/common/utils/mapConfig.ts @@ -0,0 +1,2 @@ +export const mapKey = '4ce26ecef55ae1ec47910a72a098efc0'; +// export const mapKey = '35fe6f4443fddf86cdcca3b97fd8c872'; diff --git a/src/components/ModalsAssetsProjectSelectList.tsx b/src/components/ModalsAssetsProjectSelectList.tsx new file mode 100644 index 0000000..5c31b4d --- /dev/null +++ b/src/components/ModalsAssetsProjectSelectList.tsx @@ -0,0 +1,109 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyColumns, + MyProTableProps, +} from '@/common'; +import { MyModal } from '@/components/MyModal'; +import { Apis } from '@/gen/Apis'; +import { AssetProjectsPropertyTypeEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useRef, useState } from 'react'; +interface DataType { + key?: React.Key; + id?: React.Key; +} +export default function SurveysSelectList( + props: MyBetaModalFormProps & { + onChange?: (selectedRows: DataType[]) => void; + type?: 'checkbox' | 'radio'; + }, +) { + const modalRef = useRef(); + // const [selectedDataRow, setSelectedDataRow] = useState({}); + const [getSelectedRow, setSelectedRow] = useState([]); + const rowSelection: any = { + onChange: (selectedRowKeys: React.Key[], selectedRows: DataType[]) => { + console.log(selectedRows, 'selectedRows[0]'); + setSelectedRow(selectedRows); + }, + getCheckboxProps: (record: any) => ({ + disabled: record.deleted_at, + checked: props?.item?.some((item: any) => { + console.log(item, record); + return item?.id === record?.id; + }), + }), + defaultSelectedRowKeys: props?.item?.map((item: any) => item?.id) || [], + }; + + return ( + { + setSelectedRow(props?.item); + console.log(props?.item, 'props?.item?.id'); + }} + node={ + + MyProTableProps.request(params, sort, Apis.Asset.AssetProjects.List) + } + rowSelection={{ + type: props?.type ? props?.type : 'checkbox', + ...rowSelection, + }} + options={false} + tableAlertOptionRender={() => { + return ( + { + let res: any = getSelectedRow; + props?.onChange?.(res); + modalRef.current?.close(); + }} + title="确定选项" + /> + ); + }} + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '项目名称', + dataIndex: 'name', + }, + MyColumns.EnumTag({ + title: '类型', + dataIndex: 'property_type', + valueEnum: AssetProjectsPropertyTypeEnum, + search: false, + }), + { + title: '地址', + render: (_, i: any) => { + return `${i?.province || ''} ${i?.city || ''} ${ + i?.district || '' + }${i?.address || ''}`; + }, + search: false, + }, + MyColumns.DeletedAt({ + title: '启/禁用', + dataIndex: 'deleted_at', + search: false, + }), + ]} + /> + } + > + ); +} diff --git a/src/components/SysSelects.tsx b/src/components/SysSelects.tsx index afe4f05..38ae935 100644 --- a/src/components/SysSelects.tsx +++ b/src/components/SysSelects.tsx @@ -75,6 +75,7 @@ export const SysSelects = { valueType: 'select', hideInTable: hideInTable, formItemProps: { ...(required ? rulesHelper.number : {}) }, + ...rest, fieldProps: { mode: 'multiple', showSearch: false, @@ -82,9 +83,37 @@ export const SysSelects = { label: 'name', value: 'id', }, + ...rest?.fieldProps, }, request: async () => (await Apis.Permission.Roles.Select()).data, + }; + }, + SysEmployeeRoles(props?: PropsType): ReturnType { + const { + title = '员工角色', + key = 'employee_roles_id', + required = true, + hideInTable = true, + ...rest + } = props ?? {}; + + return { + title: title, + key: key, + valueType: 'select', + hideInTable: hideInTable, + formItemProps: { ...(required ? rulesHelper.number : {}) }, ...rest, + fieldProps: { + mode: 'multiple', + showSearch: false, + fieldNames: { + label: 'name', + value: 'id', + }, + ...rest?.fieldProps, + }, + request: async () => (await Apis.Company.EmployeeRoles.Select()).data, }; }, }; diff --git a/src/gen/ApiTypes.d.ts b/src/gen/ApiTypes.d.ts index abb4d8e..8def227 100644 --- a/src/gen/ApiTypes.d.ts +++ b/src/gen/ApiTypes.d.ts @@ -1138,6 +1138,28 @@ declare namespace ApiTypes { "company_name"?: string; // 模糊搜索:名称 }; } + namespace EmployeeRoles { + type List = { + "name"?: string; // 模糊搜索:名称 + }; + type Store = { + "name": string; // 角色名称 + }; + type Update = { + "id": number; // ID + "name": string; // 角色名称 + }; + type Delete = { + "id": number; // ID + }; + type GetPermissions = { + "id": number; // 角色ID + }; + type SetPermissions = { + "id": number; // ID + "permissions_ids": string[]; // 权限ID + }; + } namespace OrganizationProjects { type List = { "organizations_id"?: number; // 组织id,[ref:organizations] @@ -1882,6 +1904,7 @@ declare namespace ApiTypes { namespace Roles { type List = { "name"?: string; // 模糊搜索:名称 + "guard_name"?: string; // 角色类型 }; type Store = { "name": string; // 角色名称 diff --git a/src/gen/Apis.ts b/src/gen/Apis.ts index f6c7e8c..3314b6c 100644 --- a/src/gen/Apis.ts +++ b/src/gen/Apis.ts @@ -633,6 +633,32 @@ export const Apis = { return request('company/company/company_receipt_accounts/select', { data }); }, }, + EmployeeRoles: { + List(data?: ApiTypes.Company.EmployeeRoles.List): Promise { + return request('company/company/employee_roles/list', { data }); + }, + Store(data: ApiTypes.Company.EmployeeRoles.Store): Promise { + return request('company/company/employee_roles/store', { data }); + }, + Update(data: ApiTypes.Company.EmployeeRoles.Update): Promise { + return request('company/company/employee_roles/update', { data }); + }, + Delete(data: ApiTypes.Company.EmployeeRoles.Delete): Promise { + return request('company/company/employee_roles/delete', { data }); + }, + Select(): Promise { + return request('company/company/employee_roles/select', {}); + }, + GetPermissions(data: ApiTypes.Company.EmployeeRoles.GetPermissions): Promise { + return request('company/company/employee_roles/get_permissions', { data }); + }, + SetPermissions(data: ApiTypes.Company.EmployeeRoles.SetPermissions): Promise { + return request('company/company/employee_roles/set_permissions', { data }); + }, + PermissionTree(): Promise { + return request('company/company/employee_roles/permission_tree', {}); + }, + }, OrganizationProjects: { List(data?: ApiTypes.Company.OrganizationProjects.List): Promise { return request('company/company/organization_projects/list', { data }); diff --git a/src/gen/Enums.ts b/src/gen/Enums.ts index 6263842..67bc587 100644 --- a/src/gen/Enums.ts +++ b/src/gen/Enums.ts @@ -1,918 +1,1176 @@ // ActivitiesPublishStatusEnum -export const ActivitiesPublishStatusEnum= { - 'Unpublished': {"text":"未发布","color":"#9e9e9e","value":"Unpublished"}, - 'Published': {"text":"已发布","color":"#00c853","value":"Published"}, - 'Unlisted': {"text":"已下架","color":"#d32f2f","value":"Unlisted"}, +export const ActivitiesPublishStatusEnum = { + Unpublished: { text: '未发布', color: '#9e9e9e', value: 'Unpublished' }, + Published: { text: '已发布', color: '#00c853', value: 'Published' }, + Unlisted: { text: '已下架', color: '#d32f2f', value: 'Unlisted' }, }; // ActivitiesPublishTypeEnum -export const ActivitiesPublishTypeEnum= { - 'Manual': {"text":"手动","color":"#4caf50","value":"Manual"}, - 'Schedule': {"text":"定时","color":"#2196f3","value":"Schedule"}, +export const ActivitiesPublishTypeEnum = { + Manual: { text: '手动', color: '#4caf50', value: 'Manual' }, + Schedule: { text: '定时', color: '#2196f3', value: 'Schedule' }, }; // ActivitiesStatusEnum -export const ActivitiesStatusEnum= { - 'NotStarted': {"text":"未开始","color":"#9e9e9e","value":"NotStarted"}, - 'InProgress': {"text":"进行中","color":"#00c853","value":"InProgress"}, - 'Finished': {"text":"已结束","color":"#d32f2f","value":"Finished"}, +export const ActivitiesStatusEnum = { + NotStarted: { text: '未开始', color: '#9e9e9e', value: 'NotStarted' }, + InProgress: { text: '进行中', color: '#00c853', value: 'InProgress' }, + Finished: { text: '已结束', color: '#d32f2f', value: 'Finished' }, }; // ActivityEnrollsStatusEnum -export const ActivityEnrollsStatusEnum= { - 'PendingReview': {"text":"待审核","color":"#2196f3","value":"PendingReview"}, - 'Success': {"text":"成功","color":"#00c853","value":"Success"}, - 'Failed': {"text":"失败","color":"#d32f2f","value":"Failed"}, - 'Cancelled': {"text":"取消","color":"#ff9800","value":"Cancelled"}, +export const ActivityEnrollsStatusEnum = { + PendingReview: { text: '待审核', color: '#2196f3', value: 'PendingReview' }, + Success: { text: '成功', color: '#00c853', value: 'Success' }, + Failed: { text: '失败', color: '#d32f2f', value: 'Failed' }, + Cancelled: { text: '取消', color: '#ff9800', value: 'Cancelled' }, }; // 审批实例状态枚举 -export const ApprovalInstancesStatusEnum= { - 'Pending': {"text":"待审批","color":"#ff9800","value":"Pending"}, - 'Approved': {"text":"已通过","color":"#4caf50","value":"Approved"}, - 'Rejected': {"text":"已拒绝","color":"#f44336","value":"Rejected"}, - 'Cancelled': {"text":"已取消","color":"#9e9e9e","value":"Cancelled"}, +export const ApprovalInstancesStatusEnum = { + Pending: { text: '待审批', color: '#ff9800', value: 'Pending' }, + Approved: { text: '已通过', color: '#4caf50', value: 'Approved' }, + Rejected: { text: '已拒绝', color: '#f44336', value: 'Rejected' }, + Cancelled: { text: '已取消', color: '#9e9e9e', value: 'Cancelled' }, }; // 审批记录状态枚举 -export const ApprovalRecordsStatusEnum= { - 'Pending': {"text":"待审批","color":"#ff9800","value":"Pending"}, - 'Approved': {"text":"同意","color":"#4caf50","value":"Approved"}, - 'Rejected': {"text":"拒绝","color":"#f44336","value":"Rejected"}, - 'Transferred': {"text":"转交","color":"#9c27b0","value":"Transferred"}, +export const ApprovalRecordsStatusEnum = { + Pending: { text: '待审批', color: '#ff9800', value: 'Pending' }, + Approved: { text: '同意', color: '#4caf50', value: 'Approved' }, + Rejected: { text: '拒绝', color: '#f44336', value: 'Rejected' }, + Transferred: { text: '转交', color: '#9c27b0', value: 'Transferred' }, }; // 审批方式枚举 -export const ApprovalTemplateNodesApproveTypeEnum= { - 'And': {"text":"会签","color":"#4caf50","value":"And"}, - 'Or': {"text":"或签","color":"#ff9800","value":"Or"}, +export const ApprovalTemplateNodesApproveTypeEnum = { + And: { text: '会签', color: '#4caf50', value: 'And' }, + Or: { text: '或签', color: '#ff9800', value: 'Or' }, }; // 审批节点类型枚举 -export const ApprovalTemplateNodesNodeTypeEnum= { - 'Approver': {"text":"审批人","color":"#2196f3","value":"Approver"}, - 'CC': {"text":"抄送人","color":"#9e9e9e","value":"CC"}, +export const ApprovalTemplateNodesNodeTypeEnum = { + Approver: { text: '审批人', color: '#2196f3', value: 'Approver' }, + CC: { text: '抄送人', color: '#9e9e9e', value: 'CC' }, }; // 审批业务类型枚举 -export const ApprovalTemplatesTypeEnum= { - 'Contract': {"text":"合同","color":"#2196f3","value":"Contract"}, - 'Finance': {"text":"财务","color":"#4caf50","value":"Finance"}, - 'Refund': {"text":"退款","color":"#f44336","value":"Refund"}, +export const ApprovalTemplatesTypeEnum = { + Contract: { text: '合同', color: '#2196f3', value: 'Contract' }, + Finance: { text: '财务', color: '#4caf50', value: 'Finance' }, + Refund: { text: '退款', color: '#f44336', value: 'Refund' }, }; // 车位产权类型 -export const AssetCarPortsPropertyTypeEnum= { - 'Ownership': {"text":"产权车位","color":"#1e90ff","value":"Ownership"}, - 'CivilDefense': {"text":"人防车位","color":"#32cd32","value":"CivilDefense"}, - 'Public': {"text":"公共车位","color":"#ff8c00","value":"Public"}, - 'Temporary': {"text":"临时车位","color":"#ba55d3","value":"Temporary"}, - 'Other': {"text":"其他","color":"#a9a9a9","value":"Other"}, +export const AssetCarPortsPropertyTypeEnum = { + Ownership: { text: '产权车位', color: '#1e90ff', value: 'Ownership' }, + CivilDefense: { text: '人防车位', color: '#32cd32', value: 'CivilDefense' }, + Public: { text: '公共车位', color: '#ff8c00', value: 'Public' }, + Temporary: { text: '临时车位', color: '#ba55d3', value: 'Temporary' }, + Other: { text: '其他', color: '#a9a9a9', value: 'Other' }, }; // 车位状态 -export const AssetCarPortsStatusEnum= { - 'Unsold': {"text":"未售","color":"#6b7280","value":"Unsold"}, - 'Sold': {"text":"已售","color":"#10b981","value":"Sold"}, - 'Rented': {"text":"已租","color":"#3b82f6","value":"Rented"}, - 'Unrented': {"text":"未租","color":"#f59e0b","value":"Unrented"}, - 'Other': {"text":"其他","color":"#9ca3af","value":"Other"}, +export const AssetCarPortsStatusEnum = { + Unsold: { text: '未售', color: '#6b7280', value: 'Unsold' }, + Sold: { text: '已售', color: '#10b981', value: 'Sold' }, + Rented: { text: '已租', color: '#3b82f6', value: 'Rented' }, + Unrented: { text: '未租', color: '#f59e0b', value: 'Unrented' }, + Other: { text: '其他', color: '#9ca3af', value: 'Other' }, }; // 车位类型 -export const AssetCarPortsTypeEnum= { - 'Standard': {"text":"标准车位","color":"#1e90ff","value":"Standard"}, - 'Mini': {"text":"微型车位","color":"#32cd32","value":"Mini"}, - 'Accessible': {"text":"无障碍车位","color":"#ff8c00","value":"Accessible"}, - 'Tandem': {"text":"子母车位","color":"#ba55d3","value":"Tandem"}, - 'Mechanical': {"text":"机械车位","color":"#20b2aa","value":"Mechanical"}, - 'Other': {"text":"其他","color":"#a9a9a9","value":"Other"}, +export const AssetCarPortsTypeEnum = { + Standard: { text: '标准车位', color: '#1e90ff', value: 'Standard' }, + Mini: { text: '微型车位', color: '#32cd32', value: 'Mini' }, + Accessible: { text: '无障碍车位', color: '#ff8c00', value: 'Accessible' }, + Tandem: { text: '子母车位', color: '#ba55d3', value: 'Tandem' }, + Mechanical: { text: '机械车位', color: '#20b2aa', value: 'Mechanical' }, + Other: { text: '其他', color: '#a9a9a9', value: 'Other' }, }; // AssetHousesOrientationEnum -export const AssetHousesOrientationEnum= { - 'East': {"text":"东","color":"#007bff","value":"East"}, - 'South': {"text":"南","color":"#28a745","value":"South"}, - 'West': {"text":"西","color":"#ffc107","value":"West"}, - 'North': {"text":"北","color":"#dc3545","value":"North"}, - 'Southeast': {"text":"东南","color":"#20c997","value":"Southeast"}, - 'Northeast': {"text":"东北","color":"#6f42c1","value":"Northeast"}, - 'Southwest': {"text":"西南","color":"#fd7e14","value":"Southwest"}, - 'Northwest': {"text":"西北","color":"#17a2b8","value":"Northwest"}, - 'EastWest': {"text":"东西","color":"#6610f2","value":"EastWest"}, - 'SouthNorth': {"text":"南北","color":"#e83e8c","value":"SouthNorth"}, +export const AssetHousesOrientationEnum = { + East: { text: '东', color: '#007bff', value: 'East' }, + South: { text: '南', color: '#28a745', value: 'South' }, + West: { text: '西', color: '#ffc107', value: 'West' }, + North: { text: '北', color: '#dc3545', value: 'North' }, + Southeast: { text: '东南', color: '#20c997', value: 'Southeast' }, + Northeast: { text: '东北', color: '#6f42c1', value: 'Northeast' }, + Southwest: { text: '西南', color: '#fd7e14', value: 'Southwest' }, + Northwest: { text: '西北', color: '#17a2b8', value: 'Northwest' }, + EastWest: { text: '东西', color: '#6610f2', value: 'EastWest' }, + SouthNorth: { text: '南北', color: '#e83e8c', value: 'SouthNorth' }, }; // AssetHousesOwnershipTypeEnum -export const AssetHousesOwnershipTypeEnum= { - 'CommodityHousing': {"text":"商品房","color":"#007bff","value":"CommodityHousing"}, - 'FundedHousing': {"text":"集资房","color":"#28a745","value":"FundedHousing"}, - 'MilitaryHousing': {"text":"军产房","color":"#17a2b8","value":"MilitaryHousing"}, - 'AffordableHousing': {"text":"保障房","color":"#ffc107","value":"AffordableHousing"}, - 'RuralHousing': {"text":"农民房","color":"#6f42c1","value":"RuralHousing"}, - 'CommercialOffice': {"text":"商业写字楼","color":"#fd7e14","value":"CommercialOffice"}, - 'CommercialComplex': {"text":"商业综合体","color":"#dc3545","value":"CommercialComplex"}, - 'ResettlementHousing': {"text":"回迁房","color":"#20c997","value":"ResettlementHousing"}, +export const AssetHousesOwnershipTypeEnum = { + CommodityHousing: { + text: '商品房', + color: '#007bff', + value: 'CommodityHousing', + }, + FundedHousing: { text: '集资房', color: '#28a745', value: 'FundedHousing' }, + MilitaryHousing: { + text: '军产房', + color: '#17a2b8', + value: 'MilitaryHousing', + }, + AffordableHousing: { + text: '保障房', + color: '#ffc107', + value: 'AffordableHousing', + }, + RuralHousing: { text: '农民房', color: '#6f42c1', value: 'RuralHousing' }, + CommercialOffice: { + text: '商业写字楼', + color: '#fd7e14', + value: 'CommercialOffice', + }, + CommercialComplex: { + text: '商业综合体', + color: '#dc3545', + value: 'CommercialComplex', + }, + ResettlementHousing: { + text: '回迁房', + color: '#20c997', + value: 'ResettlementHousing', + }, }; // AssetHousesPropertyOwnershipEnum -export const AssetHousesPropertyOwnershipEnum= { - 'Individual': {"text":"个人","color":"#2db7f5","value":"Individual"}, - 'Enterprise': {"text":"企业","color":"#87d068","value":"Enterprise"}, - 'Developer': {"text":"开发商","color":"#fa8c16","value":"Developer"}, - 'Government': {"text":"政府","color":"#f5222d","value":"Government"}, +export const AssetHousesPropertyOwnershipEnum = { + Individual: { text: '个人', color: '#2db7f5', value: 'Individual' }, + Enterprise: { text: '企业', color: '#87d068', value: 'Enterprise' }, + Developer: { text: '开发商', color: '#fa8c16', value: 'Developer' }, + Government: { text: '政府', color: '#f5222d', value: 'Government' }, }; // AssetHousesStatusEnum -export const AssetHousesStatusEnum= { - 'Unsold': {"text":"未售","color":"#6c757d","value":"Unsold"}, - 'SoldNotDelivered': {"text":"已售未交房","color":"#ffc107","value":"SoldNotDelivered"}, - 'SelfOccupied': {"text":"自住","color":"#28a745","value":"SelfOccupied"}, - 'Rented': {"text":"出租","color":"#007bff","value":"Rented"}, - 'Vacant': {"text":"空置","color":"#dc3545","value":"Vacant"}, +export const AssetHousesStatusEnum = { + Unsold: { text: '未售', color: '#6c757d', value: 'Unsold' }, + SoldNotDelivered: { + text: '已售未交房', + color: '#ffc107', + value: 'SoldNotDelivered', + }, + SelfOccupied: { text: '自住', color: '#28a745', value: 'SelfOccupied' }, + Rented: { text: '出租', color: '#007bff', value: 'Rented' }, + Vacant: { text: '空置', color: '#dc3545', value: 'Vacant' }, }; // AssetHousesUsageEnum -export const AssetHousesUsageEnum= { - 'Residence': {"text":"住宅","color":"#007bff","value":"Residence"}, - 'Apartment': {"text":"公寓","color":"#28a745","value":"Apartment"}, - 'Villa': {"text":"别墅","color":"#17a2b8","value":"Villa"}, - 'Shop': {"text":"商铺","color":"#ffc107","value":"Shop"}, - 'ParkingSpace': {"text":"车位","color":"#6c757d","value":"ParkingSpace"}, - 'Office': {"text":"写字楼","color":"#6610f2","value":"Office"}, - 'Clubhouse': {"text":"会所","color":"#fd7e14","value":"Clubhouse"}, - 'PropertyRoom': {"text":"物业用房","color":"#dc3545","value":"PropertyRoom"}, +export const AssetHousesUsageEnum = { + Residence: { text: '住宅', color: '#007bff', value: 'Residence' }, + Apartment: { text: '公寓', color: '#28a745', value: 'Apartment' }, + Villa: { text: '别墅', color: '#17a2b8', value: 'Villa' }, + Shop: { text: '商铺', color: '#ffc107', value: 'Shop' }, + ParkingSpace: { text: '车位', color: '#6c757d', value: 'ParkingSpace' }, + Office: { text: '写字楼', color: '#6610f2', value: 'Office' }, + Clubhouse: { text: '会所', color: '#fd7e14', value: 'Clubhouse' }, + PropertyRoom: { text: '物业用房', color: '#dc3545', value: 'PropertyRoom' }, }; // 车场收费类型 -export const AssetParkingPlacesChargeTypeEnum= { - 'Free': {"text":"免费","color":"#32cd32","value":"Free"}, - 'TemporaryCharge': {"text":"临停收费","color":"#1e90ff","value":"TemporaryCharge"}, - 'MonthlyCharge': {"text":"月卡收费","color":"#ff8c00","value":"MonthlyCharge"}, - 'MixedCharge': {"text":"混合收费","color":"#ba55d3","value":"MixedCharge"}, +export const AssetParkingPlacesChargeTypeEnum = { + Free: { text: '免费', color: '#32cd32', value: 'Free' }, + TemporaryCharge: { + text: '临停收费', + color: '#1e90ff', + value: 'TemporaryCharge', + }, + MonthlyCharge: { text: '月卡收费', color: '#ff8c00', value: 'MonthlyCharge' }, + MixedCharge: { text: '混合收费', color: '#ba55d3', value: 'MixedCharge' }, }; // 车场位置类型 -export const AssetParkingPlacesLocationTypeEnum= { - 'GroundParking': {"text":"地面车场","color":"#ffa500","value":"GroundParking"}, - 'UndergroundParking': {"text":"地下车场","color":"#4682b4","value":"UndergroundParking"}, +export const AssetParkingPlacesLocationTypeEnum = { + GroundParking: { text: '地面车场', color: '#ffa500', value: 'GroundParking' }, + UndergroundParking: { + text: '地下车场', + color: '#4682b4', + value: 'UndergroundParking', + }, }; // 车场产权类型 -export const AssetParkingPlacesPropertyTypeEnum= { - 'DispersedOwnership': {"text":"分散产权","color":"#ff7f50","value":"DispersedOwnership"}, - 'SingleOwnership': {"text":"单一产权","color":"#1e90ff","value":"SingleOwnership"}, - 'SharedOwnership': {"text":"共有产权","color":"#32cd32","value":"SharedOwnership"}, +export const AssetParkingPlacesPropertyTypeEnum = { + DispersedOwnership: { + text: '分散产权', + color: '#ff7f50', + value: 'DispersedOwnership', + }, + SingleOwnership: { + text: '单一产权', + color: '#1e90ff', + value: 'SingleOwnership', + }, + SharedOwnership: { + text: '共有产权', + color: '#32cd32', + value: 'SharedOwnership', + }, }; // 车场类型 -export const AssetParkingPlacesTypeEnum= { - 'ResidentialSupporting': {"text":"住宅配套车场","color":"#ff8c00","value":"ResidentialSupporting"}, - 'Commercial': {"text":"商业车场","color":"#1e90ff","value":"Commercial"}, - 'Mixed': {"text":"混合车场","color":"#32cd32","value":"Mixed"}, +export const AssetParkingPlacesTypeEnum = { + ResidentialSupporting: { + text: '住宅配套车场', + color: '#ff8c00', + value: 'ResidentialSupporting', + }, + Commercial: { text: '商业车场', color: '#1e90ff', value: 'Commercial' }, + Mixed: { text: '混合车场', color: '#32cd32', value: 'Mixed' }, }; // AssetProjectsChargeEnum -export const AssetProjectsChargeEnum= { - 'Contract': {"text":"包干制","color":"#007bff","value":"Contract"}, - 'Commission': {"text":"酬金制","color":"#28a745","value":"Commission"}, +export const AssetProjectsChargeEnum = { + Contract: { text: '包干制', color: '#007bff', value: 'Contract' }, + Commission: { text: '酬金制', color: '#28a745', value: 'Commission' }, }; // AssetProjectsEntrustTypeEnum -export const AssetProjectsEntrustTypeEnum= { - 'DeveloperJointEntrust': {"text":"开发商全委","color":"#007bff","value":"DeveloperJointEntrust"}, - 'OwnersFullEntrust': {"text":"业委会全委","color":"#28a745","value":"OwnersFullEntrust"}, - 'GovernmentFullEntrust': {"text":"政府类全委","color":"#ffc107","value":"GovernmentFullEntrust"}, +export const AssetProjectsEntrustTypeEnum = { + DeveloperJointEntrust: { + text: '开发商全委', + color: '#007bff', + value: 'DeveloperJointEntrust', + }, + OwnersFullEntrust: { + text: '业委会全委', + color: '#28a745', + value: 'OwnersFullEntrust', + }, + GovernmentFullEntrust: { + text: '政府类全委', + color: '#ffc107', + value: 'GovernmentFullEntrust', + }, }; // 业权类型 -export const AssetProjectsOwnershipTypeEnum= { - 'SingleOwnership': {"text":"单业权","color":"#00cc66","value":"SingleOwnership"}, - 'MultipleOwnership': {"text":"多业权","color":"#0099ff","value":"MultipleOwnership"}, +export const AssetProjectsOwnershipTypeEnum = { + SingleOwnership: { + text: '单业权', + color: '#00cc66', + value: 'SingleOwnership', + }, + MultipleOwnership: { + text: '多业权', + color: '#0099ff', + value: 'MultipleOwnership', + }, }; // AssetProjectsPropertyTypeEnum -export const AssetProjectsPropertyTypeEnum= { - 'Residence': {"text":"住宅","color":"#ff0000","value":"Residence"}, - 'Commercial': {"text":"商业","color":"#ff6600","value":"Commercial"}, - 'Office': {"text":"办公","color":"#ffcc00","value":"Office"}, - 'IndustrialPark': {"text":"产业园","color":"#00cc66","value":"IndustrialPark"}, - 'Complex': {"text":"综合体","color":"#0099ff","value":"Complex"}, - 'Municipal': {"text":"市政设施","color":"#6633cc","value":"Municipal"}, - 'Venue': {"text":"场馆","color":"#9966ff","value":"Venue"}, - 'Education': {"text":"教育","color":"#339999","value":"Education"}, - 'Medical': {"text":"医疗","color":"#cc3366","value":"Medical"}, +export const AssetProjectsPropertyTypeEnum = { + Residence: { text: '住宅', color: '#ff0000', value: 'Residence' }, + Commercial: { text: '商业', color: '#ff6600', value: 'Commercial' }, + Office: { text: '办公', color: '#ffcc00', value: 'Office' }, + IndustrialPark: { text: '产业园', color: '#00cc66', value: 'IndustrialPark' }, + Complex: { text: '综合体', color: '#0099ff', value: 'Complex' }, + Municipal: { text: '市政设施', color: '#6633cc', value: 'Municipal' }, + Venue: { text: '场馆', color: '#9966ff', value: 'Venue' }, + Education: { text: '教育', color: '#339999', value: 'Education' }, + Medical: { text: '医疗', color: '#cc3366', value: 'Medical' }, }; // AssetProjectsStatusEnum -export const AssetProjectsStatusEnum= { - 'SignedNotDelivered': {"text":"签约未交付","color":"#6c757d","value":"SignedNotDelivered"}, - 'RollingDevelopment': {"text":"滚动开发","color":"#007bff","value":"RollingDevelopment"}, - 'ManagedAndClosed': {"text":"在管封园","color":"#ffc107","value":"ManagedAndClosed"}, - 'Exited': {"text":"退出","color":"#dc3545","value":"Exited"}, +export const AssetProjectsStatusEnum = { + SignedNotDelivered: { + text: '签约未交付', + color: '#6c757d', + value: 'SignedNotDelivered', + }, + RollingDevelopment: { + text: '滚动开发', + color: '#007bff', + value: 'RollingDevelopment', + }, + ManagedAndClosed: { + text: '在管封园', + color: '#ffc107', + value: 'ManagedAndClosed', + }, + Exited: { text: '退出', color: '#dc3545', value: 'Exited' }, }; // AssetUnitsBuildingStructureEnum -export const AssetUnitsBuildingStructureEnum= { - 'SteelConcrete': {"text":"钢混","color":"#007bff","value":"SteelConcrete"}, - 'SteelStructure': {"text":"钢结构","color":"#28a745","value":"SteelStructure"}, - 'BrickConcrete': {"text":"砖混","color":"#ffc107","value":"BrickConcrete"}, - 'BrickWood': {"text":"砖木","color":"#dc3545","value":"BrickWood"}, +export const AssetUnitsBuildingStructureEnum = { + SteelConcrete: { text: '钢混', color: '#007bff', value: 'SteelConcrete' }, + SteelStructure: { text: '钢结构', color: '#28a745', value: 'SteelStructure' }, + BrickConcrete: { text: '砖混', color: '#ffc107', value: 'BrickConcrete' }, + BrickWood: { text: '砖木', color: '#dc3545', value: 'BrickWood' }, }; // AssetUnitsBuildingTypeEnum -export const AssetUnitsBuildingTypeEnum= { - 'SlabAndTower': {"text":"板塔结合","color":"#007bff","value":"SlabAndTower"}, - 'Slab': {"text":"板楼","color":"#28a745","value":"Slab"}, - 'Tower': {"text":"塔楼","color":"#ffc107","value":"Tower"}, +export const AssetUnitsBuildingTypeEnum = { + SlabAndTower: { text: '板塔结合', color: '#007bff', value: 'SlabAndTower' }, + Slab: { text: '板楼', color: '#28a745', value: 'Slab' }, + Tower: { text: '塔楼', color: '#ffc107', value: 'Tower' }, }; // AttendanceRecordsCheckinTypeEnum -export const AttendanceRecordsCheckinTypeEnum= { - 'CheckIn': {"text":"上班","color":"#1890ff","value":"CheckIn"}, - 'CheckOut': {"text":"下班","color":"#52c41a","value":"CheckOut"}, +export const AttendanceRecordsCheckinTypeEnum = { + CheckIn: { text: '上班', color: '#1890ff', value: 'CheckIn' }, + CheckOut: { text: '下班', color: '#52c41a', value: 'CheckOut' }, }; // AttendanceRecordsStatusEnum -export const AttendanceRecordsStatusEnum= { - 'Normal': {"text":"正常","color":"#52c41a","value":"Normal"}, - 'Late': {"text":"迟到","color":"#faad14","value":"Late"}, - 'EarlyLeave': {"text":"早退","color":"#fa8c16","value":"EarlyLeave"}, - 'OutOfRange': {"text":"范围外","color":"#ff4d4f","value":"OutOfRange"}, - 'Reissue': {"text":"补卡","color":"#1890ff","value":"Reissue"}, +export const AttendanceRecordsStatusEnum = { + Normal: { text: '正常', color: '#52c41a', value: 'Normal' }, + Late: { text: '迟到', color: '#faad14', value: 'Late' }, + EarlyLeave: { text: '早退', color: '#fa8c16', value: 'EarlyLeave' }, + OutOfRange: { text: '范围外', color: '#ff4d4f', value: 'OutOfRange' }, + Reissue: { text: '补卡', color: '#1890ff', value: 'Reissue' }, }; // AttendanceSchedulesStatusEnum -export const AttendanceSchedulesStatusEnum= { - 'Pending': {"text":"待生效","color":"#faad14","value":"Pending"}, - 'Active': {"text":"生效中","color":"#52c41a","value":"Active"}, - 'Cancelled': {"text":"已取消","color":"#ff4d4f","value":"Cancelled"}, +export const AttendanceSchedulesStatusEnum = { + Pending: { text: '待生效', color: '#faad14', value: 'Pending' }, + Active: { text: '生效中', color: '#52c41a', value: 'Active' }, + Cancelled: { text: '已取消', color: '#ff4d4f', value: 'Cancelled' }, }; // 打卡状态枚举 -export const AttendanceStatusEnum= { - 'Normal': {"text":"正常","color":"#52c41a","value":"Normal"}, - 'Late': {"text":"迟到","color":"#faad14","value":"Late"}, - 'Early': {"text":"早退","color":"#faad14","value":"Early"}, - 'OutOfRange': {"text":"范围外","color":"#ff4d4f","value":"OutOfRange"}, - 'MakeUp': {"text":"补卡","color":"#722ed1","value":"MakeUp"}, +export const AttendanceStatusEnum = { + Normal: { text: '正常', color: '#52c41a', value: 'Normal' }, + Late: { text: '迟到', color: '#faad14', value: 'Late' }, + Early: { text: '早退', color: '#faad14', value: 'Early' }, + OutOfRange: { text: '范围外', color: '#ff4d4f', value: 'OutOfRange' }, + MakeUp: { text: '补卡', color: '#722ed1', value: 'MakeUp' }, }; // BannerSpacesTypeEnum -export const BannerSpacesTypeEnum= { - 'Popup': {"text":"弹窗","color":"#ff0000","value":"Popup"}, - 'Banner': {"text":"横幅广告","color":"#00ff00","value":"Banner"}, - 'FloatingButton': {"text":"悬浮按钮","color":"#0000ff","value":"FloatingButton"}, +export const BannerSpacesTypeEnum = { + Popup: { text: '弹窗', color: '#ff0000', value: 'Popup' }, + Banner: { text: '横幅广告', color: '#00ff00', value: 'Banner' }, + FloatingButton: { + text: '悬浮按钮', + color: '#0000ff', + value: 'FloatingButton', + }, }; // BannersRedirectTypeEnum -export const BannersRedirectTypeEnum= { - 'InnerPage': {"text":"跳内页","color":"#ff0000","value":"InnerPage"}, - 'H5': {"text":"跳H5","color":"#00ff00","value":"H5"}, - 'MiniProgramHome': {"text":"跳小程序首屏","color":"#0000ff","value":"MiniProgramHome"}, - 'AnotherMiniProgram': {"text":"跳另一个小程序","color":"#ffa500","value":"AnotherMiniProgram"}, +export const BannersRedirectTypeEnum = { + InnerPage: { text: '跳内页', color: '#ff0000', value: 'InnerPage' }, + H5: { text: '跳H5', color: '#00ff00', value: 'H5' }, + MiniProgramHome: { + text: '跳小程序首屏', + color: '#0000ff', + value: 'MiniProgramHome', + }, + AnotherMiniProgram: { + text: '跳另一个小程序', + color: '#ffa500', + value: 'AnotherMiniProgram', + }, }; // BannersTypeEnum -export const BannersTypeEnum= { - 'Image': {"text":"图片","color":"#ff0000","value":"Image"}, - 'Video': {"text":"视频","color":"#00ff00","value":"Video"}, - 'Text': {"text":"文本","color":"#0000ff","value":"Text"}, +export const BannersTypeEnum = { + Image: { text: '图片', color: '#ff0000', value: 'Image' }, + Video: { text: '视频', color: '#00ff00', value: 'Video' }, + Text: { text: '文本', color: '#0000ff', value: 'Text' }, }; // 缓存类型 -export const CacheTypeEnum= { - 'MobilePhoneVerificationCode': {"text":"手机验证码","color":"#827a7d","value":"MobilePhoneVerificationCode"}, +export const CacheTypeEnum = { + MobilePhoneVerificationCode: { + text: '手机验证码', + color: '#d35ae4', + value: 'MobilePhoneVerificationCode', + }, }; // CompaniesMerchantTypeEnum -export const CompaniesMerchantTypeEnum= { - 'PropertyManagement': {"text":"物业公司","color":"#007bff","value":"PropertyManagement"}, - 'ServiceProvider': {"text":"服务商","color":"#28a745","value":"ServiceProvider"}, +export const CompaniesMerchantTypeEnum = { + PropertyManagement: { + text: '物业公司', + color: '#007bff', + value: 'PropertyManagement', + }, + ServiceProvider: { + text: '服务商', + color: '#28a745', + value: 'ServiceProvider', + }, }; // CompanyAppsAppTypeEnum -export const CompanyAppsAppTypeEnum= { - 'MiniProgram': {"text":"微信小程序","color":"#3b82f6","value":"MiniProgram"}, - 'MpOfficial': {"text":"微信公众号","color":"#22c55e","value":"MpOfficial"}, - 'WorkWechat': {"text":"企业微信","color":"#6366f1","value":"WorkWechat"}, +export const CompanyAppsAppTypeEnum = { + MiniProgram: { text: '微信小程序', color: '#3b82f6', value: 'MiniProgram' }, + MpOfficial: { text: '微信公众号', color: '#22c55e', value: 'MpOfficial' }, + WorkWechat: { text: '企业微信', color: '#6366f1', value: 'WorkWechat' }, }; // CompanyAppsModuleEnum -export const CompanyAppsModuleEnum= { - 'Employee': {"text":"员工端","color":"#3b82f6","value":"Employee"}, - 'Customer': {"text":"客户端","color":"#10b981","value":"Customer"}, +export const CompanyAppsModuleEnum = { + Employee: { text: '员工端', color: '#3b82f6', value: 'Employee' }, + Customer: { text: '客户端', color: '#10b981', value: 'Customer' }, }; // CompanyAppsWorkTypeEnum -export const CompanyAppsWorkTypeEnum= { - 'WorkWechatApp': {"text":"企微应用","color":"#00c853","value":"WorkWechatApp"}, - 'WorkWechat': {"text":"企微","color":"#0091ea","value":"WorkWechat"}, +export const CompanyAppsWorkTypeEnum = { + WorkWechatApp: { text: '企微应用', color: '#00c853', value: 'WorkWechatApp' }, + WorkWechat: { text: '企微', color: '#0091ea', value: 'WorkWechat' }, }; // CompanyConfigsConfigKeyEnum -export const CompanyConfigsConfigKeyEnum= { - 'Theme': {"text":"主题色","color":"#3b82f6","value":"Theme"}, +export const CompanyConfigsConfigKeyEnum = { + Theme: { text: '主题色', color: '#3b82f6', value: 'Theme' }, }; // CompanyEmployeeBacklogsStatusEnum -export const CompanyEmployeeBacklogsStatusEnum= { - 'Pending': {"text":"待办","color":"#FF6600","value":"Pending"}, - 'Completed': {"text":"已办","color":"#2A82E4","value":"Completed"}, +export const CompanyEmployeeBacklogsStatusEnum = { + Pending: { text: '待办', color: '#FF6600', value: 'Pending' }, + Completed: { text: '已办', color: '#2A82E4', value: 'Completed' }, }; // CompanyEmployeeBacklogsTypeEnum -export const CompanyEmployeeBacklogsTypeEnum= { - 'WorkOrder': {"text":"工单","color":"#FF6600","value":"WorkOrder"}, - 'Contract': {"text":"合同","color":"#2A82E4","value":"Contract"}, - 'MomentTask': {"text":"朋友圈任务","color":"#FF6600","value":"MomentTask"}, +export const CompanyEmployeeBacklogsTypeEnum = { + WorkOrder: { text: '工单', color: '#FF6600', value: 'WorkOrder' }, + Contract: { text: '合同', color: '#2A82E4', value: 'Contract' }, + MomentTask: { text: '朋友圈任务', color: '#FF6600', value: 'MomentTask' }, }; // CompanyEmployeesTypeEnum -export const CompanyEmployeesTypeEnum= { - 'Staff': {"text":"员工","color":"#1890ff","value":"Staff"}, - 'WeCom': {"text":"企微","color":"#2196f3","value":"WeCom"}, - 'External': {"text":"外部","color":"#4caf50","value":"External"}, +export const CompanyEmployeesTypeEnum = { + Staff: { text: '员工', color: '#1890ff', value: 'Staff' }, + WeCom: { text: '企微', color: '#2196f3', value: 'WeCom' }, + External: { text: '外部', color: '#4caf50', value: 'External' }, }; // CompanyReceiptAccountsPayChannelEnum -export const CompanyReceiptAccountsPayChannelEnum= { - 'WeChat': {"text":"微信","color":"#07c160","value":"WeChat"}, - 'Alipay': {"text":"支付宝","color":"#1677ff","value":"Alipay"}, - 'BankTransfer': {"text":"银行转账","color":"#6c757d","value":"BankTransfer"}, - 'TongLian': {"text":"通联支付","color":"#ff9f0a","value":"TongLian"}, +export const CompanyReceiptAccountsPayChannelEnum = { + WeChat: { text: '微信', color: '#07c160', value: 'WeChat' }, + Alipay: { text: '支付宝', color: '#1677ff', value: 'Alipay' }, + BankTransfer: { text: '银行转账', color: '#6c757d', value: 'BankTransfer' }, + TongLian: { text: '通联支付', color: '#ff9f0a', value: 'TongLian' }, }; // ConvenienceServicesTypeEnum -export const ConvenienceServicesTypeEnum= { - 'PropertyExclusive': {"text":"物业专属","color":"#8b5cf6","value":"PropertyExclusive"}, - 'EmergencyRepair': {"text":"紧急抢修","color":"#ef4444","value":"EmergencyRepair"}, - 'LifeService': {"text":"生活服务","color":"#3b82f6","value":"LifeService"}, - 'GovernmentConsulting': {"text":"政务咨询","color":"#10b981","value":"GovernmentConsulting"}, +export const ConvenienceServicesTypeEnum = { + PropertyExclusive: { + text: '物业专属', + color: '#8b5cf6', + value: 'PropertyExclusive', + }, + EmergencyRepair: { + text: '紧急抢修', + color: '#ef4444', + value: 'EmergencyRepair', + }, + LifeService: { text: '生活服务', color: '#3b82f6', value: 'LifeService' }, + GovernmentConsulting: { + text: '政务咨询', + color: '#10b981', + value: 'GovernmentConsulting', + }, }; // CustomerBacklogsStatusEnum -export const CustomerBacklogsStatusEnum= { - 'Pending': {"text":"待办","color":"#faad14","value":"Pending"}, - 'Completed': {"text":"已办","color":"#2A82E4","value":"Completed"}, +export const CustomerBacklogsStatusEnum = { + Pending: { text: '待办', color: '#faad14', value: 'Pending' }, + Completed: { text: '已办', color: '#2A82E4', value: 'Completed' }, }; // CustomerBacklogsTypeEnum -export const CustomerBacklogsTypeEnum= { - 'RegisterApply': {"text":"登记申请","color":"#2db7f5","value":"RegisterApply"}, - 'PaymentPending': {"text":"费用待缴","color":"#faad14","value":"PaymentPending"}, - 'ContractTodo': {"text":"合同待办","color":"#722ed1","value":"ContractTodo"}, +export const CustomerBacklogsTypeEnum = { + RegisterApply: { text: '登记申请', color: '#2db7f5', value: 'RegisterApply' }, + PaymentPending: { + text: '费用待缴', + color: '#faad14', + value: 'PaymentPending', + }, + ContractTodo: { text: '合同待办', color: '#722ed1', value: 'ContractTodo' }, }; // CustomerMomentTasksStatusEnum -export const CustomerMomentTasksStatusEnum= { - 'NotSent': {"text":"未发","color":"#FF4500","value":"NotSent"}, - 'Sent': {"text":"已发","color":"#32CD32","value":"Sent"}, +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"}, - 'CustomerDirectCorp': {"text":"客户1对1消息群发(企业)","color":"#FFA500","value":"CustomerDirectCorp"}, - 'CustomerGroupCorp': {"text":"客户群群发(企业)","color":"#FF69B4","value":"CustomerGroupCorp"}, +export const CustomerMomentsChannelEnum = { + MomentCorp: { text: '朋友圈(企业)', color: '#1E90FF', value: 'MomentCorp' }, + 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"}, +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"}, +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"}, +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"}, +export const CustomerMomentsRangeTypeEnum = { + Project: { text: '按项目推送', color: '#1E90FF', value: 'Project' }, }; // CustomerMomentsSkipTypeEnum -export const CustomerMomentsSkipTypeEnum= { - 'H5': {"text":"H5","color":"#1E90FF","value":"H5"}, +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"}, +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"}, - 'FeatureSuggestion': {"text":"新功能建议","color":"#00bfff","value":"FeatureSuggestion"}, +export const CustomerOpinionsTypeEnum = { + FeatureException: { + text: '功能异常', + color: '#ff0000', + value: 'FeatureException', + }, + FeatureSuggestion: { + text: '新功能建议', + color: '#00bfff', + value: 'FeatureSuggestion', + }, }; // 物品放行审核状态 -export const GoodsReleasesAuditStatusEnum= { - 'Pending': {"text":"待审核","color":"#faad14","value":"Pending"}, - 'Approved': {"text":"已通过","color":"#52c41a","value":"Approved"}, - 'Rejected': {"text":"已退回","color":"#ff4d4f","value":"Rejected"}, +export const GoodsReleasesAuditStatusEnum = { + Pending: { text: '待审核', color: '#faad14', value: 'Pending' }, + Approved: { text: '已通过', color: '#52c41a', value: 'Approved' }, + Rejected: { text: '已退回', color: '#ff4d4f', value: 'Rejected' }, }; // 物品放行通行类型 -export const GoodsReleasesPassedTypeEnum= { - 'Moving': {"text":"搬家","color":"#1890ff","value":"Moving"}, - 'Delivery': {"text":"出货","color":"#52c41a","value":"Delivery"}, - 'Other': {"text":"其他","color":"#faad14","value":"Other"}, +export const GoodsReleasesPassedTypeEnum = { + Moving: { text: '搬家', color: '#1890ff', value: 'Moving' }, + Delivery: { text: '出货', color: '#52c41a', value: 'Delivery' }, + Other: { text: '其他', color: '#faad14', value: 'Other' }, }; // 物品放行状态 -export const GoodsReleasesStatusEnum= { - 'Pending': {"text":"待审核","color":"#faad14","value":"Pending"}, - 'OwnerApproved': {"text":"业主已审","color":"#1890ff","value":"OwnerApproved"}, - 'Approved': {"text":"已通过","color":"#52c41a","value":"Approved"}, - 'Rejected': {"text":"已退回","color":"#ff4d4f","value":"Rejected"}, - 'Released': {"text":"已放行","color":"#722ed1","value":"Released"}, +export const GoodsReleasesStatusEnum = { + Pending: { text: '待审核', color: '#faad14', value: 'Pending' }, + OwnerApproved: { text: '业主已审', color: '#1890ff', value: 'OwnerApproved' }, + Approved: { text: '已通过', color: '#52c41a', value: 'Approved' }, + Rejected: { text: '已退回', color: '#ff4d4f', value: 'Rejected' }, + Released: { text: '已放行', color: '#722ed1', value: 'Released' }, }; // 账单状态枚举 -export const HouseBillsBillStatusEnum= { - 'PendingPayment': {"text":"待收款","color":"#facc15","value":"PendingPayment"}, - 'ToBeConfirmed': {"text":"待确认","color":"#fb923c","value":"ToBeConfirmed"}, - 'PartiallyPaid': {"text":"部分收款","color":"#60a5fa","value":"PartiallyPaid"}, - 'Paid': {"text":"已收款","color":"#10b981","value":"Paid"}, - 'Overdue': {"text":"已逾期","color":"#ef4444","value":"Overdue"}, - 'Cancelled': {"text":"已取消","color":"#9ca3af","value":"Cancelled"}, +export const HouseBillsBillStatusEnum = { + PendingPayment: { text: '待收款', color: '#facc15', value: 'PendingPayment' }, + ToBeConfirmed: { text: '待确认', color: '#fb923c', value: 'ToBeConfirmed' }, + PartiallyPaid: { text: '部分收款', color: '#60a5fa', value: 'PartiallyPaid' }, + Paid: { text: '已收款', color: '#10b981', value: 'Paid' }, + Overdue: { text: '已逾期', color: '#ef4444', value: 'Overdue' }, + Cancelled: { text: '已取消', color: '#9ca3af', value: 'Cancelled' }, }; // 房屋账单类型枚举 -export const HouseBillsTypeEnum= { - 'PropertyFee': {"text":"物业费","color":"#3b82f6","value":"PropertyFee"}, - 'MaintenanceFund': {"text":"维修基金","color":"#10b981","value":"MaintenanceFund"}, - 'WaterFee': {"text":"水费","color":"#06b6d4","value":"WaterFee"}, - 'ElectricityFee': {"text":"电费","color":"#f59e0b","value":"ElectricityFee"}, - 'SharedWaterFee': {"text":"公摊水费","color":"#8b5cf6","value":"SharedWaterFee"}, - 'SharedElectricityFee': {"text":"公摊电费","color":"#ec4899","value":"SharedElectricityFee"}, - 'CarPortFee': {"text":"车位费","color":"#f59e0b","value":"CarPortFee"}, - 'WorkOrderRepairFee': {"text":"工单维修费","color":"#f97316","value":"WorkOrderRepairFee"}, +export const HouseBillsTypeEnum = { + PropertyFee: { text: '物业费', color: '#3b82f6', value: 'PropertyFee' }, + MaintenanceFund: { + text: '维修基金', + color: '#10b981', + value: 'MaintenanceFund', + }, + WaterFee: { text: '水费', color: '#06b6d4', value: 'WaterFee' }, + ElectricityFee: { text: '电费', color: '#f59e0b', value: 'ElectricityFee' }, + SharedWaterFee: { + text: '公摊水费', + color: '#8b5cf6', + value: 'SharedWaterFee', + }, + SharedElectricityFee: { + text: '公摊电费', + color: '#ec4899', + value: 'SharedElectricityFee', + }, + CarPortFee: { text: '车位费', color: '#f59e0b', value: 'CarPortFee' }, + WorkOrderRepairFee: { + text: '工单维修费', + color: '#f97316', + value: 'WorkOrderRepairFee', + }, }; // HouseChargeStandardsApportionmentMethodEnum -export const HouseChargeStandardsApportionmentMethodEnum= { - 'HouseCount': {"text":"房屋数分摊","color":"#3b82f6","value":"HouseCount"}, - 'AreaProportion': {"text":"房屋计费面积分摊","color":"#10b981","value":"AreaProportion"}, - 'FixedRatio': {"text":"按固定比例分摊","color":"#f59e0b","value":"FixedRatio"}, +export const HouseChargeStandardsApportionmentMethodEnum = { + HouseCount: { text: '房屋数分摊', color: '#3b82f6', value: 'HouseCount' }, + AreaProportion: { + text: '房屋计费面积分摊', + color: '#10b981', + value: 'AreaProportion', + }, + FixedRatio: { text: '按固定比例分摊', color: '#f59e0b', value: 'FixedRatio' }, }; // HouseChargeStandardsCalculationMethodEnum -export const HouseChargeStandardsCalculationMethodEnum= { - 'ChargeableArea': {"text":"计费面积","color":"#3b82f6","value":"ChargeableArea"}, - 'BuiltArea': {"text":"建筑面积","color":"#10b981","value":"BuiltArea"}, - 'InsideArea': {"text":"套内面积","color":"#f59e0b","value":"InsideArea"}, - 'PerUnit': {"text":"按套","color":"#06b6d4","value":"PerUnit"}, - 'ElectricityUsage': {"text":"用电量","color":"#8b5cf6","value":"ElectricityUsage"}, - 'WaterUsage': {"text":"用水量","color":"#ec4899","value":"WaterUsage"}, +export const HouseChargeStandardsCalculationMethodEnum = { + ChargeableArea: { + text: '计费面积', + color: '#3b82f6', + value: 'ChargeableArea', + }, + BuiltArea: { text: '建筑面积', color: '#10b981', value: 'BuiltArea' }, + InsideArea: { text: '套内面积', color: '#f59e0b', value: 'InsideArea' }, + PerUnit: { text: '按套', color: '#06b6d4', value: 'PerUnit' }, + ElectricityUsage: { + text: '用电量', + color: '#8b5cf6', + value: 'ElectricityUsage', + }, + WaterUsage: { text: '用水量', color: '#ec4899', value: 'WaterUsage' }, }; // HouseChargeStandardsCalculationModeEnum -export const HouseChargeStandardsCalculationModeEnum= { - 'FixedAmount': {"text":"固定金额","color":"#3b82f6","value":"FixedAmount"}, - 'QuantityPrice': {"text":"数量*单价","color":"#10b981","value":"QuantityPrice"}, +export const HouseChargeStandardsCalculationModeEnum = { + FixedAmount: { text: '固定金额', color: '#3b82f6', value: 'FixedAmount' }, + QuantityPrice: { + text: '数量*单价', + color: '#10b981', + value: 'QuantityPrice', + }, }; // HouseChargeStandardsCalculationPeriodEnum -export const HouseChargeStandardsCalculationPeriodEnum= { - 'PerTime': {"text":"按次","color":"#3b82f6","value":"PerTime"}, - 'PerDay': {"text":"按日","color":"#10b981","value":"PerDay"}, - 'PerMonth': {"text":"按月","color":"#f59e0b","value":"PerMonth"}, - 'PerYear': {"text":"按年","color":"#8b5cf6","value":"PerYear"}, +export const HouseChargeStandardsCalculationPeriodEnum = { + PerTime: { text: '按次', color: '#3b82f6', value: 'PerTime' }, + PerDay: { text: '按日', color: '#10b981', value: 'PerDay' }, + PerMonth: { text: '按月', color: '#f59e0b', value: 'PerMonth' }, + PerYear: { text: '按年', color: '#8b5cf6', value: 'PerYear' }, }; // HouseChargeStandardsPriceAlgorithmEnum -export const HouseChargeStandardsPriceAlgorithmEnum= { - 'Fixed': {"text":"固定","color":"#4caf50","value":"Fixed"}, - 'Tiered': {"text":"分级价阶梯","color":"#2196f3","value":"Tiered"}, - 'Peak': {"text":"最高价阶梯","color":"#ff9800","value":"Peak"}, +export const HouseChargeStandardsPriceAlgorithmEnum = { + Fixed: { text: '固定', color: '#4caf50', value: 'Fixed' }, + Tiered: { text: '分级价阶梯', color: '#2196f3', value: 'Tiered' }, + Peak: { text: '最高价阶梯', color: '#ff9800', value: 'Peak' }, }; // HouseChargeStandardsStatusEnum -export const HouseChargeStandardsStatusEnum= { - 'Active': {"text":"启用","color":"#3b82f6","value":"Active"}, - 'Inactive': {"text":"禁用","color":"#ef4444","value":"Inactive"}, +export const HouseChargeStandardsStatusEnum = { + Active: { text: '启用', color: '#3b82f6', value: 'Active' }, + Inactive: { text: '禁用', color: '#ef4444', value: 'Inactive' }, }; // HouseChargeStandardsTypeEnum -export const HouseChargeStandardsTypeEnum= { - 'House': {"text":"房屋","color":"#3b82f6","value":"House"}, - 'Meter': {"text":"仪表","color":"#10b981","value":"Meter"}, - 'CarPort': {"text":"车位","color":"#f59e0b","value":"CarPort"}, +export const HouseChargeStandardsTypeEnum = { + House: { text: '房屋', color: '#3b82f6', value: 'House' }, + Meter: { text: '仪表', color: '#10b981', value: 'Meter' }, + CarPort: { text: '车位', color: '#f59e0b', value: 'CarPort' }, }; // HouseChargeTaskDetailsStatusEnum -export const HouseChargeTaskDetailsStatusEnum= { - 'Pending': {"text":"待处理","color":"#f59e0b","value":"Pending"}, - 'Success': {"text":"成功","color":"#22c55e","value":"Success"}, - 'Failed': {"text":"失败","color":"#ef4444","value":"Failed"}, +export const HouseChargeTaskDetailsStatusEnum = { + Pending: { text: '待处理', color: '#f59e0b', value: 'Pending' }, + Success: { text: '成功', color: '#22c55e', value: 'Success' }, + Failed: { text: '失败', color: '#ef4444', value: 'Failed' }, }; // HouseChargeTaskDetailsTargetTypeEnum -export const HouseChargeTaskDetailsTargetTypeEnum= { - 'House': {"text":"房屋","color":"#3b82f6","value":"House"}, - 'CarPort': {"text":"车位","color":"#f59e0b","value":"CarPort"}, +export const HouseChargeTaskDetailsTargetTypeEnum = { + House: { text: '房屋', color: '#3b82f6', value: 'House' }, + CarPort: { text: '车位', color: '#f59e0b', value: 'CarPort' }, }; // HouseChargeTasksStatusEnum -export const HouseChargeTasksStatusEnum= { - 'Pending': {"text":"待执行","color":"#f59e0b","value":"Pending"}, - 'InProgress': {"text":"执行中","color":"#3b82f6","value":"InProgress"}, - 'Completed': {"text":"已完成","color":"#10b981","value":"Completed"}, - 'Failed': {"text":"失败","color":"#ef4444","value":"Failed"}, +export const HouseChargeTasksStatusEnum = { + Pending: { text: '待执行', color: '#f59e0b', value: 'Pending' }, + InProgress: { text: '执行中', color: '#3b82f6', value: 'InProgress' }, + Completed: { text: '已完成', color: '#10b981', value: 'Completed' }, + Failed: { text: '失败', color: '#ef4444', value: 'Failed' }, }; // HouseChargeTasksTypeEnum -export const HouseChargeTasksTypeEnum= { - 'Scheduled': {"text":"定时创建","color":"#3b82f6","value":"Scheduled"}, - 'Manual': {"text":"手动创建","color":"#10b981","value":"Manual"}, +export const HouseChargeTasksTypeEnum = { + Scheduled: { text: '定时创建', color: '#3b82f6', value: 'Scheduled' }, + Manual: { text: '手动创建', color: '#10b981', value: 'Manual' }, }; // HouseCollectionRecordsCollectionResultEnum -export const HouseCollectionRecordsCollectionResultEnum= { - 'PromiseToPay': {"text":"承诺缴费","color":"#4caf50","value":"PromiseToPay"}, - 'RefuseToPay': {"text":"拒绝缴费","color":"#f44336","value":"RefuseToPay"}, - 'NotReached': {"text":"未联系到","color":"#9e9e9e","value":"NotReached"}, - 'NeedFollowUp': {"text":"需要跟进","color":"#ff9800","value":"NeedFollowUp"}, +export const HouseCollectionRecordsCollectionResultEnum = { + PromiseToPay: { text: '承诺缴费', color: '#4caf50', value: 'PromiseToPay' }, + RefuseToPay: { text: '拒绝缴费', color: '#f44336', value: 'RefuseToPay' }, + NotReached: { text: '未联系到', color: '#9e9e9e', value: 'NotReached' }, + NeedFollowUp: { text: '需要跟进', color: '#ff9800', value: 'NeedFollowUp' }, }; // HouseCollectionRecordsSmsStatusEnum -export const HouseCollectionRecordsStatusEnum= { - 'NotNotified': {"text":"未通知","color":"#808080","value":"NotNotified"}, - 'Notified': {"text":"已通知","color":"#00cc00","value":"Notified"}, - 'Failed': {"text":"失败","color":"#ff0000","value":"Failed"}, +export const HouseCollectionRecordsStatusEnum = { + NotNotified: { text: '未通知', color: '#808080', value: 'NotNotified' }, + Notified: { text: '已通知', color: '#00cc00', value: 'Notified' }, + Failed: { text: '失败', color: '#ff0000', value: 'Failed' }, }; // HouseCollectionTasksChannelEnum -export const HouseCollectionTasksChannelEnum= { - 'SMS': {"text":"短信","color":"#1E90FF","value":"SMS"}, - 'MiniProgram': {"text":"小程序","color":"#00BFFF","value":"MiniProgram"}, - 'OfficialAccount': {"text":"公众号","color":"#32CD32","value":"OfficialAccount"}, - 'PhoneCall': {"text":"电话催缴","color":"#FF8C00","value":"PhoneCall"}, - 'Visit': {"text":"上门催缴","color":"#8B4513","value":"Visit"}, - 'WeChat': {"text":"微信联系","color":"#20B2AA","value":"WeChat"}, - 'WrittenNotice': {"text":"书面通知","color":"#708090","value":"WrittenNotice"}, +export const HouseCollectionTasksChannelEnum = { + SMS: { text: '短信', color: '#1E90FF', value: 'SMS' }, + MiniProgram: { text: '小程序', color: '#00BFFF', value: 'MiniProgram' }, + OfficialAccount: { + text: '公众号', + color: '#32CD32', + value: 'OfficialAccount', + }, + PhoneCall: { text: '电话催缴', color: '#FF8C00', value: 'PhoneCall' }, + Visit: { text: '上门催缴', color: '#8B4513', value: 'Visit' }, + WeChat: { text: '微信联系', color: '#20B2AA', value: 'WeChat' }, + WrittenNotice: { text: '书面通知', color: '#708090', value: 'WrittenNotice' }, }; // HouseCollectionTasksStatusEnum -export const HouseCollectionTasksStatusEnum= { - 'Processing': {"text":"进行中","color":"#ffcc00","value":"Processing"}, - 'Completed': {"text":"已完成","color":"#00cc00","value":"Completed"}, - 'Failed': {"text":"失败","color":"#ff0000","value":"Failed"}, +export const HouseCollectionTasksStatusEnum = { + Processing: { text: '进行中', color: '#ffcc00', value: 'Processing' }, + Completed: { text: '已完成', color: '#00cc00', value: 'Completed' }, + Failed: { text: '失败', color: '#ff0000', value: 'Failed' }, }; // HouseMeterReadingsOperationTypeEnum -export const HouseMeterReadingsOperationTypeEnum= { - 'NormalReading': {"text":"正常抄表","color":"#4caf50","value":"NormalReading"}, - 'ResetReading': {"text":"重置读数","color":"#f44336","value":"ResetReading"}, - 'CorrectReading': {"text":"修正读数","color":"#ff9800","value":"CorrectReading"}, +export const HouseMeterReadingsOperationTypeEnum = { + NormalReading: { text: '正常抄表', color: '#4caf50', value: 'NormalReading' }, + ResetReading: { text: '重置读数', color: '#f44336', value: 'ResetReading' }, + CorrectReading: { + text: '修正读数', + color: '#ff9800', + value: 'CorrectReading', + }, }; // HouseMeterTasksGenerationMethodEnum -export const HouseMeterTasksGenerationMethodEnum= { - 'Building': {"text":"按楼栋","color":"#4caf50","value":"Building"}, - 'Unit': {"text":"按单元","color":"#2196f3","value":"Unit"}, - 'Meter': {"text":"按仪表","color":"#ff9800","value":"Meter"}, +export const HouseMeterTasksGenerationMethodEnum = { + Building: { text: '按楼栋', color: '#4caf50', value: 'Building' }, + Unit: { text: '按单元', color: '#2196f3', value: 'Unit' }, + Meter: { text: '按仪表', color: '#ff9800', value: 'Meter' }, }; // HouseMetersMeterTypeEnum -export const HouseMetersMeterTypeEnum= { - 'HouseMeter': {"text":"房屋表","color":"#4caf50","value":"HouseMeter"}, - 'CommonMeter': {"text":"公摊表","color":"#2196f3","value":"CommonMeter"}, +export const HouseMetersMeterTypeEnum = { + HouseMeter: { text: '房屋表', color: '#4caf50', value: 'HouseMeter' }, + CommonMeter: { text: '公摊表', color: '#2196f3', value: 'CommonMeter' }, }; // HouseMetersUsageTypeEnum -export const HouseMetersUsageTypeEnum= { - 'WaterMeter': {"text":"水表","color":"#2196f3","value":"WaterMeter"}, - 'ElectricMeter': {"text":"电表","color":"#ff9800","value":"ElectricMeter"}, - 'GasMeter': {"text":"燃气表","color":"#f44336","value":"GasMeter"}, - 'HeatingMeter': {"text":"暖气表","color":"#9c27b0","value":"HeatingMeter"}, +export const HouseMetersUsageTypeEnum = { + WaterMeter: { text: '水表', color: '#2196f3', value: 'WaterMeter' }, + ElectricMeter: { text: '电表', color: '#ff9800', value: 'ElectricMeter' }, + GasMeter: { text: '燃气表', color: '#f44336', value: 'GasMeter' }, + HeatingMeter: { text: '暖气表', color: '#9c27b0', value: 'HeatingMeter' }, }; // HouseOccupantsCardTypeEnum -export const HouseOccupantsCardTypeEnum= { - 'MainlandID': {"text":"中国大陆居民身份证","color":"#2db7f5","value":"MainlandID"}, - 'HKPermit': {"text":"香港来往大陆通行证(回乡证)","color":"#fa8c16","value":"HKPermit"}, - 'MOPermit': {"text":"澳门来往大陆通行证(回乡证)","color":"#faad14","value":"MOPermit"}, - 'TWPermit': {"text":"台湾来往大陆通行证(台胞证)","color":"#87d068","value":"TWPermit"}, - 'Passport': {"text":"护照","color":"#108ee9","value":"Passport"}, - 'BusinessLicense': {"text":"营业执照","color":"#f5222d","value":"BusinessLicense"}, +export const HouseOccupantsCardTypeEnum = { + MainlandID: { + text: '中国大陆居民身份证', + color: '#2db7f5', + value: 'MainlandID', + }, + HKPermit: { + text: '香港来往大陆通行证(回乡证)', + color: '#fa8c16', + value: 'HKPermit', + }, + MOPermit: { + text: '澳门来往大陆通行证(回乡证)', + color: '#faad14', + value: 'MOPermit', + }, + TWPermit: { + text: '台湾来往大陆通行证(台胞证)', + color: '#87d068', + value: 'TWPermit', + }, + Passport: { text: '护照', color: '#108ee9', value: 'Passport' }, + BusinessLicense: { + text: '营业执照', + color: '#f5222d', + value: 'BusinessLicense', + }, }; // HouseOccupantsHouseRelationEnum -export const HouseOccupantsHouseRelationEnum= { - 'Owner': {"text":"产权人","color":"#2db7f5","value":"Owner"}, - 'NonOwner': {"text":"非产权人","color":"#fa8c16","value":"NonOwner"}, +export const HouseOccupantsHouseRelationEnum = { + Owner: { text: '产权人', color: '#2db7f5', value: 'Owner' }, + NonOwner: { text: '非产权人', color: '#fa8c16', value: 'NonOwner' }, }; // HouseOccupantsRelationWithOwnerEnum -export const HouseOccupantsRelationWithOwnerEnum= { - 'Self': {"text":"本人","color":"#52c41a","value":"Self"}, - 'Spouse': {"text":"配偶","color":"#2db7f5","value":"Spouse"}, - 'Children': {"text":"子女","color":"#87d068","value":"Children"}, - 'Parents': {"text":"父母","color":"#faad14","value":"Parents"}, - 'Siblings': {"text":"兄弟姐妹","color":"#fa8c16","value":"Siblings"}, - 'OtherRelatives': {"text":"其他","color":"#f5222d","value":"OtherRelatives"}, - 'PrimaryTenant': {"text":"主租客","color":"#722ed1","value":"PrimaryTenant"}, - 'Tenant': {"text":"租客","color":"#1890ff","value":"Tenant"}, +export const HouseOccupantsRelationWithOwnerEnum = { + Self: { text: '本人', color: '#52c41a', value: 'Self' }, + Spouse: { text: '配偶', color: '#2db7f5', value: 'Spouse' }, + Children: { text: '子女', color: '#87d068', value: 'Children' }, + Parents: { text: '父母', color: '#faad14', value: 'Parents' }, + Siblings: { text: '兄弟姐妹', color: '#fa8c16', value: 'Siblings' }, + OtherRelatives: { text: '其他', color: '#f5222d', value: 'OtherRelatives' }, + PrimaryTenant: { text: '主租客', color: '#722ed1', value: 'PrimaryTenant' }, + Tenant: { text: '租客', color: '#1890ff', value: 'Tenant' }, }; // HouseOccupantsResidentialRelationEnum -export const HouseOccupantsResidentialRelationEnum= { - 'PropertyOwner': {"text":"产权人","color":"#722ed1","value":"PropertyOwner"}, - 'Resident': {"text":"住户","color":"#2db7f5","value":"Resident"}, - 'PrimaryTenant': {"text":"主租人","color":"#87d068","value":"PrimaryTenant"}, - 'Tenant': {"text":"租客","color":"#fa8c16","value":"Tenant"}, +export const HouseOccupantsResidentialRelationEnum = { + PropertyOwner: { text: '产权人', color: '#722ed1', value: 'PropertyOwner' }, + Resident: { text: '住户', color: '#2db7f5', value: 'Resident' }, + PrimaryTenant: { text: '主租人', color: '#87d068', value: 'PrimaryTenant' }, + Tenant: { text: '租客', color: '#fa8c16', value: 'Tenant' }, }; // HouseOccupantsStatusEnum -export const HouseOccupantsStatusEnum= { - 'Normal': {"text":"绑定","color":"#52c41a","value":"Normal"}, - 'Unbound': {"text":"解绑","color":"#f5222d","value":"Unbound"}, +export const HouseOccupantsStatusEnum = { + Normal: { text: '绑定', color: '#52c41a', value: 'Normal' }, + Unbound: { text: '解绑', color: '#f5222d', value: 'Unbound' }, }; // HouseOrderRefundsRefundStatusEnum -export const HouseOrderRefundsRefundStatusEnum= { - 'Requested': {"text":"已申请","color":"#2196f3","value":"Requested"}, - 'Reviewing': {"text":"审核中","color":"#ff9800","value":"Reviewing"}, - 'Rejected': {"text":"已拒绝","color":"#f44336","value":"Rejected"}, - 'Processing': {"text":"退款中","color":"#9c27b0","value":"Processing"}, - 'Refunded': {"text":"已退款","color":"#4caf50","value":"Refunded"}, - 'Failed': {"text":"退款失败","color":"#e91e63","value":"Failed"}, +export const HouseOrderRefundsRefundStatusEnum = { + Requested: { text: '已申请', color: '#2196f3', value: 'Requested' }, + Reviewing: { text: '审核中', color: '#ff9800', value: 'Reviewing' }, + Rejected: { text: '已拒绝', color: '#f44336', value: 'Rejected' }, + Processing: { text: '退款中', color: '#9c27b0', value: 'Processing' }, + Refunded: { text: '已退款', color: '#4caf50', value: 'Refunded' }, + Failed: { text: '退款失败', color: '#e91e63', value: 'Failed' }, }; // 订单审核状态枚举 -export const HouseOrdersAuditStatusEnum= { - 'Pending': {"text":"待审核","color":"#f59e0b","value":"Pending"}, - 'Approved': {"text":"已通过","color":"#10b981","value":"Approved"}, - 'Rejected': {"text":"已驳回","color":"#ef4444","value":"Rejected"}, +export const HouseOrdersAuditStatusEnum = { + Pending: { text: '待审核', color: '#f59e0b', value: 'Pending' }, + Approved: { text: '已通过', color: '#10b981', value: 'Approved' }, + Rejected: { text: '已驳回', color: '#ef4444', value: 'Rejected' }, }; // 订单状态枚举 -export const HouseOrdersOrderStatusEnum= { - 'Pending': {"text":"待支付","color":"#facc15","value":"Pending"}, - 'ToBeConfirmed': {"text":"待确认","color":"#fb923c","value":"ToBeConfirmed"}, - 'Paid': {"text":"已支付","color":"#10b981","value":"Paid"}, - 'Refunded': {"text":"已退款","color":"#60a5fa","value":"Refunded"}, - 'Cancelled': {"text":"已取消","color":"#9ca3af","value":"Cancelled"}, - 'Failed': {"text":"支付失败","color":"#ef4444","value":"Failed"}, +export const HouseOrdersOrderStatusEnum = { + Pending: { text: '待支付', color: '#facc15', value: 'Pending' }, + ToBeConfirmed: { text: '待确认', color: '#fb923c', value: 'ToBeConfirmed' }, + Paid: { text: '已支付', color: '#10b981', value: 'Paid' }, + Refunded: { text: '已退款', color: '#60a5fa', value: 'Refunded' }, + Cancelled: { text: '已取消', color: '#9ca3af', value: 'Cancelled' }, + Failed: { text: '支付失败', color: '#ef4444', value: 'Failed' }, }; // HouseOrdersPaymentMethodEnum -export const HouseOrdersPaymentMethodEnum= { - 'WeChat': {"text":"微信","color":"#07c160","value":"WeChat"}, - 'Alipay': {"text":"支付宝","color":"#1677ff","value":"Alipay"}, - 'BankTransfer': {"text":"银行转账","color":"#6c757d","value":"BankTransfer"}, - 'TongLian': {"text":"通联支付","color":"#ff9f0a","value":"TongLian"}, - 'Prepayment': {"text":"预缴支付","color":"#f59e0b","value":"Prepayment"}, - 'POS': {"text":"POS机","color":"#8b5cf6","value":"POS"}, - 'Cash': {"text":"现金","color":"#dc2626","value":"Cash"}, +export const HouseOrdersPaymentMethodEnum = { + WeChat: { text: '微信', color: '#07c160', value: 'WeChat' }, + Alipay: { text: '支付宝', color: '#1677ff', value: 'Alipay' }, + BankTransfer: { text: '银行转账', color: '#6c757d', value: 'BankTransfer' }, + TongLian: { text: '通联支付', color: '#ff9f0a', value: 'TongLian' }, + Prepayment: { text: '预缴支付', color: '#f59e0b', value: 'Prepayment' }, + POS: { text: 'POS机', color: '#8b5cf6', value: 'POS' }, + Cash: { text: '现金', color: '#dc2626', value: 'Cash' }, }; // HousePrepaymentLogsTypeEnum -export const HousePrepaymentLogsTypeEnum= { - 'Add': {"text":"加","color":"#52c41a","value":"Add"}, - 'Subtract': {"text":"减","color":"#f5222d","value":"Subtract"}, +export const HousePrepaymentLogsTypeEnum = { + Add: { text: '加', color: '#52c41a', value: 'Add' }, + Subtract: { text: '减', color: '#f5222d', value: 'Subtract' }, }; // HouseRegistersCustomerTypeEnum -export const HouseRegistersCustomerTypeEnum= { - 'Individual': {"text":"个人客户","color":"#2db7f5","value":"Individual"}, - 'Enterprise': {"text":"普通企业","color":"#87d068","value":"Enterprise"}, - 'Developer': {"text":"开发企业","color":"#fa8c16","value":"Developer"}, - 'Government': {"text":"政府组织","color":"#f5222d","value":"Government"}, +export const HouseRegistersCustomerTypeEnum = { + Individual: { text: '个人客户', color: '#2db7f5', value: 'Individual' }, + Enterprise: { text: '普通企业', color: '#87d068', value: 'Enterprise' }, + Developer: { text: '开发企业', color: '#fa8c16', value: 'Developer' }, + Government: { text: '政府组织', color: '#f5222d', value: 'Government' }, }; // HouseRegistersHouseStatusEnum -export const HouseRegistersHouseStatusEnum= { - 'SelfOccupied': {"text":"自住","color":"#28a745","value":"SelfOccupied"}, - 'Rented': {"text":"出租","color":"#007bff","value":"Rented"}, - 'Vacant': {"text":"空置","color":"#dc3545","value":"Vacant"}, +export const HouseRegistersHouseStatusEnum = { + SelfOccupied: { text: '自住', color: '#28a745', value: 'SelfOccupied' }, + Rented: { text: '出租', color: '#007bff', value: 'Rented' }, + 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"}, +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"}, - 'Approved': {"text":"通过","color":"#52c41a","value":"Approved"}, - 'Rejected': {"text":"驳回","color":"#f5222d","value":"Rejected"}, +export const HouseRegistersStatusEnum = { + Pending: { text: '待审', color: '#faad14', value: 'Pending' }, + Approved: { text: '通过', color: '#52c41a', value: 'Approved' }, + Rejected: { text: '驳回', color: '#f5222d', value: 'Rejected' }, }; // HouseRegistersTypeEnum -export const HouseRegistersTypeEnum= { - 'AddOwner': {"text":"添加产权人","color":"#52c41a","value":"AddOwner"}, - 'RemoveOwner': {"text":"减少产权人","color":"#d9363e","value":"RemoveOwner"}, - 'AddOccupant': {"text":"添加住户","color":"#108ee9","value":"AddOccupant"}, - 'RemoveOccupant': {"text":"移除住户","color":"#fa8c16","value":"RemoveOccupant"}, - 'MoveOut': {"text":"搬离登记","color":"#f50","value":"MoveOut"}, - 'MoveIn': {"text":"搬入登记","color":"#ffc53d","value":"MoveIn"}, - 'UpdateInfo': {"text":"修改信息","color":"#722ed1","value":"UpdateInfo"}, - 'UpdatePhone': {"text":"修改电话","color":"#13c2c2","value":"UpdatePhone"}, - 'GoodsRelease': {"text":"物品放行","color":"#a0d911","value":"GoodsRelease"}, - 'VisitorApplies': {"text":"来访申请","color":"#a0d911","value":"VisitorApplies"}, +export const HouseRegistersTypeEnum = { + AddOwner: { text: '添加产权人', color: '#52c41a', value: 'AddOwner' }, + RemoveOwner: { text: '减少产权人', color: '#d9363e', value: 'RemoveOwner' }, + AddOccupant: { text: '添加住户', color: '#108ee9', value: 'AddOccupant' }, + RemoveOccupant: { + text: '移除住户', + color: '#fa8c16', + value: 'RemoveOccupant', + }, + MoveOut: { text: '搬离登记', color: '#f50', value: 'MoveOut' }, + MoveIn: { text: '搬入登记', color: '#ffc53d', value: 'MoveIn' }, + UpdateInfo: { text: '修改信息', color: '#722ed1', value: 'UpdateInfo' }, + UpdatePhone: { text: '修改电话', color: '#13c2c2', value: 'UpdatePhone' }, + GoodsRelease: { text: '物品放行', color: '#a0d911', value: 'GoodsRelease' }, + VisitorApplies: { + text: '来访申请', + color: '#a0d911', + value: 'VisitorApplies', + }, }; // HouseRegistersUsagePlanEnum -export const HouseRegistersUsagePlanEnum= { - 'Permanent': {"text":"常住","color":"#52c41a","value":"Permanent"}, - 'Vacation': {"text":"度假","color":"#faad14","value":"Vacation"}, - 'Rental': {"text":"出租","color":"#2db7f5","value":"Rental"}, - 'Commercial': {"text":"商用","color":"#f5222d","value":"Commercial"}, +export const HouseRegistersUsagePlanEnum = { + Permanent: { text: '常住', color: '#52c41a', value: 'Permanent' }, + Vacation: { text: '度假', color: '#faad14', value: 'Vacation' }, + Rental: { text: '出租', color: '#2db7f5', value: 'Rental' }, + Commercial: { text: '商用', color: '#f5222d', value: 'Commercial' }, }; // HouseWorkOrdersAcceptResultEnum -export const HouseWorkOrdersAcceptResultEnum= { - 'Satisfied': {"text":"满意","color":"#28A745","value":"Satisfied"}, - 'Unsatisfied': {"text":"不满意","color":"#DC3545","value":"Unsatisfied"}, +export const HouseWorkOrdersAcceptResultEnum = { + Satisfied: { text: '满意', color: '#28A745', value: 'Satisfied' }, + Unsatisfied: { text: '不满意', color: '#DC3545', value: 'Unsatisfied' }, }; // HouseWorkOrdersAssignStatusEnum -export const HouseWorkOrdersAssignStatusEnum= { - 'Unassigned': {"text":"未指派","color":"#ff0000","value":"Unassigned"}, - 'Assigned': {"text":"已指派","color":"#00ff00","value":"Assigned"}, +export const HouseWorkOrdersAssignStatusEnum = { + Unassigned: { text: '未指派', color: '#ff0000', value: 'Unassigned' }, + Assigned: { text: '已指派', color: '#00ff00', value: 'Assigned' }, }; // HouseWorkOrdersComplaintTypeEnum -export const HouseWorkOrdersComplaintTypeEnum= { - 'Hygiene': {"text":"卫生环境","color":"#ff0000","value":"Hygiene"}, - 'Greening': {"text":"绿植绿化","color":"#00aaff","value":"Greening"}, - 'Safety': {"text":"安全问题","color":"#ffaa00","value":"Safety"}, - 'Maintenance': {"text":"维修问题","color":"#aa00ff","value":"Maintenance"}, - 'PropertyService': {"text":"物业服务","color":"#00aa55","value":"PropertyService"}, - 'Staff': {"text":"工作人员","color":"#ff00aa","value":"Staff"}, - 'Other': {"text":"其他","color":"#aaaaaa","value":"Other"}, +export const HouseWorkOrdersComplaintTypeEnum = { + Hygiene: { text: '卫生环境', color: '#ff0000', value: 'Hygiene' }, + Greening: { text: '绿植绿化', color: '#00aaff', value: 'Greening' }, + Safety: { text: '安全问题', color: '#ffaa00', value: 'Safety' }, + Maintenance: { text: '维修问题', color: '#aa00ff', value: 'Maintenance' }, + PropertyService: { + text: '物业服务', + color: '#00aa55', + value: 'PropertyService', + }, + Staff: { text: '工作人员', color: '#ff00aa', value: 'Staff' }, + Other: { text: '其他', color: '#aaaaaa', value: 'Other' }, }; // HouseWorkOrdersLevelEnum -export const HouseWorkOrdersLevelEnum= { - 'Urgent': {"text":"紧急","color":"#ff0000","value":"Urgent"}, - 'High': {"text":"高","color":"#ff7f00","value":"High"}, - 'Medium': {"text":"中","color":"#00cc00","value":"Medium"}, - 'Low': {"text":"低","color":"#999999","value":"Low"}, +export const HouseWorkOrdersLevelEnum = { + Urgent: { text: '紧急', color: '#ff0000', value: 'Urgent' }, + High: { text: '高', color: '#ff7f00', value: 'High' }, + Medium: { text: '中', color: '#00cc00', value: 'Medium' }, + Low: { text: '低', color: '#999999', value: 'Low' }, }; // HouseWorkOrdersLocationEnum -export const HouseWorkOrdersLocationEnum= { - 'CommonArea': {"text":"公共区域","color":"#ff0000","value":"CommonArea"}, - 'MyHome': {"text":"房屋","color":"#00ff00","value":"MyHome"}, +export const HouseWorkOrdersLocationEnum = { + CommonArea: { text: '公共区域', color: '#ff0000', value: 'CommonArea' }, + MyHome: { text: '房屋', color: '#00ff00', value: 'MyHome' }, }; // HouseWorkOrdersRefundStatusEnum -export const HouseWorkOrdersRefundStatusEnum= { - 'Refunding': {"text":"退款中","color":"#FFA500","value":"Refunding"}, - 'Refunded': {"text":"已退款","color":"#28A745","value":"Refunded"}, - 'PartialRefund': {"text":"部分退款","color":"#17A2B8","value":"PartialRefund"}, +export const HouseWorkOrdersRefundStatusEnum = { + Refunding: { text: '退款中', color: '#FFA500', value: 'Refunding' }, + Refunded: { text: '已退款', color: '#28A745', value: 'Refunded' }, + PartialRefund: { text: '部分退款', color: '#17A2B8', value: 'PartialRefund' }, }; // HouseWorkOrdersStatusEnum -export const HouseWorkOrdersStatusEnum= { - 'Pending': {"text":"待处理","color":"#FFA500","value":"Pending"}, - 'Processing': {"text":"处理中","color":"#1E90FF","value":"Processing"}, - 'PendingPayment': {"text":"待支付","color":"#FF8C00","value":"PendingPayment"}, - 'PendingAcceptance': {"text":"待验收","color":"#17A2B8","value":"PendingAcceptance"}, - 'Completed': {"text":"已完成","color":"#28A745","value":"Completed"}, - 'Closed': {"text":"已关闭","color":"#6C757D","value":"Closed"}, +export const HouseWorkOrdersStatusEnum = { + Pending: { text: '待处理', color: '#FFA500', value: 'Pending' }, + Processing: { text: '处理中', color: '#1E90FF', value: 'Processing' }, + PendingPayment: { text: '待支付', color: '#FF8C00', value: 'PendingPayment' }, + PendingAcceptance: { + text: '待验收', + color: '#17A2B8', + value: 'PendingAcceptance', + }, + Completed: { text: '已完成', color: '#28A745', value: 'Completed' }, + Closed: { text: '已关闭', color: '#6C757D', value: 'Closed' }, }; // HouseWorkOrdersTypeEnum -export const HouseWorkOrdersTypeEnum= { - 'Repair': {"text":"报修","color":"#ff0000","value":"Repair"}, - 'Incident': {"text":"报事","color":"#00aaff","value":"Incident"}, - 'Complaint': {"text":"投诉","color":"#aa00ff","value":"Complaint"}, +export const HouseWorkOrdersTypeEnum = { + Repair: { text: '报修', color: '#ff0000', value: 'Repair' }, + Incident: { text: '报事', color: '#00aaff', value: 'Incident' }, + Complaint: { text: '投诉', color: '#aa00ff', value: 'Complaint' }, }; // 公告阅读者类型 -export const MsgPropertyAnnouncementReadsReaderTypeEnum= { - 'Customer': {"text":"客户","color":"#3b82f6","value":"Customer"}, - 'Employee': {"text":"员工","color":"#10b981","value":"Employee"}, +export const MsgPropertyAnnouncementReadsReaderTypeEnum = { + Customer: { text: '客户', color: '#3b82f6', value: 'Customer' }, + Employee: { text: '员工', color: '#10b981', value: 'Employee' }, }; // 公告接收对象 -export const MsgPropertyAnnouncementsObjectEnum= { - 'Customer': {"text":"客户","color":"#3b82f6","value":"Customer"}, - 'Employee': {"text":"员工","color":"#10b981","value":"Employee"}, +export const MsgPropertyAnnouncementsObjectEnum = { + Customer: { text: '客户', color: '#3b82f6', value: 'Customer' }, + Employee: { text: '员工', color: '#10b981', value: 'Employee' }, }; // MsgPropertyAnnouncementsPublishTypeEnum -export const MsgPropertyAnnouncementsPublishTypeEnum= { - 'Manual': {"text":"手动","color":"#4caf50","value":"Manual"}, - 'Schedule': {"text":"定时","color":"#2196f3","value":"Schedule"}, +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"}, - 'Company': {"text":"公司","color":"#28a745","value":"Company"}, - 'ManagementOffice': {"text":"管理处","color":"#ffc107","value":"ManagementOffice"}, - 'Department': {"text":"部门","color":"#dc3545","value":"Department"}, +export const OrganizationsTypeEnum = { + Group: { text: '集团', color: '#007bff', value: 'Group' }, + Company: { text: '公司', color: '#28a745', value: 'Company' }, + ManagementOffice: { + text: '管理处', + color: '#ffc107', + value: 'ManagementOffice', + }, + Department: { text: '部门', color: '#dc3545', value: 'Department' }, }; // 退款状态枚举 -export const RefundsStatusEnum= { - 'Pending': {"text":"待审批","color":"#ff9800","value":"Pending"}, - 'Reviewing': {"text":"审核中","color":"#2196f3","value":"Reviewing"}, - 'Approved': {"text":"已审批","color":"#9c27b0","value":"Approved"}, - 'Processing': {"text":"退款中","color":"#00bcd4","value":"Processing"}, - 'Completed': {"text":"已退款","color":"#4caf50","value":"Completed"}, - 'PartialRefund': {"text":"部分退款","color":"#8bc34a","value":"PartialRefund"}, - 'Rejected': {"text":"已拒绝","color":"#f44336","value":"Rejected"}, - 'Failed': {"text":"退款失败","color":"#e91e63","value":"Failed"}, - 'Cancelled': {"text":"已取消","color":"#9e9e9e","value":"Cancelled"}, +export const RefundsStatusEnum = { + Pending: { text: '待审批', color: '#ff9800', value: 'Pending' }, + Reviewing: { text: '审核中', color: '#2196f3', value: 'Reviewing' }, + Approved: { text: '已审批', color: '#9c27b0', value: 'Approved' }, + Processing: { text: '退款中', color: '#00bcd4', value: 'Processing' }, + Completed: { text: '已退款', color: '#4caf50', value: 'Completed' }, + PartialRefund: { text: '部分退款', color: '#8bc34a', value: 'PartialRefund' }, + Rejected: { text: '已拒绝', color: '#f44336', value: 'Rejected' }, + Failed: { text: '退款失败', color: '#e91e63', value: 'Failed' }, + Cancelled: { text: '已取消', color: '#9e9e9e', value: 'Cancelled' }, }; // 退款类型枚举 -export const RefundsTypeEnum= { - 'HouseBill': {"text":"物业费退款","color":"#2196f3","value":"HouseBill"}, - 'Bill': {"text":"账单退款","color":"#4caf50","value":"Bill"}, - 'ContractBill': {"text":"合同退款","color":"#ff9800","value":"ContractBill"}, - 'RenovationApply': {"text":"退保证金","color":"#86aac3ff","value":"RenovationApply"}, - 'HouseDoorCard': {"text":"门禁退款","color":"#9c27b0","value":"HouseDoorCard"}, - 'HouseWorkOrder': {"text":"工单退款","color":"#00bcd4","value":"HouseWorkOrder"}, - 'Other': {"text":"其他退款","color":"#607d8b","value":"Other"}, +export const RefundsTypeEnum = { + HouseBill: { text: '物业费退款', color: '#2196f3', value: 'HouseBill' }, + Bill: { text: '账单退款', color: '#4caf50', value: 'Bill' }, + ContractBill: { text: '合同退款', color: '#ff9800', value: 'ContractBill' }, + RenovationApply: { + text: '退保证金', + color: '#86aac3ff', + value: 'RenovationApply', + }, + HouseDoorCard: { text: '门禁退款', color: '#9c27b0', value: 'HouseDoorCard' }, + HouseWorkOrder: { + text: '工单退款', + color: '#00bcd4', + value: 'HouseWorkOrder', + }, + Other: { text: '其他退款', color: '#607d8b', value: 'Other' }, }; // 性别 -export const SexEnum= { - 'Male': {"text":"男","color":"#0000ff","value":"Male"}, - 'FeMale': {"text":"女","color":"#ff0000","value":"FeMale"}, +export const SexEnum = { + Male: { text: '男', color: '#0000ff', value: 'Male' }, + FeMale: { text: '女', color: '#ff0000', value: 'FeMale' }, }; // SysModuleEnum -export const SysModuleEnum= { - 'Admin': {"text":"管理员","color":"#cf1322","value":"Admin"}, - 'Customer': {"text":"客户","color":"#d4b106","value":"Customer"}, - 'Company': {"text":"机构","color":"#1890ff","value":"Company"}, +export const SysModuleEnum = { + Admin: { text: '管理员', color: '#cf1322', value: 'Admin' }, + Company: { text: '机构', color: '#1890ff', value: 'Company' }, + Employee: { text: '员工', color: '#1890ff', value: 'Employee' }, }; // SysPermissionsTypeEnum -export const SysPermissionsTypeEnum= { - 'Directory': {"text":"目录","color":"#6d7e14","value":"Directory"}, - 'Page': {"text":"页面","color":"#4d9a13","value":"Page"}, - 'Button': {"text":"按钮","color":"#97224f","value":"Button"}, +export const SysPermissionsTypeEnum = { + Directory: { text: '目录', color: '#6d7e14', value: 'Directory' }, + Page: { text: '页面', color: '#4d9a13', value: 'Page' }, + Button: { text: '按钮', color: '#97224f', value: 'Button' }, + QuickAction: { text: '金刚区', color: '#2563eb', value: 'QuickAction' }, + Module: { text: '模块', color: '#0d9488', value: 'Module' }, }; // 来访事由 -export const VisitReasonEnum= { - 'Visit': {"text":"拜访","color":"#2196f3","value":"Visit"}, - 'Business': {"text":"商务","color":"#3f51b5","value":"Business"}, - 'Interview': {"text":"面试","color":"#9c27b0","value":"Interview"}, - 'Private': {"text":"私人","color":"#e91e63","value":"Private"}, - 'Express': {"text":"快递","color":"#00bcd4","value":"Express"}, - 'Renovation': {"text":"装修","color":"#ff5722","value":"Renovation"}, - 'Other': {"text":"其他","color":"#607d8b","value":"Other"}, +export const VisitReasonEnum = { + Visit: { text: '拜访', color: '#2196f3', value: 'Visit' }, + Business: { text: '商务', color: '#3f51b5', value: 'Business' }, + Interview: { text: '面试', color: '#9c27b0', value: 'Interview' }, + Private: { text: '私人', color: '#e91e63', value: 'Private' }, + Express: { text: '快递', color: '#00bcd4', value: 'Express' }, + Renovation: { text: '装修', color: '#ff5722', value: 'Renovation' }, + Other: { text: '其他', color: '#607d8b', value: 'Other' }, }; // 访客申请状态 -export const VisitorAppliesStatusEnum= { - 'Pending': {"text":"审核中","color":"#ff9800","value":"Pending"}, - 'Approved': {"text":"已通过","color":"#4caf50","value":"Approved"}, - 'Rejected': {"text":"已驳回","color":"#f44336","value":"Rejected"}, - 'Expired': {"text":"已失效","color":"#9e9e9e","value":"Expired"}, +export const VisitorAppliesStatusEnum = { + Pending: { text: '审核中', color: '#ff9800', value: 'Pending' }, + Approved: { text: '已通过', color: '#4caf50', value: 'Approved' }, + Rejected: { text: '已驳回', color: '#f44336', value: 'Rejected' }, + Expired: { text: '已失效', color: '#9e9e9e', value: 'Expired' }, }; // 访客申请类型 -export const VisitorApplyTypeEnum= { - 'invite': {"text":"业主邀请","color":"#2196f3","value":"invite"}, - 'register': {"text":"访客登记","color":"#ff9800","value":"register"}, +export const VisitorApplyTypeEnum = { + invite: { text: '业主邀请', color: '#2196f3', value: 'invite' }, + register: { text: '访客登记', color: '#ff9800', value: 'register' }, }; // 通行码状态 -export const VisitorCodeStatusEnum= { - 'unused': {"text":"未使用","color":"#2196f3","value":"unused"}, - 'used': {"text":"已使用","color":"#4caf50","value":"used"}, - 'expired': {"text":"已过期","color":"#f44336","value":"expired"}, +export const VisitorCodeStatusEnum = { + unused: { text: '未使用', color: '#2196f3', value: 'unused' }, + used: { text: '已使用', color: '#4caf50', value: 'used' }, + expired: { text: '已过期', color: '#f44336', value: 'expired' }, }; // 访客扫码类型 -export const VisitorScanTypeEnum= { - 'enter': {"text":"进入","color":"#4caf50","value":"enter"}, - 'exit': {"text":"离开","color":"#f44336","value":"exit"}, +export const VisitorScanTypeEnum = { + enter: { text: '进入', color: '#4caf50', value: 'enter' }, + exit: { text: '离开', color: '#f44336', value: 'exit' }, }; // WechatAuthsPlatformEnum -export const WechatAuthsPlatformEnum= { - 'MiniProgram': {"text":"微信小程序","color":"#3b82f6","value":"MiniProgram"}, - 'MpOfficial': {"text":"微信公众号","color":"#22c55e","value":"MpOfficial"}, - 'WorkWechat': {"text":"企业微信","color":"#6366f1","value":"WorkWechat"}, +export const WechatAuthsPlatformEnum = { + MiniProgram: { text: '微信小程序', color: '#3b82f6', value: 'MiniProgram' }, + MpOfficial: { text: '微信公众号', color: '#22c55e', value: 'MpOfficial' }, + WorkWechat: { text: '企业微信', color: '#6366f1', value: 'WorkWechat' }, }; +// PatrolTasksCreateTypeEnum +export const PatrolTasksCreateTypeEnum = { + Auto: { text: '定时生成', color: '#2196f3', value: 'Auto' }, + Manual: { text: '手动创建', color: '#4caf50', value: 'Manual' }, +}; + +// PatrolTasksStatusEnum +export const PatrolTasksStatusEnum = { + Unassigned: { text: '未分配', color: '#9e9e9e', value: 'Unassigned' }, + Pending: { text: '待执行', color: '#ff9800', value: 'Pending' }, + InProgress: { text: '进行中', color: '#2196f3', value: 'InProgress' }, + Completed: { text: '已完成', color: '#4caf50', value: 'Completed' }, + Canceled: { text: '已取消', color: '#f44336', value: 'Canceled' }, + Overdue: { text: '已超期', color: '#e91e63', value: 'Overdue' }, +}; + +// PatrolRoutesGenerationMethodEnum +export const PatrolRoutesGenerationMethodEnum = { + Daily: { text: '按天', color: '#007bff', value: 'Daily' }, + Weekly: { text: '按周', color: '#28a745', value: 'Weekly' }, + Monthly: { text: '按月', color: '#ffc107', value: 'Monthly' }, +}; + +// PatrolTaskLocationsStatusEnum +export const PatrolTaskLocationsStatusEnum = { + Incomplete: { text: '未完成', color: '#ff9800', value: 'Incomplete' }, + Completed: { text: '已完成', color: '#4caf50', value: 'Completed' }, +}; diff --git a/src/pages/attendance/attendance_configs/index.tsx b/src/pages/attendance/attendance_configs/index.tsx new file mode 100644 index 0000000..2c5c9d3 --- /dev/null +++ b/src/pages/attendance/attendance_configs/index.tsx @@ -0,0 +1,68 @@ +import { MyColumns, MyPageContainer, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import Create from './modals/Create'; +import Update from './modals/Update'; + +export default function Index({ title = '打卡配置' }) { + return ( + + + MyProTableProps.request( + params, + sort, + Apis.Attendance.AttendanceConfigs.List, + ) + } + headerTitle="打卡参数配置" + toolBarRender={(action) => [ + , + ]} + search={false} + columns={[ + MyColumns.ID({ + search: false, + }), + { + title: '可打卡范围(米内)', + dataIndex: 'check_in_range', + search: false, + }, + MyColumns.Boolean({ + dataIndex: 'require_photo', + title: '是否要求拍照打卡', + search: false, + }), + // MyColumns.Boolean({ + // dataIndex: 'allow_out_range_checkin', + // title: '是否允许范围外打卡', + // search: false, + // }), + // MyColumns.IsEnabled({ + // onRestore: Apis.Attendance.AttendanceConfigs.Enable, + // onSoftDelete: Apis.Attendance.AttendanceConfigs.Enable, + // search: false, + // }), + // MyColumns.CreatedAt(), + MyColumns.UpdatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/attendance/attendance_configs/modals/Create.tsx b/src/pages/attendance/attendance_configs/modals/Create.tsx new file mode 100644 index 0000000..01b043c --- /dev/null +++ b/src/pages/attendance/attendance_configs/modals/Create.tsx @@ -0,0 +1,63 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +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}`} + wrapperCol={{ span: 24 }} + width="500px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + trigger={} + onFinish={async (values) => + Apis.Attendance.AttendanceConfigs.Store(values) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'check_in_range', + title: '可打卡范围', + valueType: 'digit', + fieldProps: { + suffix: '米内', + style: { width: '100%' }, + }, + formItemProps: { ...rulesHelper.number }, + colProps: { span: 24 }, + }, + { + title: '是否要求拍照打卡', + key: 'require_photo', + valueType: 'switch', + colProps: { span: 12 }, + }, + // { + // title: '是否允许范围外打卡', + // key: 'allow_out_range_checkin', + // valueType: 'switch', + // colProps: { span: 12 }, + // }, + ]} + /> + ); +} diff --git a/src/pages/attendance/attendance_configs/modals/Update.tsx b/src/pages/attendance/attendance_configs/modals/Update.tsx new file mode 100644 index 0000000..02040b3 --- /dev/null +++ b/src/pages/attendance/attendance_configs/modals/Update.tsx @@ -0,0 +1,66 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +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 }} + key={new Date().getTime()} + width="500px" + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values) => + Apis.Attendance.AttendanceConfigs.UpdateConfig({ + ...values, + id: props.item?.id ?? 1, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'check_in_range', + title: '可打卡范围', + valueType: 'digit', + fieldProps: { + suffix: '米内', + style: { width: '100%' }, + }, + formItemProps: { ...rulesHelper.number }, + colProps: { span: 24 }, + }, + { + title: '是否要求拍照打卡', + key: 'require_photo', + valueType: 'switch', + colProps: { span: 12 }, + }, + // { + // title: '是否允许范围外打卡', + // key: 'allow_out_range_checkin', + // valueType: 'switch', + // colProps: { span: 12 }, + // }, + ]} + /> + ); +} diff --git a/src/pages/attendance/attendance_employees/index.tsx b/src/pages/attendance/attendance_employees/index.tsx new file mode 100644 index 0000000..cb84a79 --- /dev/null +++ b/src/pages/attendance/attendance_employees/index.tsx @@ -0,0 +1,116 @@ +import { + MyColumns, + MyImportModal, + MyPageContainer, + MyProTableProps, + renderTextHelper, + useCurrentPermissions, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { CompanyEmployeesTypeEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import Change from './modals/Change'; +import EmployeeCreate from './modals/EmployeeCreate'; +import EmployeeUpdate from './modals/EmployeeUpdate'; + +export default function Index({ title = '外包人员' }) { + const getCurrentPermissions = useCurrentPermissions(); + return ( + + + MyProTableProps.request( + { + type: 'External', + ...params, + }, + sort, + Apis.Company.CompanyEmployees.List, + ) + } + toolBarRender={(action) => [ + , + , + ]} + columns={[ + MyColumns.ID({ search: false }), + { + title: '所在组织', + dataIndex: 'organization_path', + search: { + transform: (value) => { + return { organization_name: value }; + }, + }, + }, + { + title: '姓名', + dataIndex: 'name', + }, + { + title: '手机号', + dataIndex: 'phone', + }, + { + title: '角色', + dataIndex: 'roles', + renderText: renderTextHelper.TagList, + hideInSearch: true, + }, + { + title: '岗位', + dataIndex: ['position', 'name'], + search: false, + }, + MyColumns.EnumTag({ + title: '来源', + dataIndex: 'type', + valueEnum: CompanyEmployeesTypeEnum, + search: false, + }), + MyColumns.SoftDelete({ + title: '启/禁用', + onRestore: Apis.Company.CompanyEmployees.Restore, + onSoftDelete: Apis.Company.CompanyEmployees.SoftDelete, + search: false, + setPermissions: getCurrentPermissions({ + enableDisable: true, + }), + }), + MyColumns.UpdatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/attendance/attendance_employees/modals/Change.tsx b/src/pages/attendance/attendance_employees/modals/Change.tsx new file mode 100644 index 0000000..09af2ab --- /dev/null +++ b/src/pages/attendance/attendance_employees/modals/Change.tsx @@ -0,0 +1,68 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; + +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { CompanyEmployeesTypeEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`组织调整`} + 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 ?? '', + type: props.item?.type ?? '', + 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/attendance/attendance_employees/modals/EmployeeCreate.tsx b/src/pages/attendance/attendance_employees/modals/EmployeeCreate.tsx new file mode 100644 index 0000000..d527bd3 --- /dev/null +++ b/src/pages/attendance/attendance_employees/modals/EmployeeCreate.tsx @@ -0,0 +1,96 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { SysSelects } from '@/components/SysSelects'; +import { Apis } from '@/gen/Apis'; +import { CompanyEmployeesTypeEnum, SexEnum } from '@/gen/Enums'; +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={`添加外部人员`} + layout="horizontal" + labelCol={{ span: 5 }} + wrapperCol={{ span: 19 }} + labelAlign="left" + width="500px" + key={new Date().getTime()} + trigger={} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + onFinish={async (values: any) => + Apis.Company.CompanyEmployees.Store({ + ...values, + companies_id: values?.companies_id || props?.item?.id, + type: CompanyEmployeesTypeEnum.External.value, + password: 'Gc#123', + 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', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + + { + key: 'name', + title: '姓名', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'phone', + title: '手机号', + valueType: 'number', + fieldProps: { + maxLength: 11, + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.phone }, + }, + MyFormItems.EnumRadio({ + key: 'sex', + title: '性别', + colProps: { span: 24 }, + valueEnum: SexEnum, + required: true, + }), + Selects?.Positions({ + title: '岗位', + key: 'positions_id', + formItemProps: { ...rulesHelper.text }, + }), + SysSelects.SysRoles(), + { + key: 'remark', + title: '备注', + colProps: { span: 24 }, + valueType: 'textarea', + }, + ]} + /> + ); +} diff --git a/src/pages/attendance/attendance_employees/modals/EmployeeUpdate.tsx b/src/pages/attendance/attendance_employees/modals/EmployeeUpdate.tsx new file mode 100644 index 0000000..c0714a5 --- /dev/null +++ b/src/pages/attendance/attendance_employees/modals/EmployeeUpdate.tsx @@ -0,0 +1,121 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; + +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { SexEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`编辑员工`} + trigger={ + + } + layout="horizontal" + labelCol={{ span: 5 }} + wrapperCol={{ span: 19 }} + labelAlign="left" + width="500px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue({ + ...props.item, + roles_id: props.item?.roles?.map((item: any) => item.value), + positions_id: props.item?.positions_id ?? '', + }); + } + }} + onFinish={async (values: any) => + Apis.Company.CompanyEmployees.Update({ + ...values, + id: props.item?.id ?? 0, + type: props.item?.type, + password: null, + organizations_id: props.item?.organizations_id ?? '', + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'name', + title: '姓名', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'phone', + title: '手机号', + valueType: 'number', + fieldProps: { + maxLength: 11, + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.phone }, + }, + MyFormItems.EnumRadio({ + key: 'sex', + title: '性别', + colProps: { span: 24 }, + valueEnum: SexEnum, + required: true, + }), + // MyFormItems.EnumRadio({ + // key: 'type', + // title: '来源', + // colProps: { span: 24 }, + // valueEnum: CompanyEmployeesTypeEnum, + // required: true, + // }), + Selects?.Positions({ + title: '岗位', + key: 'positions_id', + formItemProps: { ...rulesHelper.text }, + params: { + name: props.item?.position?.name ?? '', + }, + fieldProps: { + showSearch: true, + placeholder: '请输入关键字搜索', + }, + }), + + // { + // key: 'password', + // title: '密码', + // colProps: { span: 24 }, + // valueType: 'password', + // }, + { + key: 'remark', + title: '备注', + colProps: { span: 24 }, + valueType: 'textarea', + }, + ]} + /> + ); +} diff --git a/src/pages/attendance/attendance_employees_tracks/index.tsx b/src/pages/attendance/attendance_employees_tracks/index.tsx new file mode 100644 index 0000000..44923ad --- /dev/null +++ b/src/pages/attendance/attendance_employees_tracks/index.tsx @@ -0,0 +1,109 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, + renderTextHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { CompanyEmployeesTypeEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space } from 'antd'; + +export default function Index({ title = '员工轨迹' }) { + const navigate = useNavigate(); + return ( + + + MyProTableProps.request( + { + type: 'External', + ...params, + }, + sort, + Apis.Company.CompanyEmployees.List, + ) + } + columns={[ + MyColumns.ID({ search: false }), + Selects?.OrganizationSearch({ + title: '所属组织', + key: 'organizations_id', + colProps: { span: 24 }, + fieldProps: { + showSearch: true, + }, + search: { + transform: (value) => { + return { + organization_name: + value.length > 0 ? value[value.length - 1] : '', + }; + }, + }, + }), + { + title: '所在组织', + dataIndex: 'organization_path', + // search: { + // transform: (value) => { + // return { organization_name: value }; + // }, + // }, + search: false, + }, + { + title: '姓名', + dataIndex: 'name', + }, + { + title: '手机号', + dataIndex: 'phone', + }, + { + title: '角色', + dataIndex: 'roles', + renderText: renderTextHelper.TagList, + hideInSearch: true, + }, + { + title: '岗位', + dataIndex: ['position', 'name'], + search: false, + }, + MyColumns.EnumTag({ + title: '来源', + dataIndex: 'type', + valueEnum: CompanyEmployeesTypeEnum, + search: false, + }), + MyColumns.UpdatedAt(), + MyColumns.Option({ + render: (_, item: any, index) => ( + + + navigate(`/attendance/employee_tracks/${item.id}`) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/attendance/attendance_employees_tracks/modals/Change.tsx b/src/pages/attendance/attendance_employees_tracks/modals/Change.tsx new file mode 100644 index 0000000..00be34d --- /dev/null +++ b/src/pages/attendance/attendance_employees_tracks/modals/Change.tsx @@ -0,0 +1,59 @@ +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 ?? '', + type: props.item?.type, + 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/attendance/attendance_employees_tracks/modals/EmployeeCreate.tsx b/src/pages/attendance/attendance_employees_tracks/modals/EmployeeCreate.tsx new file mode 100644 index 0000000..db02a0b --- /dev/null +++ b/src/pages/attendance/attendance_employees_tracks/modals/EmployeeCreate.tsx @@ -0,0 +1,95 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { SysSelects } from '@/components/SysSelects'; +import { Apis } from '@/gen/Apis'; +import { CompanyEmployeesTypeEnum, SexEnum } from '@/gen/Enums'; +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={`添加外部人员`} + layout="horizontal" + labelCol={{ span: 5 }} + wrapperCol={{ span: 19 }} + labelAlign="left" + width="500px" + trigger={} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + onFinish={async (values: any) => + Apis.Company.CompanyEmployees.Store({ + ...values, + companies_id: values?.companies_id || props?.item?.id, + type: CompanyEmployeesTypeEnum.External.value, + password: 'Gc#123', + 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', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + + { + key: 'name', + title: '姓名', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'phone', + title: '手机号', + valueType: 'number', + fieldProps: { + maxLength: 11, + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.phone }, + }, + MyFormItems.EnumRadio({ + key: 'sex', + title: '性别', + colProps: { span: 24 }, + valueEnum: SexEnum, + required: true, + }), + Selects?.Positions({ + title: '岗位', + key: 'positions_id', + formItemProps: { ...rulesHelper.text }, + }), + SysSelects.SysRoles(), + { + key: 'remark', + title: '备注', + colProps: { span: 24 }, + valueType: 'textarea', + }, + ]} + /> + ); +} diff --git a/src/pages/attendance/attendance_employees_tracks/modals/EmployeeUpdate.tsx b/src/pages/attendance/attendance_employees_tracks/modals/EmployeeUpdate.tsx new file mode 100644 index 0000000..29af18b --- /dev/null +++ b/src/pages/attendance/attendance_employees_tracks/modals/EmployeeUpdate.tsx @@ -0,0 +1,107 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; + +import { Selects } from '@/components/Select'; +import { SysSelects } from '@/components/SysSelects'; +import { Apis } from '@/gen/Apis'; +import { SexEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`编辑员工`} + trigger={} + wrapperCol={{ span: 24 }} + width="500px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue({ + ...props.item, + roles_id: props.item?.roles?.map((item: any) => item.value), + }); + } + }} + onFinish={async (values: any) => + Apis.Company.CompanyEmployees.Update({ + ...values, + id: props.item?.id ?? 0, + type: props.item?.type, + organizations_id: + values?.organizations_id?.[values.organizations_id.length - 1] || + props.item?.organizations_id, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'name', + title: '姓名', + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'phone', + title: '手机号', + valueType: 'number', + fieldProps: { + maxLength: 11, + }, + colProps: { span: 10 }, + formItemProps: { ...rulesHelper.phone }, + }, + MyFormItems.EnumRadio({ + key: 'sex', + title: '性别', + colProps: { span: 6 }, + valueEnum: SexEnum, + required: true, + }), + { + key: 'password', + title: '密码', + valueType: 'password', + colProps: { span: 24 }, + fieldProps: { + placeholder: '不修改密码请留空', + }, + }, + Selects?.Positions({ + title: '岗位', + key: 'positions_id', + formItemProps: { ...rulesHelper.text }, + fieldProps: { + showSearch: true, + }, + }), + SysSelects.SysRoles(), + // { + // key: 'password', + // title: '密码', + // colProps: { span: 24 }, + // valueType: 'password', + // }, + { + key: 'remark', + title: '备注', + colProps: { span: 24 }, + valueType: 'textarea', + }, + ]} + /> + ); +} diff --git a/src/pages/attendance/attendance_records/index.tsx b/src/pages/attendance/attendance_records/index.tsx new file mode 100644 index 0000000..c2c768d --- /dev/null +++ b/src/pages/attendance/attendance_records/index.tsx @@ -0,0 +1,120 @@ +import { MyColumns, MyPageContainer, MyProTableProps } from '@/common'; +import { MyExport } from '@/components/MyExport'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + AttendanceRecordsCheckinTypeEnum, + AttendanceRecordsStatusEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Image } from 'antd'; +import { useState } from 'react'; + +export default function Index({ title = '打卡记录' }) { + const [getParams, setParams] = useState({}); + + return ( + + + MyProTableProps.request( + params, + sort, + Apis.Attendance.AttendanceRecords.List, + (e) => { + setParams(e); + }, + ) + } + headerTitle={title} + toolBarRender={() => [ + , + ]} + columns={[ + MyColumns.ID({ search: false }), + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + hidden: true, + }), + { + title: '关联项目', + dataIndex: ['asset_project', 'name'], + search: false, + }, + { + title: '员工', + dataIndex: ['company_employee', 'name'], + search: false, + }, + { + title: '打卡时间', + dataIndex: 'checkin_time', + valueType: 'dateRange', + hidden: true, + }, + MyColumns.EnumTag({ + title: '打卡类型', + dataIndex: 'checkin_type', + valueEnum: AttendanceRecordsCheckinTypeEnum, + }), + MyColumns.EnumTag({ + title: '打卡结果', + dataIndex: 'status', + valueEnum: AttendanceRecordsStatusEnum, + }), + { + title: '打卡时间', + dataIndex: 'checkin_time', + search: false, + render: (_, item: any) => { + return item?.status === 'CheckIn' + ? item?.shift_periods?.work_start_time + : item?.shift_periods?.work_end_time; + }, + }, + { + title: '员工打卡时间', + dataIndex: 'checkin_time', + search: false, + }, + + { + title: '打卡拍照', + dataIndex: 'checkin_time', + search: false, + render: (_, item: any) => { + return ( + + console.log( + `current index: ${current}, prev index: ${prev}`, + ), + }} + > + {item?.photo?.map((res: any, index?: number) => { + return ( + + ); + })} + + ); + }, + }, + // MyColumns.CreatedAt(), + ]} + /> + + ); +} diff --git a/src/pages/attendance/attendance_schedules/index.tsx b/src/pages/attendance/attendance_schedules/index.tsx new file mode 100644 index 0000000..1ff2ce8 --- /dev/null +++ b/src/pages/attendance/attendance_schedules/index.tsx @@ -0,0 +1,158 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { AttendanceSchedulesStatusEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space, Tooltip } from 'antd'; +import Update from './modals/Update'; + +export default function Index({ title = '排班管理' }) { + const navigate = useNavigate(); + + return ( + + + MyProTableProps.request( + { ...params, status: AttendanceSchedulesStatusEnum.Active.value }, + sort, + Apis.Attendance.AttendanceSchedules.List, + ) + } + headerTitle="排班信息" + toolBarRender={() => [ + { + navigate('/attendance/attendance_schedules/pages/create'); + }} + title="批量排班 / 批量调整" + />, + ]} + columns={[ + // MyColumns.ID({ + // search: false, + // }), + + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + hidden: true, + }), + { + title: '排班日期', + dataIndex: 'schedule_date', + valueType: 'date', + }, + { + title: '关联项目', + dataIndex: ['asset_project', 'name'], + // search: { + // transform: (value) => { + // return { project_name: value }; + // }, + // }, + search: false, + }, + { + title: '员工', + dataIndex: ['company_employee', 'name'], + search: { + transform: (value) => { + return { employee_name: value }; + }, + }, + }, + { + title: '班次', + dataIndex: ['attendance_shift', 'name'], + search: false, + }, + { + title: '时段要求', + dataIndex: 'shift_periods', + search: false, + render: (_, item: any) => { + const periods = item?.shift_periods || []; + const periodTexts = periods.map((res: any) => { + return `时段${ + res?.period_order + }: ${res?.work_start_time?.substring( + 0, + 5, + )}-${res?.work_end_time?.substring(0, 5)}`; + }); + const allPeriodsText = periodTexts.join(' '); + + return ( + ( +
{text}
+ )) || '' + } + > +
+ {allPeriodsText} +
+
+ ); + }, + }, + + // MyColumns.EnumTag({ + // title: '状态', + // dataIndex: 'status', + // valueEnum: AttendanceSchedulesStatusEnum, + // }), + { + title: '排班人', + dataIndex: ['created_employee', 'name'], + search: false, + }, + // MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + Apis.Attendance.AttendanceSchedules.Cancel({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> +
+ ); +} diff --git a/src/pages/attendance/attendance_schedules/modals/Create.tsx b/src/pages/attendance/attendance_schedules/modals/Create.tsx new file mode 100644 index 0000000..5e9a8fc --- /dev/null +++ b/src/pages/attendance/attendance_schedules/modals/Create.tsx @@ -0,0 +1,117 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm, EditableProTable } 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 [dataSource, setDataSource] = useState([]); + + return ( + + {...MyModalFormProps.props} + title={`批量${props.title}`} + wrapperCol={{ span: 24 }} + width="800px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + trigger={} + onFinish={async (values) => + Apis.Attendance.AttendanceSchedules.BatchStore(values) + .then(() => { + props.reload?.(); + message.success('新增成功'); + return true; + }) + .catch(() => false) + } + submitter={false} + columns={[ + Selects?.OrganizationsTree({ + title: '选择组织', + key: 'organizations_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '排班日期', + key: 'schedule_date', + valueType: 'date', + fieldProps: { + format: 'YYYY-MM-DD', + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + valueType: 'dependency', + name: ['organizations_id', 'schedule_date'], + colProps: { span: 24 }, + columns: ({ schedule_date, organizations_id }) => { + return [ + { + renderFormItem: () => { + console.log(schedule_date, organizations_id); + return ( + { + // getEmployeesExternal(organizations_id || []); //获取外部员工 + Apis.Attendance.AttendanceSchedules.ShiftList({ + schedule_date: schedule_date, + organizations_id: + organizations_id?.[organizations_id?.length - 1], + }).then((res) => { + setDataSource(res?.data); + console.log(res); + }); + }} + /> + ); + }, + }, + { + renderFormItem: () => { + return ( + + headerTitle="可编辑表格" + bordered + recordCreatorProps={false} + columns={[ + { + title: '员工ID', + key: 'id', + }, + { + title: '员工', + key: 'name', + }, + ]} + rowKey="id" + value={dataSource} + /> + ); + }, + }, + ]; + }, + }, + ]} + /> + ); +} diff --git a/src/pages/attendance/attendance_schedules/modals/Update.tsx b/src/pages/attendance/attendance_schedules/modals/Update.tsx new file mode 100644 index 0000000..72ec71c --- /dev/null +++ b/src/pages/attendance/attendance_schedules/modals/Update.tsx @@ -0,0 +1,98 @@ +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={ + + } + key={new Date().getTime()} + layout="horizontal" + labelCol={{ span: 5 }} + wrapperCol={{ span: 19 }} + labelAlign="left" + width="500px" + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue(props.item); + } + }} + onFinish={async (values) => + Apis.Attendance.AttendanceSchedules.Update({ + ...values, + id: props.item?.id ?? 0, + }) + .then(() => { + props.reload?.(); + message.success('编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + Selects?.Employees({ + title: '员工信息', + key: 'company_employees_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + required: true, + fieldProps: { + disabled: true, + }, + }), + + Selects?.AssetProjects({ + title: '项目信息', + key: 'asset_projects_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + fieldProps: { + disabled: true, + }, + }), + { + title: '班次日期', + key: 'schedule_date', + valueType: 'date', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + style: { + width: '100%', + }, + disabled: true, + }, + }, + Selects?.AttendanceShiftsSelect({ + key: 'attendance_shifts_id', + title: '选择班次', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.number }, + }), + { + title: '备注', + key: 'remark', + valueType: 'textarea', + colProps: { span: 24 }, + }, + ]} + /> + ); +} diff --git a/src/pages/attendance/attendance_schedules/pages/create.tsx b/src/pages/attendance/attendance_schedules/pages/create.tsx new file mode 100644 index 0000000..e762972 --- /dev/null +++ b/src/pages/attendance/attendance_schedules/pages/create.tsx @@ -0,0 +1,304 @@ +import { + MyButtons, + MyModalFormProps, + MyPageContainer, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + BetaSchemaForm, + EditableProTable, + ProCard, +} from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Form, message, Space } from 'antd'; +import dayjs from 'dayjs'; +import { useState } from 'react'; +let optionsData: any = []; +export default function Index({ title = '批量排班' }) { + const [form] = Form.useForm(); + const navigate = useNavigate(); + const [startDate, setStartDate] = useState([]); + const [dataSource, setDataSource] = useState([]); + + // 动态提取日期(排除 id 和 name 字段) + const extractDates = (data: any) => { + const firstPerson = data[0]; + return Object.keys(firstPerson).filter( + (key) => key !== 'id' && key !== 'name' && !isNaN(Date.parse(key)), + ); + }; + + const getOptionsData = async (params: any) => { + if (optionsData?.length) { + return optionsData || []; + } + let res: any = await Apis.Attendance.AttendanceShifts.Select({ + ...params, + name: params?.keyWords || undefined, + }); + optionsData = [...res?.data, ...[{ id: -1, name: '取消班次' }]]; + console.log(optionsData, '1'); + return optionsData || []; + }; + // 生成未来7天日期的函数 + const generateFutureDates = (startDate: string) => { + const dates = []; + + const columns = [ + { + title: '员工ID', + dataIndex: 'id', + readonly: true, + }, + { + title: '员工', + dataIndex: 'name', + readonly: true, + }, + ]; + const start = dayjs(startDate); + for (let i = 0; i < 7; i++) { + const currentDate = start.clone().add(i, 'day').format('YYYY-MM-DD'); + dates.push({ + title: currentDate, + key: currentDate, + dataIndex: currentDate, + formItemProps: { ...rulesHelper.number }, + valueType: 'select', + request: async (params: any) => { + return getOptionsData(params); + }, + fieldProps: { + showSearch: true, + allowClear: false, + // placeholder: '请选择班次', + fieldNames: { + label: 'name', + value: 'id', + }, + }, + }); + } + console.log(dates); + if (startDate && dates?.length) { + return [...columns, ...dates]; + } else { + return columns; + } + }; + + return ( + { + navigate(-1); + }} + > + {/* */} + {title} + + } + enableTabs={false} + tabKey="charge-standards-create" + tabLabel={title} + > + +
+ + {...MyModalFormProps.props} + title={title} + // 基础表单 + layoutType="Form" + labelCol={{ span: 24 }} + wrapperCol={{ span: 24 }} + labelAlign="left" + width="900px" + form={form} + submitter={{ + render: (props) => { + return [ + { + props.submit(); + }} + title="提交保存" + />, + ]; + }, + }} + onFinish={async () => { + const dates = extractDates(dataSource); + const missingData: string[] = []; + + // // 先检查所有数据是否完整 + for (const person of dataSource) { + for (const date of dates) { + const shiftId = person[date]; + if (shiftId === undefined || shiftId === null) { + missingData.push(`员工 ${person?.name} 在 ${date}`); + } + } + } + + // 如果有缺失数据,提示并停止执行(只提示一次) + // if (missingData.length > 0) { + // message.error( + // `存在 ${missingData.length} 条未填写的排班数据,请完善后再提交`, + // ); + // return false; + // } + // 数据完整,进行转换和提交 + const transformedData: any = dataSource.flatMap((person: any) => { + console.log(person, 'person'); + + return dates.map((date) => { + let startDateItem: any = {}; + if (person[date] === -1) { + startDate?.flatMap((item: any) => { + if (item?.id === person?.id) { + startDateItem = item; + } + }); + } + console.log(startDateItem, 'startDateItem'); + return { + company_employees_id: person.id, + attendance_shifts_id: + person[date] === -1 + ? startDateItem[date] + : person[date] || 0, + schedule_date: date, + status: person[date] < 0 ? 'Cancelled' : '', + }; + }); + }); + const filteredData = transformedData.filter( + (item: any) => + item.attendance_shifts_id !== null && + item.attendance_shifts_id !== 0, + ); + console.log(transformedData, startDate, 'startDate'); + + console.log(filteredData, 'filteredData'); + // return; + Apis.Attendance.AttendanceSchedules.BatchStore({ + schedules: filteredData || [], + }) + .then(() => { + navigate(-1); + message.success('提交成功'); + }) + .catch(() => false); + console.log(transformedData); + }} + columns={[ + Selects?.OrganizationsTree({ + title: '第一步:选择组织', + key: 'organizations_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '第二步:选择开始日期', + tooltip: '排班开始日期,最大排班日期为当前日期', + key: 'schedule_date', + valueType: 'date', + fieldProps: { + format: 'YYYY-MM-DD', + style: { width: '100%' }, + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + { + valueType: 'dependency', + name: ['organizations_id', 'schedule_date'], + colProps: { span: 24 }, + columns: ({ schedule_date, organizations_id }) => { + return [ + { + renderFormItem: () => { + console.log(schedule_date, organizations_id); + return ( + { + // getEmployeesExternal(organizations_id || []); //获取外部员工 + Apis.Attendance.AttendanceSchedules.ShiftList({ + schedule_date: schedule_date, + organizations_id: + organizations_id?.[ + organizations_id?.length - 1 + ], + }).then((res) => { + setStartDate( + JSON.parse(JSON.stringify(res?.data)), + ); + setDataSource( + JSON.parse(JSON.stringify(res?.data)), + ); + console.log(res); + }); + }} + /> + ); + }, + }, + { + renderFormItem: () => { + return ( + + + key={schedule_date} + headerTitle="第四步:设置员工班次(按周)" + bordered + recordCreatorProps={false} + columns={generateFutureDates(schedule_date || '')} + rowKey="id" + value={dataSource} + onChange={(values) => { + setDataSource(values); + }} + editable={{ + type: 'multiple', + editableKeys: dataSource?.map( + (item: any) => item?.id, + ), + onValuesChange: (record, recordList: any) => { + setDataSource(recordList); + }, + onSave: async (rowKey, data, row) => { + console.log(rowKey, data, row); + }, + }} + /> + + ); + }, + }, + ]; + }, + }, + ]} + /> +
+
+
+ ); +} diff --git a/src/pages/attendance/attendance_shifts/index.tsx b/src/pages/attendance/attendance_shifts/index.tsx new file mode 100644 index 0000000..278df92 --- /dev/null +++ b/src/pages/attendance/attendance_shifts/index.tsx @@ -0,0 +1,154 @@ +import { + MyButtons, + MyColumns, + MyPageContainer, + MyProTableProps, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { ProTable } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Space, Tooltip } from 'antd'; + +export default function Index({ title = '班次管理' }) { + const navigate = useNavigate(); + + return ( + + + MyProTableProps.request( + params, + sort, + Apis.Attendance.AttendanceShifts.List, + ) + } + headerTitle={title} + toolBarRender={() => [ + { + navigate('/attendance/attendance_shifts/pages/create'); + }} + title="新增班次" + />, + ]} + columns={[ + MyColumns.ID({ + search: false, + }), + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + hidden: true, + }), + { + title: '关联项目', + dataIndex: ['asset_project', 'name'], + // search: { + // transform: (value) => { + // return { project_name: value }; + // }, + // }, + search: false, + }, + { + title: '班次名称', + dataIndex: 'name', + }, + + { + title: '时段要求', + dataIndex: 'attendance_shift_periods', + search: false, + render: (_, item: any) => { + const periods = item?.attendance_shift_periods || []; + const periodTexts = periods.map((res: any) => { + return `时段${ + res?.period_order + }: ${res?.work_start_time?.substring( + 0, + 5, + )}-${res?.work_end_time?.substring(0, 5)}`; + }); + const allPeriodsText = periodTexts.join(' '); + + return ( + ( +
{text}
+ )) || '' + } + > +
+ {allPeriodsText} +
+
+ ); + }, + }, + + { + title: '可打卡时间范围', + render(_, record) { + return `${record?.allow_checkin_start} - ${record?.allow_checkin_end}`; + }, + search: false, + }, + { + title: '备注', + dataIndex: 'remark', + search: false, + }, + MyColumns.Boolean({ + dataIndex: 'is_enabled', + title: '启用', + }), + + // MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + { + navigate( + `/attendance/attendance_shifts/pages/update?id=${item.id}`, + ); + }} + title="编辑" + /> + + + Apis.Attendance.AttendanceShifts.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> +
+ ); +} diff --git a/src/pages/attendance/attendance_shifts/pages/create.tsx b/src/pages/attendance/attendance_shifts/pages/create.tsx new file mode 100644 index 0000000..cde6d58 --- /dev/null +++ b/src/pages/attendance/attendance_shifts/pages/create.tsx @@ -0,0 +1,259 @@ +import { + MyFormItems, + MyModalFormProps, + MyPageContainer, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { useNavigate } from '@umijs/max'; +import { Form, message, Space } from 'antd'; +import { useState } from 'react'; +export default function Index({ title = '新增班次' }) { + const [form] = Form.useForm(); + const navigate = useNavigate(); + const [dataSource, setDataSource] = useState< + ApiTypes.Asset.AssetProjects.List[] + >([]); + + return ( + { + navigate(-1); + }} + > + {/* */} + {title} + + } + enableTabs={false} + tabKey="attendance-shifts-create" + tabLabel={title} + > + +
+ + {...MyModalFormProps.props} + title={title} + // 基础表单 + layoutType="Form" + labelCol={{ span: 24 }} + wrapperCol={{ span: 24 }} + labelAlign="left" + width="900px" + form={form} + onFinish={async (values: any) => { + // 处理时间格式转换,将HH:mm转换为HH:mm:ss格式,秒数固定为00 + const formattedValues = { ...values }; + + // 处理work_start_time和work_end_time数组 + if (formattedValues.periods) { + formattedValues.periods = formattedValues.periods.map( + (period: any) => { + return { + ...period, + work_start_time: period.work_start_time + ? `${period.work_start_time}:00` + : '', + work_end_time: period.work_end_time + ? `${period.work_end_time}:00` + : '', + }; + }, + ); + } + + // 处理可打卡开始和结束时间 + if (formattedValues.allow_checkin_start) { + formattedValues.allow_checkin_start = `${formattedValues.allow_checkin_start}:00`; + } + if (formattedValues.allow_checkin_end) { + formattedValues.allow_checkin_end = `${formattedValues.allow_checkin_end}:00`; + } + + Apis.Attendance.AttendanceShifts.Store({ + ...formattedValues, + // is_enabled: values.is_enabled ? true : false, + is_enabled: true, + }) + .then(() => { + //提交 + navigate(-1); + message.success('提交成功'); + }) + .catch(() => false); + }} + columns={[ + { + title: '班次名称', + key: 'name', + formItemProps: { ...rulesHelper.text }, + fieldProps: { + placeholder: '请输入(如:早班、晚班)', + }, + }, + { + valueType: 'formList', + dataIndex: 'periods', + title: '设置需打卡时段', + formItemProps: { ...rulesHelper.array }, + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + MyFormItems.EnumSelect({ + key: 'period_order', + valueEnum: { + 1: '1', + 2: '2', + 3: '3', + 4: '4', + 5: '5', + }, + required: true, + colProps: { span: 4 }, + }), + { + key: 'work_start_time', + valueType: 'time', + fieldProps: { + style: { width: '100%' }, + placeholder: '请输入班次开始时间', + format: 'HH:mm', + }, + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'work_end_time', + valueType: 'time', + fieldProps: { + style: { width: '100%' }, + placeholder: '请输入班次开始时间', + format: 'HH:mm', + }, + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.text }, + }, + ], + }, + ], + }, + { valueType: 'divider' }, + { + title: '可打卡开始时间', + key: 'allow_checkin_start', + valueType: 'time', + fieldProps: { + style: { width: '100%' }, + format: 'HH:mm', + }, + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '可打卡结束时间', + key: 'allow_checkin_end', + fieldProps: { + style: { width: '100%' }, + format: 'HH:mm', + }, + valueType: 'time', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + // { + // title: '启用', + // key: 'is_enabled', + // valueType: 'switch', + // colProps: { span: 24 }, + // }, + // { + // colProps: { span: 24 }, + // title: '选择关联项目', + // tooltip: '选择后对应项目的人员可排班', + // key: 'asset_projects_id', + // formItemProps: { ...rulesHelper.text }, + // renderFormItem: () => { + // return ( + // + // { + // let row = e?.[0]; + // form.setFieldsValue({ + // asset_projects_id: + // row?.asset_projects_id || row?.id, + // }); + // setDataSource(e); + // }} + // /> + // } + // columns={[ + // MyColumns.ID({ + // search: false, + // }), + // { + // title: '名称', + // dataIndex: 'name', + // }, + // MyColumns.Option({ + // render: (_, item: any, index) => ( + // + // { + // setDataSource( + // dataSource.filter( + // (res: any) => res?.id !== item?.id, + // ), + // ); + // }} + // /> + // + // ), + // }), + // ]} + // /> + // + // ); + // }, + // }, + + Selects?.AssetProjects({ + title: '关联项目', + key: 'asset_projects_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + { + title: '备注', + key: 'remark', + valueType: 'textarea', + colProps: { span: 24 }, + }, + ]} + /> +
+
+
+ ); +} diff --git a/src/pages/attendance/attendance_shifts/pages/update.tsx b/src/pages/attendance/attendance_shifts/pages/update.tsx new file mode 100644 index 0000000..8f27d1e --- /dev/null +++ b/src/pages/attendance/attendance_shifts/pages/update.tsx @@ -0,0 +1,263 @@ +import { + MyFormItems, + MyModalFormProps, + MyPageContainer, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm, ProCard } from '@ant-design/pro-components'; +import { useNavigate, useSearchParams } from '@umijs/max'; +import { Form, message, Space } from 'antd'; +import { useEffect, useState } from 'react'; + +export default function Index({ title = '编辑班次' }) { + const [form] = Form.useForm(); + const navigate = useNavigate(); + const [searchParams] = useSearchParams(); + const id = searchParams.get('id') ?? 0; + const [data, setShow] = useState({}); + const [dataSource, setDataSource] = useState< + ApiTypes.Asset.AssetProjects.List[] + >([]); + + const loadShow = () => { + Apis.Attendance.AttendanceShifts.Show({ id: Number(id) }).then((res) => { + setShow(res?.data); + setDataSource([res?.data?.asset_project]); + + // 处理时间格式,将hh:mm:ss转换为hh:mm用于表单显示 + const formData = { ...res?.data }; + + // 处理可打卡开始和结束时间 + if (formData.allow_checkin_start) { + formData.allow_checkin_start = formData.allow_checkin_start.slice(0, 5); + } + if (formData.allow_checkin_end) { + formData.allow_checkin_end = formData.allow_checkin_end.slice(0, 5); + } + + // 处理时间段数组中的时间格式 + if (formData.attendance_shift_periods) { + formData.periods = formData.attendance_shift_periods.map( + (period: any) => { + return { + ...period, + work_start_time: period.work_start_time + ? period.work_start_time.slice(0, 5) + : '', + work_end_time: period.work_end_time + ? period.work_end_time.slice(0, 5) + : '', + }; + }, + ); + } + + form.setFieldsValue({ + ...formData, + asset_projects_id: res?.data?.asset_project?.id, + }); // 编辑赋值 + }); + }; + + useEffect(() => { + loadShow(); + }, [id]); + + return ( + { + navigate(-1); + }} + > + {/* */} + {title} + + } + enableTabs={false} + tabKey="attendance-shifts-update" + tabLabel={title} + > + +
+ + {...MyModalFormProps.props} + title={title} + // 基础表单 + layoutType="Form" + labelCol={{ span: 24 }} + wrapperCol={{ span: 24 }} + labelAlign="left" + width="900px" + form={form} + onFinish={async (values: any) => { + // 处理时间格式转换,将HH:mm转换为HH:mm:ss格式,秒数固定为00 + const formattedValues = { ...values }; + + // 处理work_start_time和work_end_time数组 + if (formattedValues.periods) { + formattedValues.periods = formattedValues.periods.map( + (period: any) => { + return { + ...period, + work_start_time: period.work_start_time + ? `${period.work_start_time}:00` + : '', + work_end_time: period.work_end_time + ? `${period.work_end_time}:00` + : '', + }; + }, + ); + } + + // 处理可打卡开始和结束时间 + if (formattedValues.allow_checkin_start) { + formattedValues.allow_checkin_start = `${formattedValues.allow_checkin_start}:00`; + } + if (formattedValues.allow_checkin_end) { + formattedValues.allow_checkin_end = `${formattedValues.allow_checkin_end}:00`; + } + + Apis.Attendance.AttendanceShifts.Update({ + ...formattedValues, + is_enabled: values.is_enabled ? true : false, + id: data?.id, + }) + .then(() => { + //提交 + navigate(-1); + message.success('编辑成功'); + }) + .catch(() => false); + }} + columns={[ + { + title: '班次名称', + key: 'name', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 12 }, + }, + { + title: '状态', + key: 'is_enabled', + valueType: 'switch', + colProps: { span: 12 }, + fieldProps(form, config) { + return { + ...config.fieldProps, + style: { width: '100%' }, + checkedChildren: '启用', + unCheckedChildren: '停用', + }; + }, + }, + { + valueType: 'formList', + dataIndex: 'periods', + title: '设置需打卡时段', + formItemProps: { ...rulesHelper.array }, + fieldProps: { + copyIconProps: false, + // deleteIconProps: false, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + MyFormItems.EnumSelect({ + key: 'period_order', + valueEnum: { + 1: '1', + 2: '2', + 3: '3', + 4: '4', + 5: '5', + }, + required: true, + colProps: { span: 4 }, + }), + // { + // key: 'period_order', + // valueType: 'digit', + // colProps: { span: 6 }, + // formItemProps: { ...rulesHelper.text }, + // fieldProps: { + // style: { width: '100%' }, + // placeholder: '请输入班次序号', + // }, + // }, + { + key: 'work_start_time', + valueType: 'time', + fieldProps: { + style: { width: '100%' }, + placeholder: '请输入班次开始时间', + format: 'HH:mm', + }, + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.text }, + }, + { + key: 'work_end_time', + fieldProps: { + style: { width: '100%' }, + placeholder: '请输入班次开始时间', + format: 'HH:mm', + }, + valueType: 'time', + colProps: { span: 8 }, + formItemProps: { ...rulesHelper.text }, + }, + ], + }, + ], + }, + { + title: '可打卡开始时间', + key: 'allow_checkin_start', + valueType: 'time', + fieldProps: { + style: { width: '100%' }, + format: 'HH:mm', + }, + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + { + title: '可打卡结束时间', + key: 'allow_checkin_end', + fieldProps: { + style: { width: '100%' }, + format: 'HH:mm', + }, + valueType: 'time', + colProps: { span: 12 }, + formItemProps: { ...rulesHelper.text }, + }, + + Selects?.AssetProjects({ + title: '关联项目', + key: 'asset_projects_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + + { + title: '备注', + key: 'remark', + valueType: 'textarea', + colProps: { span: 24 }, + }, + ]} + /> +
+
+
+ ); +} diff --git a/src/pages/attendance/employee_tracks/$id.tsx b/src/pages/attendance/employee_tracks/$id.tsx new file mode 100644 index 0000000..847bbb8 --- /dev/null +++ b/src/pages/attendance/employee_tracks/$id.tsx @@ -0,0 +1,289 @@ +import { MyPageContainer } from '@/common'; +import { getTodayDate } from '@/common/utils/day'; +import { mapKey } from '@/common/utils/mapConfig'; +import { Apis } from '@/gen/Apis'; +import { LeftOutlined } from '@ant-design/icons'; +import { ProCard } from '@ant-design/pro-components'; +import { useNavigate, useParams } from '@umijs/max'; +import { Button, DatePicker, Space } from 'antd'; +import dayjs from 'dayjs'; +import * as L from 'leaflet'; +import 'leaflet/dist/leaflet.css'; +import { useEffect, useRef } from 'react'; +import './style.scss'; +const dateFormat = 'YYYY/MM/DD'; +export default function Index({ title = '员工轨迹' }) { + const navigate = useNavigate(); + const { id } = useParams<{ id: string }>(); + const mapRef = useRef(null); + const mapInstanceRef = useRef(null); + // 初始化地图 + const initMap = () => { + if (!mapRef.current) return; + + // 创建地图实例 + const map = L.map(mapRef.current, { + center: [30.258134, 120.19382669582967], // 默认中心点(长江三角洲) + zoom: 10, + maxZoom: 18, + zoomControl: false, + attributionControl: false, + }); + + // 添加天地图底图层(矢量地图) + L.tileLayer( + `https://t{s}.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=${mapKey}`, + { + subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], + attribution: '天地图', + minZoom: 1, + maxZoom: 18, + }, + ).addTo(map); + + // 添加天地图文字描述层(矢量注记) + L.tileLayer( + `https://t{s}.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=${mapKey}`, + { + subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], + attribution: '天地图', + minZoom: 1, + maxZoom: 18, + }, + ).addTo(map); + + mapInstanceRef.current = map; + }; + + // 显示轨迹 + const showTrack = (data: any[]) => { + if (!mapInstanceRef.current) return; + + const map = mapInstanceRef.current; + + // 首先清除所有旧的轨迹(无论是否有新数据) + map.eachLayer((layer: L.Layer) => { + if (layer instanceof L.Polyline || layer instanceof L.Marker) { + map.removeLayer(layer); + } + }); + + // 如果没有新的轨迹数据,直接返回 + if (!data || data.length === 0) return; + + // 过滤有效坐标并保留原始数据 + const validPoints = data.filter( + (point) => point.latitude && point.longitude, + ); + + // 转换为Leaflet可识别的坐标格式 + const trackPoints: L.LatLngTuple[] = validPoints.map( + (point) => + [ + parseFloat(point.latitude), + parseFloat(point.longitude), + ] as L.LatLngTuple, + ); + + // 如果过滤后没有有效坐标,返回 + if (trackPoints.length === 0) return; + + // 创建轨迹线 + const trackLine = L.polyline(trackPoints, { + color: '#f00', + weight: 4, + opacity: 1, + }).addTo(map); + + // 添加起点标记 + const startMarker = L.marker(trackPoints[0], { + icon: L.divIcon({ + className: 'track-start-marker', + html: "", + }), + }).addTo(map); + + // 为起点添加弹窗 + const startPoint = validPoints[0]; + startMarker.bindPopup(` +
+

起点

+

序号: 1

+

时间: ${startPoint.track_time || '未知'}

+

坐标: ${startPoint.latitude}, ${ + startPoint.longitude + }

+
+ `); + + // 添加终点标记 + const endMarker = L.marker(trackPoints[trackPoints.length - 1], { + icon: L.divIcon({ + className: 'track-end-marker', + html: "", + }), + }).addTo(map); + + // 为终点添加弹窗 + const endPoint = validPoints[validPoints.length - 1]; + endMarker.bindPopup(` +
+

终点

+

序号: ${validPoints.length}

+

时间: ${endPoint.track_time || '未知'}

+

坐标: ${endPoint.latitude}, ${ + endPoint.longitude + }

+
+ `); + + // 为每个轨迹点添加序号标记和弹窗 + trackPoints.forEach((point, index) => { + // 跳过起点和终点,只标记中间点 + if (index === 0 || index === trackPoints.length - 1) return; + + const currentPoint = validPoints[index]; + const marker = L.marker(point, { + icon: L.divIcon({ + className: 'track-point-marker', + html: `
${ + index + 1 + }
`, + iconSize: [24, 24], + }), + }).addTo(map); + + // 为中间点添加弹窗 + marker.bindPopup(` +
+

点位 ${index + 1}

+

时间: ${currentPoint.track_time || '未知'}

+

坐标: ${currentPoint.latitude}, ${ + currentPoint.longitude + }

+
+ `); + }); + + // 自动调整地图视图以显示整个轨迹 + map.fitBounds(trackLine.getBounds()); + }; + + const loadShow = (day: any) => { + // showTrack([ + // { latitude: 22.566729, longitude: 114.062952 }, + // { latitude: 22.567982, longitude: 114.06278 }, + // { latitude: 22.569394, longitude: 114.062694 }, + // ]); + Apis.Attendance.AttendanceEmployeeTracks.Heatmap({ + company_employees_id: Number(id), + date: day, // 转换为Date类型 + }).then((res) => { + console.log(res); + // 假设API返回的数据结构为{ data: [{ latitude, longitude, time }, ...] } + showTrack(res?.data); + // setTrackData(res.data || []); + }); + }; + useEffect(() => { + // 初始化地图 + initMap(); + // 加载轨迹数据 + loadShow(new Date(getTodayDate())); + + // 组件卸载时清理地图实例 + return () => { + if (mapInstanceRef.current) { + mapInstanceRef.current.remove(); + mapInstanceRef.current = null; + } + }; + }, [id]); + + // // 当轨迹数据变化时,显示轨迹 + // useEffect(() => { + // if (trackData.length > 0) { + // showTrack(trackData); + // } + // }, [trackData]); + + return ( + + } + onClick={() => navigate(-1)} + > + 员工轨迹底图 + + } + headerBordered + extra={ + { + loadShow(dateString); + }} + /> + } + > +
+ +
+ 起点: + +
+
+ 终点: + +
+
+ + + ); +} diff --git a/src/pages/attendance/employee_tracks/style.scss b/src/pages/attendance/employee_tracks/style.scss new file mode 100644 index 0000000..5be1f57 --- /dev/null +++ b/src/pages/attendance/employee_tracks/style.scss @@ -0,0 +1,26 @@ +.track-start-marker { + background-color: #007bff; + color: #fff; + width: 200px; + height: 200px; + border-radius: 100px; + font-size: 0.6em; + text-align: center; + line-height: 200px; + display: flex; + align-items: center; + justify-content: center; +} +.track-end-marker { + background-color: #f00; + color: #fff; + width: 200px; + height: 200px; + border-radius: 100px; + font-size: 0.6em; + text-align: center; + line-height: 200px; + display: flex; + align-items: center; + justify-content: center; +} diff --git a/src/pages/company/employees/index.tsx b/src/pages/company/employees/index.tsx index 3cc4ba9..d2ac3da 100644 --- a/src/pages/company/employees/index.tsx +++ b/src/pages/company/employees/index.tsx @@ -130,8 +130,14 @@ export default function Index({ title = '员工管理' }) { search: false, }, { - title: '系统角色', - dataIndex: 'roles', + title: '员工端角色', + dataIndex: 'employee_roles', + renderText: renderTextHelper.TagList, + hideInSearch: true, + }, + { + title: '系统后台角色', + dataIndex: 'company_roles', renderText: renderTextHelper.TagList, hideInSearch: true, }, diff --git a/src/pages/company/employees/modals/EmployeeCreate.tsx b/src/pages/company/employees/modals/EmployeeCreate.tsx index 213991d..e41b574 100644 --- a/src/pages/company/employees/modals/EmployeeCreate.tsx +++ b/src/pages/company/employees/modals/EmployeeCreate.tsx @@ -90,7 +90,14 @@ export default function Create(props: MyBetaModalFormProps) { placeholder: '请输入关键字搜索', }, }), - SysSelects.SysRoles(), + SysSelects.SysEmployeeRoles({ + title: '员工角色', + required: false, + }), + SysSelects.SysRoles({ + title: '系统角色', + required: false, + }), { key: 'remark', title: '备注', diff --git a/src/pages/company/employees/modals/EmployeeUpdate.tsx b/src/pages/company/employees/modals/EmployeeUpdate.tsx index 836c1b9..66e7043 100644 --- a/src/pages/company/employees/modals/EmployeeUpdate.tsx +++ b/src/pages/company/employees/modals/EmployeeUpdate.tsx @@ -7,6 +7,7 @@ import { } from '@/common'; import { Selects } from '@/components/Select'; +import { SysSelects } from '@/components/SysSelects'; import { Apis } from '@/gen/Apis'; import { SexEnum } from '@/gen/Enums'; import { BetaSchemaForm } from '@ant-design/pro-components'; @@ -29,7 +30,10 @@ export default function Update(props: MyBetaModalFormProps) { if (open && props.item) { form.setFieldsValue({ ...props.item, - roles_id: props.item?.roles?.map((item: any) => item.value), + roles_id: props.item?.company_roles?.map((item: any) => item.value), + employee_roles_id: props.item?.employee_roles?.map( + (item: any) => item.value, + ), positions_id: props.item?.positions_id ?? '', }); } @@ -92,7 +96,36 @@ export default function Update(props: MyBetaModalFormProps) { placeholder: '请输入关键字搜索', }, }), - + SysSelects.SysEmployeeRoles({ + title: '员工角色', + required: false, + fieldProps: { + labelRender: (res: any) => { + if (res?.label) { + return res?.label; + } else { + return props.item?.employee_roles?.map( + (item: any) => item.label, + ); + } + }, + }, + }), + SysSelects.SysRoles({ + title: '系统角色', + required: false, + fieldProps: { + labelRender: (res: any) => { + if (res?.label) { + return res?.label; + } else { + return props.item?.company_roles?.map( + (item: any) => item.label, + ); + } + }, + }, + }), // { // key: 'password', // title: '密码', diff --git a/src/pages/patrol/index.tsx b/src/pages/patrol/index.tsx new file mode 100644 index 0000000..2198275 --- /dev/null +++ b/src/pages/patrol/index.tsx @@ -0,0 +1,53 @@ +import { MyPageContainer } from '@/common'; +import MyPatrolWork from '@/pages/work_order/patrol_work'; +import { useSearchParams } from '@umijs/max'; +import { Tabs } from 'antd'; +import { useEffect, useState } from 'react'; +import MyPatrolLocations from './patrol_locations'; +import MyPatrolRoutes from './patrol_routes'; +import MyPatrolTasks from './patrol_tasks'; + +export default function Index({ title = '安防巡更' }) { + const [searchParams] = useSearchParams(); + const [activeKey, setActiveKey] = useState('MyPatrolTasks'); + + const items = [ + { + key: '1', + label: '巡更任务', + children: , + }, + { + key: '2', + label: '路线配置', + children: , + }, + { + key: '3', + label: '点位配置', + children: , + }, + { + key: '4', + label: '巡更工单', + children: , + }, + ]; + + useEffect(() => { + if (searchParams?.get('key')) { + setActiveKey(searchParams?.get('key') || '1'); + } + }, []); + + return ( + + + + ); +} diff --git a/src/pages/patrol/patrol_locations/index.tsx b/src/pages/patrol/patrol_locations/index.tsx new file mode 100644 index 0000000..aced01c --- /dev/null +++ b/src/pages/patrol/patrol_locations/index.tsx @@ -0,0 +1,244 @@ +import { MyButtons, MyColumns, MyProTableProps } from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { ProTable } from '@ant-design/pro-components'; +import { message, Progress, Space } from 'antd'; +import { saveAs } from 'file-saver'; +import JSZip from 'jszip'; +import { useState } from 'react'; +import Create from './modals/Create'; +import Update from './modals/Update'; +interface DataType { + key?: React.Key; + id?: React.Key; +} +export default function Index({ title = '点位配置' }) { + const [count, setCount] = useState(0); + const [selectedRowKeys, setSelectedRowKeys] = useState([]); + const [downloadProgress, setDownloadProgress] = useState(0); + const [downloading, setDownloading] = useState(false); + const [getSelectedRow, setSelectedRow] = useState([]); + const rowSelection: any = { + selectedRowKeys, + onChange: (selectedRowKeys: React.Key[], selectedRows: DataType[]) => { + console.log(selectedRows, 'selectedRows[0]'); + if (selectedRowKeys.length > 10) { + message.warning('最多批量下载10个'); + return; + } + setSelectedRowKeys(selectedRowKeys); + setSelectedRow(selectedRows); + }, + getCheckboxProps: (record: any) => ({ + disabled: !record.is_enabled, + }), + onSelectAll: (selected: boolean, selectedRows: DataType[]) => { + if (selected && selectedRows.length > 10) { + message.warning('全选数量超过10个!'); + return false; + } + }, + defaultSelectedRowKeys: !count + ? [] + : getSelectedRow?.map((item: any) => item.id), + }; + + // 模拟获取二维码接口 + const getQRCode = async (id?: string) => { + let res = await Apis.Patrol.PatrolLocations.PatrolLocationQrCode({ + id: Number(id), + }); + return res?.data?.qr_code; + }; + + // 生成带海报的二维码 + const generatePosterQR = async (base64: string, res: any) => { + return new Promise((resolve) => { + const canvas = document.createElement('canvas'); + const ctx: any = canvas.getContext('2d'); + + canvas.width = 500; + canvas.height = 800; + + // 海报样式 + ctx.fillStyle = '#1890ff'; + ctx.fillRect(0, 0, canvas.width, canvas.height); + + ctx.fillStyle = 'white'; + ctx.font = 'bold 36px Arial'; + ctx.textAlign = 'center'; + ctx.fillText(`${res?.name}`, canvas.width / 2, 130); + + const qrImage = new Image(); + qrImage.onload = () => { + const qrSize = 300; + const qrX = (canvas.width - qrSize) / 2; + const qrY = 210; + ctx.drawImage(qrImage, qrX, qrY, qrSize, qrSize); + + ctx.font = '20px Arial'; + ctx.fillText('扫描二维码完成签到', canvas.width / 2, 570); + ctx.font = '16px Arial'; + ctx.fillText(res?.code, canvas.width / 2, 605); + + resolve(canvas.toDataURL('image/png')); + }; + qrImage.src = base64; + }); + }; + + const download = async (type: number) => { + if (!getSelectedRow?.length) { + message.error('请选择巡逻位置!'); + return; + } + setDownloading(true); + setDownloadProgress(0); + try { + const zip = new JSZip(); + const total = getSelectedRow.length; + for (let i = 0; i < total; i++) { + let res = getSelectedRow?.[i]; + if (res?.id) { + await new Promise((resolve: any) => { + setTimeout(resolve, 1000); + }); + const qrCode = await getQRCode(res?.id); + if (type === 1) { + const base64Data = qrCode.split(',')[1]; + zip.file(`${res?.name}_${res?.code}.png`, base64Data, { + base64: true, + }); + } + if (type === 2) { + // 带海报的二维码 + const posterData: any = await generatePosterQR(qrCode, res); + const fileData = posterData.split(',')[1]; + zip.file(`${res?.name}_${res?.code}.png`, fileData, { + base64: true, + }); + } + setCount(i + 1); + const progress = Math.round(((i + 1) / total) * 100); + setDownloadProgress(progress); + // 添加延迟 + } + } + const content = await zip.generateAsync({ type: 'blob' }); + saveAs(content, `扫码签到二维码.zip`); + setTimeout(() => { + setCount(0); + }, 1000); + } catch (error) { + console.error('下载失败:', error); + message.error('下载失败,请重试'); + } finally { + setDownloading(false); + setDownloadProgress(0); + } + }; + + return ( + + ), + }} + request={async (params, sort) => + MyProTableProps.request(params, sort, Apis.Patrol.PatrolLocations.List) + } + rowSelection={{ type: 'checkbox', ...rowSelection }} + toolBarRender={(action) => [ + download(1)} + />, + download(2)} + />, + , + ]} + columns={[ + MyColumns.ID({ + search: false, + }), + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + hidden: true, + }), + { + title: '关联项目', + dataIndex: ['asset_project', 'name'], + search: { + transform: (value) => { + return { project_name: value }; + }, + }, + }, + { + title: '点位名称', + dataIndex: 'name', + }, + { + title: '位置编码', + dataIndex: 'code', + }, + MyColumns.Boolean({ + dataIndex: 'is_enabled', + title: '启用/禁用', + search: false, + }), + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + Apis.Patrol.PatrolLocations.Update({ + id: item.id ?? 0, + is_enabled: item.is_enabled === 1 ? 0 : 1, + name: item.name, + code: item.code, + asset_projects_id: item.asset_projects_id, + }).then(() => action?.reload()) + } + /> + + + Apis.Patrol.PatrolLocations.Delete({ id: item.id }).then(() => + action?.reload(), + ) + } + /> + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/patrol/patrol_locations/modals/Create.tsx b/src/pages/patrol/patrol_locations/modals/Create.tsx new file mode 100644 index 0000000..585e822 --- /dev/null +++ b/src/pages/patrol/patrol_locations/modals/Create.tsx @@ -0,0 +1,80 @@ +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}`} + layout="horizontal" + labelCol={{ span: 5 }} + wrapperCol={{ span: 19 }} + labelAlign="left" + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + trigger={} + onFinish={async (values: any) => + Apis.Patrol.PatrolLocations.Store({ + ...values, + longitude: values?.location ? values.location.split(',')[0] : '', + latitude: values?.location ? values.location.split(',')[1] : '', + is_enabled: values.is_enabled ? 1 : 0, + }) + .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 }, + }), + { + key: 'name', + title: '点位名称', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 24 }, + fieldProps: { + placeholder: '请输入点位名称', + }, + }, + { + title: '位置信息', + key: 'remark', + formItemProps: { ...rulesHelper.text }, + valueType: 'textarea', + colProps: { span: 24 }, + fieldProps: { + placeholder: '请输入点位的具体位置信息', + }, + }, + { + title: '是否启用', + key: 'is_enabled', + valueType: 'switch', + colProps: { span: 24 }, + }, + ]} + /> + ); +} diff --git a/src/pages/patrol/patrol_locations/modals/Update.tsx b/src/pages/patrol/patrol_locations/modals/Update.tsx new file mode 100644 index 0000000..c262a2c --- /dev/null +++ b/src/pages/patrol/patrol_locations/modals/Update.tsx @@ -0,0 +1,86 @@ +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={`编辑${props.title}`} + trigger={} + key={new Date().getTime()} + layout="horizontal" + labelCol={{ span: 5 }} + wrapperCol={{ span: 19 }} + labelAlign="left" + width="600px" + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + form.setFieldsValue({ + ...props.item, + location: `${props.item?.longitude || ''},${ + props.item?.latitude || '' + }`, + }); + } + }} + onFinish={async (values: any) => + Apis.Patrol.PatrolLocations.Update({ + ...values, + longitude: values?.location ? values.location.split(',')[0] : '', + latitude: values?.location ? values.location.split(',')[1] : '', + is_enabled: values.is_enabled ? 1 : 0, + id: props.item?.id ?? 0, + }) + .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 }, + }), + { + key: 'name', + title: '点位名称', + formItemProps: { ...rulesHelper.text }, + colProps: { span: 24 }, + fieldProps: { + placeholder: '请输入点位名称', + }, + }, + { + title: '位置信息', + key: 'remark', + formItemProps: { ...rulesHelper.text }, + valueType: 'textarea', + colProps: { span: 24 }, + fieldProps: { + placeholder: '请输入点位的具体位置信息', + }, + }, + { + title: '是否启用', + key: 'is_enabled', + valueType: 'switch', + colProps: { span: 24 }, + }, + ]} + /> + ); +} diff --git a/src/pages/patrol/patrol_routes/index.tsx b/src/pages/patrol/patrol_routes/index.tsx new file mode 100644 index 0000000..f92902b --- /dev/null +++ b/src/pages/patrol/patrol_routes/index.tsx @@ -0,0 +1,163 @@ +import { MyButtons, MyColumns, MyProTableProps } from '@/common'; +import { showTime } from '@/common/utils/day'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { PatrolRoutesGenerationMethodEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space, Tooltip } from 'antd'; +import Create from './modals/Create'; +import Update from './modals/Update'; + +export default function Index() { + return ( + + MyProTableProps.request(params, sort, Apis.Patrol.PatrolRoutes.List) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID({ + search: false, + }), + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + hidden: true, + }), + { + title: '关联项目', + dataIndex: ['asset_project', 'name'], + // search: { + // transform: (value) => { + // return { project_name: value }; + // }, + // }, + search: false, + }, + { + title: '路线名称', + dataIndex: 'name', + search: true, + }, + { + title: '点位数', + render: (_, item: any) => { + const locations = item?.patrol_route_locations || []; + const locationNames = locations + .map((res: any) => { + return res?.patrol_location?.name || ''; + }) + .filter(Boolean); + const pointCount = locationNames.length; + + return ( + ( +
+ 点位{index + 1}:{name} +
+ )) || '' + } + > +
+ {pointCount} +
+
+ ); + }, + }, + + MyColumns.EnumTag({ + title: '巡更周期', + dataIndex: 'generation_method', + valueEnum: PatrolRoutesGenerationMethodEnum, + }), + { + title: '周期', + search: false, + + render: (_, item: any) => { + if ( + item?.generation_method === + PatrolRoutesGenerationMethodEnum.Daily.value + ) { + return '每天'; + } else if ( + item?.generation_method === + PatrolRoutesGenerationMethodEnum.Weekly.value + ) { + const dateArray = item?.date || []; + if (dateArray.length === 0) return '每周'; + // 检查dateArray中的元素是否为对象,若是则提取weekday属性 + const weekdays = dateArray + .map((res: any) => { + if (typeof res === 'object' && res !== null) { + return res?.weekday || ''; + } + return res; + }) + .filter(Boolean); + return `每周${weekdays.join('/')}`; + } else if ( + item?.generation_method === + PatrolRoutesGenerationMethodEnum.Monthly.value + ) { + const dateArray = item?.date || []; + if (dateArray.length === 0) return '每月'; + return `每月${dateArray.join('/')}`; + } + return ''; + }, + }, + { + title: '任务时段', + search: false, + render: (_, item: any) => { + return `${showTime(item.task_start_time)}-${showTime( + item.task_end_time, + )}`; + }, + }, + // { + // title: '可执行时段', + // search: false, + // render: (_, item: any) => { + // return `${showTime(item.clock_start_time)}-${showTime( + // item.clock_end_time, + // )}`; + // }, + // }, + MyColumns.Boolean({ + dataIndex: 'is_enabled', + title: '是否启用', + }), + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + Apis.Patrol.PatrolRoutes.Delete({ id: item.id }).then(() => + action?.reload(), + ) + } + /> + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/patrol/patrol_routes/modals/Create.tsx b/src/pages/patrol/patrol_routes/modals/Create.tsx new file mode 100644 index 0000000..c9ab064 --- /dev/null +++ b/src/pages/patrol/patrol_routes/modals/Create.tsx @@ -0,0 +1,324 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { PatrolRoutesGenerationMethodEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +import { useEffect, useRef } from 'react'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const actionRef = useRef(); + + // 使用useEffect添加样式,确保组件挂载时样式正确应用 + useEffect(() => { + const styleId = 'custom-checkbox-styles'; + let styleElement = document.getElementById(styleId) as HTMLStyleElement; + + if (!styleElement) { + styleElement = document.createElement('style'); + styleElement.id = styleId; + document.head.appendChild(styleElement); + } + + // 添加checkbox样式,确保每个选项宽度一致且label和checkbox在同一行,一行显示7个 + styleElement.textContent = ` + /* 为checkbox组的容器设置样式 */ + .custom-checkbox-group { + display: flex; + flex-wrap: wrap; + gap: 4px; + width: 100%; + box-sizing: border-box; + } + + /* 为每个checkbox选项设置固定宽度,使一行能显示7个,并确保在同一行 */ + .custom-checkbox-group .ant-checkbox-wrapper { + display: inline-flex; + align-items: center; + justify-content: center; + width: calc(14.2857% - 4px); /* 一行7个,减去间距 */ + min-width: 60px; + text-align: center; + margin-right: 0; + margin-bottom: 0; + white-space: nowrap; + box-sizing: border-box; + } + + /* 确保label和checkbox在同一行 */ + .custom-checkbox-group .ant-checkbox + span { + display: inline; + width: auto; + margin-left: 4px; + text-align: center; + font-size: 14px; + } + + /* 确保整个选项作为一个整体居中 */ + .custom-checkbox-group .ant-checkbox-wrapper-inner { + display: flex; + align-items: center; + justify-content: center; + } + + /* 调整checkbox本身的大小 */ + .custom-checkbox-group .ant-checkbox { + transform: scale(0.9); + } + `; + + // 清理函数 + return () => { + if (styleElement && styleElement.parentNode) { + styleElement.parentNode.removeChild(styleElement); + } + }; + }, []); + return ( + + {...MyModalFormProps.props} + title={`添加${props.title}`} + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 20 }} + labelAlign="left" + width="720px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + trigger={} + onFinish={async (values: any) => + Apis.Patrol.PatrolRoutes.Store({ + ...values, + is_enabled: 1, + patrol_location: values.patrol_location?.map( + (item: any) => item.location_id, + ), + clock_start_time: values.task_start_time, + clock_end_time: values.task_end_time, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + title: '路线名称', + key: 'name', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + { + valueType: 'dependency', + name: ['asset_projects_id'], + columns: ({ asset_projects_id }) => { + return asset_projects_id + ? [ + { + valueType: 'formList', + dataIndex: 'patrol_location', + title: '选择点位', + formItemProps: { ...rulesHelper.array }, + fieldProps: { + actionRef: actionRef, + copyIconProps: false, + addButtonProps: { + children: '添加点位', + }, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + Selects?.PatrolLocationsSelect({ + title: '', + key: 'location_id', + tooltip: '点位的巡更顺序未为【自上而下】', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + params: { + asset_projects_id: asset_projects_id, + }, + fieldProps: { + mode: 'single', + placeholder: + '请选择巡逻点位(如空白,请在“点位配置”中添加)', + }, + }), + ], + }, + ], + }, + ] + : []; + }, + }, + { + key: 'task_start_time', + title: '任务时段', + colProps: { span: 12 }, + valueType: 'time', + required: true, + formItemProps: { + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + ...rulesHelper.text, + }, + fieldProps: { + placeholder: '请设置任务开始时间', + format: 'HH:mm', + style: { width: '100%' }, + }, + }, + { + key: 'task_end_time', + valueType: 'time', + colProps: { span: 12 }, + formItemProps: { + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + ...rulesHelper.text, + }, + fieldProps: { + placeholder: '请设置任务结束时间', + format: 'HH:mm', + style: { width: '100%' }, + }, + }, + // { + // title: '执行时段', + // tooltip: + // '任务的具体执行中,不能早于可执行开始时间,不能晚于可执行结束时间', + // key: 'clock_start_time', + // colProps: { span: 12 }, + // valueType: 'time', + // required: true, + // formItemProps: { + // labelCol: { span: 8 }, + // wrapperCol: { span: 16 }, + // ...rulesHelper.text, + // }, + // fieldProps: { + // placeholder: '请设置任务可执行开始时间', + // format: 'HH:mm', + // style: { width: '100%' }, + // }, + // }, + // { + // key: 'clock_end_time', + // valueType: 'time', + // colProps: { span: 12 }, + // formItemProps: { + // labelCol: { span: 8 }, + // wrapperCol: { span: 16 }, + // ...rulesHelper.text, + // }, + // fieldProps: { + // placeholder: '请设置任务可执行结束时间', + // format: 'HH:mm', + // style: { width: '100%' }, + // }, + // }, + MyFormItems.EnumRadio({ + key: 'generation_method', + title: '巡更周期', + tooltip: '每天巡更一次/每周x巡更一次/每月x号巡更一次', + valueEnum: PatrolRoutesGenerationMethodEnum, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + onChange: () => { + // 切换巡更周期时清空生成时段 + form.setFieldValue('date', undefined); + }, + }, + }), + { + valueType: 'dependency', + name: ['generation_method'], + columns: ({ generation_method }) => { + return generation_method === 'Weekly' || + generation_method === 'Monthly' + ? [ + { + title: '生成时段', + key: 'date', + valueType: 'checkbox', + formItemProps: { ...rulesHelper.array }, + colProps: { span: 24 }, + fieldProps: { + style: { width: '100%' }, + // 使用CSS方式设置每个checkbox选项的宽度 + className: 'custom-checkbox-group', + }, + valueEnum: () => { + if (generation_method === 'Weekly') { + const weekDays = [ + { label: '周一', value: 1 }, + { label: '周二', value: 2 }, + { label: '周三', value: 3 }, + { label: '周四', value: 4 }, + { label: '周五', value: 5 }, + { label: '周六', value: 6 }, + { label: '周日', value: 7 }, + ]; + return weekDays.reduce((acc: any, day) => { + acc[day.value] = { text: day.label }; + return acc; + }, {}); + } + if (generation_method === 'Monthly') { + const monthDays = Array.from( + { length: 31 }, + (_, index) => { + const day = index + 1; + return { + label: `${day < 10 ? `0${day}` : day}号`, + value: day, + }; + }, + ); + + return monthDays.reduce((acc: any, day) => { + acc[day.value] = { text: day.label }; + return acc; + }, {}); + } + }, + }, + ] + : []; + }, + }, + + { + title: '备注', + key: 'remark', + valueType: 'textarea', + colProps: { span: 24 }, + }, + ]} + /> + ); +} diff --git a/src/pages/patrol/patrol_routes/modals/Update.tsx b/src/pages/patrol/patrol_routes/modals/Update.tsx new file mode 100644 index 0000000..46724d2 --- /dev/null +++ b/src/pages/patrol/patrol_routes/modals/Update.tsx @@ -0,0 +1,338 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { PatrolRoutesGenerationMethodEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +import { useEffect, useRef } from 'react'; + +export default function Update(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + const actionRef = useRef(); + + const loadShow = () => { + Apis.Patrol.PatrolRoutes.Show({ id: props.item?.id ?? 0 }).then((res) => { + form.setFieldsValue({ + ...res?.data, + patrol_location: res?.data?.patrol_route_locations?.map( + (item: any) => ({ + location_id: item.patrol_locations_id, + }), + ), + }); + }); + }; + + // 使用useEffect添加样式,确保组件挂载时样式正确应用 + useEffect(() => { + const styleId = 'custom-checkbox-styles'; + let styleElement = document.getElementById(styleId) as HTMLStyleElement; + + if (!styleElement) { + styleElement = document.createElement('style'); + styleElement.id = styleId; + document.head.appendChild(styleElement); + } + + // 添加checkbox样式,确保每个选项宽度一致且label和checkbox在同一行,一行显示7个 + styleElement.textContent = ` + /* 为checkbox组的容器设置样式 */ + .custom-checkbox-group { + display: flex; + flex-wrap: wrap; + gap: 4px; + width: 100%; + box-sizing: border-box; + } + + /* 为每个checkbox选项设置固定宽度,使一行能显示7个,并确保在同一行 */ + .custom-checkbox-group .ant-checkbox-wrapper { + display: inline-flex; + align-items: center; + justify-content: center; + width: calc(14.2857% - 4px); /* 一行7个,减去间距 */ + min-width: 60px; + text-align: center; + margin-right: 0; + margin-bottom: 0; + white-space: nowrap; + box-sizing: border-box; + } + + /* 确保label和checkbox在同一行 */ + .custom-checkbox-group .ant-checkbox + span { + display: inline; + width: auto; + margin-left: 4px; + text-align: center; + font-size: 14px; + } + + /* 确保整个选项作为一个整体居中 */ + .custom-checkbox-group .ant-checkbox-wrapper-inner { + display: flex; + align-items: center; + justify-content: center; + } + + /* 调整checkbox本身的大小 */ + .custom-checkbox-group .ant-checkbox { + transform: scale(0.9); + } + `; + + // 清理函数 + return () => { + if (styleElement && styleElement.parentNode) { + styleElement.parentNode.removeChild(styleElement); + } + }; + }, [props.item?.id]); + + return ( + + {...MyModalFormProps.props} + title={`编辑${props.title}`} + trigger={} + key={new Date().getTime()} + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 20 }} + labelAlign="left" + width="720px" + form={form} + onOpenChange={(open: any) => { + if (open && props.item) { + props.item?.id ? loadShow() : null; + } + }} + onFinish={async (values: any) => + Apis.Patrol.PatrolRoutes.Update({ + ...values, + patrol_location: values.patrol_location?.map( + (item: any) => item.location_id, + ), + is_enabled: values.is_enabled ? 1 : 0, + id: props.item?.id ?? 0, + clock_start_time: values.task_start_time, + clock_end_time: values.task_end_time, + }) + .then(() => { + props.reload?.(); + message.success(props.title + '编辑成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + title: '路线名称', + key: 'name', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }, + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + { + valueType: 'dependency', + name: ['asset_projects_id'], + columns: ({ asset_projects_id }) => { + return asset_projects_id + ? [ + { + valueType: 'formList', + dataIndex: 'patrol_location', + title: '选择点位', + formItemProps: { ...rulesHelper.array }, + fieldProps: { + actionRef: actionRef, + copyIconProps: false, + addButtonProps: { + children: '添加点位', + }, + }, + columns: [ + { + valueType: 'group', + colProps: { span: 24 }, + columns: [ + Selects?.PatrolLocationsSelect({ + title: '', + key: 'location_id', + colProps: { span: 24 }, + tooltip: '点位的巡更顺序未为【自上而下】', + formItemProps: { ...rulesHelper.text }, + params: { + asset_projects_id: asset_projects_id, + }, + fieldProps: { + mode: 'single', + placeholder: + '请选择巡逻点位(如空白,请在“点位配置”中添加)', + }, + }), + ], + }, + ], + }, + ] + : []; + }, + }, + { + key: 'task_start_time', + title: '任务时段', + colProps: { span: 12 }, + valueType: 'time', + required: true, + formItemProps: { + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + ...rulesHelper.text, + }, + fieldProps: { + placeholder: '请设置任务开始时间', + format: 'HH:mm', + style: { width: '100%' }, + }, + }, + { + key: 'task_end_time', + valueType: 'time', + colProps: { span: 12 }, + formItemProps: { + labelCol: { span: 8 }, + wrapperCol: { span: 16 }, + ...rulesHelper.text, + }, + fieldProps: { + placeholder: '请设置任务结束时间', + format: 'HH:mm', + style: { width: '100%' }, + }, + }, + // { + // title: '执行时段', + // tooltip: + // '任务的具体执行中,不能早于可执行开始时间,不能晚于可执行结束时间', + // key: 'clock_start_time', + // colProps: { span: 12 }, + // valueType: 'time', + // required: true, + // formItemProps: { + // labelCol: { span: 8 }, + // wrapperCol: { span: 16 }, + // ...rulesHelper.text, + // }, + // fieldProps: { + // placeholder: '请设置任务可执行开始时间', + // format: 'HH:mm', + // style: { width: '100%' }, + // }, + // }, + // { + // key: 'clock_end_time', + // valueType: 'time', + // colProps: { span: 12 }, + // formItemProps: { + // labelCol: { span: 8 }, + // wrapperCol: { span: 16 }, + // ...rulesHelper.text, + // }, + // fieldProps: { + // placeholder: '请设置任务可执行结束时间', + // format: 'HH:mm', + // style: { width: '100%' }, + // }, + // }, + MyFormItems.EnumRadio({ + key: 'generation_method', + title: '巡更周期', + tooltip: '每天巡更一次/每周x巡更一次/每月x号巡更一次', + valueEnum: PatrolRoutesGenerationMethodEnum, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { + onChange: () => { + form.setFieldValue('date', undefined); + }, + }, + }), + { + valueType: 'dependency', + name: ['generation_method'], + columns: ({ generation_method }) => { + return generation_method === 'Weekly' || + generation_method === 'Monthly' + ? [ + { + title: '生成时段', + key: 'date', + valueType: 'checkbox', + formItemProps: { ...rulesHelper.array }, + colProps: { span: 24 }, + fieldProps: { + style: { width: '100%' }, + // 使用CSS方式设置每个checkbox选项的宽度 + className: 'custom-checkbox-group', + }, + valueEnum: () => { + if (generation_method === 'Weekly') { + const weekDays = [ + { label: '周一', value: 1 }, + { label: '周二', value: 2 }, + { label: '周三', value: 3 }, + { label: '周四', value: 4 }, + { label: '周五', value: 5 }, + { label: '周六', value: 6 }, + { label: '周日', value: 7 }, + ]; + return weekDays.reduce((acc: any, day) => { + acc[day.value] = { text: day.label }; + return acc; + }, {}); + } + if (generation_method === 'Monthly') { + const monthDays = Array.from( + { length: 31 }, + (_, index) => { + const day = index + 1; + return { + label: `${day < 10 ? `0${day}` : day}号`, + value: day, + }; + }, + ); + + return monthDays.reduce((acc: any, day) => { + acc[day.value] = { text: day.label }; + return acc; + }, {}); + } + }, + }, + ] + : []; + }, + }, + + { + title: '备注', + key: 'remark', + valueType: 'textarea', + colProps: { span: 24 }, + }, + ]} + /> + ); +} diff --git a/src/pages/patrol/patrol_tasks/index.tsx b/src/pages/patrol/patrol_tasks/index.tsx new file mode 100644 index 0000000..e645449 --- /dev/null +++ b/src/pages/patrol/patrol_tasks/index.tsx @@ -0,0 +1,139 @@ +import { MyButtons, MyColumns, MyProTableProps } from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { PatrolTasksCreateTypeEnum, PatrolTasksStatusEnum } from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import Create from './modals/Create'; +import PatrolOrderAssign from './modals/PatrolOrderAssign'; +import PatrolOrderShow from './modals/PatrolOrderShow'; + +export default function Index({ title = '巡更任务' }) { + return ( + + MyProTableProps.request(params, sort, Apis.Patrol.PatrolTasks.List) + } + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID({ + search: false, + }), + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + hidden: true, + }), + { + title: '关联项目', + dataIndex: ['asset_project', 'name'], + search: { + transform: (value) => { + return { project_name: value }; + }, + }, + }, + { + title: '路线名称', + dataIndex: ['patrol_route', 'name'], + search: { + transform: (value) => { + return { patrol_route_name: value }; + }, + }, + }, + + { + title: '任务时段', + dataIndex: 'start_time', + valueType: 'dateTime', + render: (_, item: any) => { + // 格式化开始时间(显示日期和时分) + const formatStartTime = (timeStr: string) => { + if (!timeStr) return ''; + const [date, time] = timeStr.split(' '); + if (!time) return date; + return `${date} ${time.split(':').slice(0, 2).join(':')}`; + }; + + // 格式化结束时间(只显示时分) + const formatEndTime = (timeStr: string) => { + if (!timeStr) return ''; + const [, time] = timeStr.split(' '); + if (!time) return ''; + return time.split(':').slice(0, 2).join(':'); + }; + + return `${formatStartTime(item.start_time)} - ${formatEndTime( + item.end_time, + )}`; + }, + search: false, + }, + { + title: '任务时段', + dataIndex: 'date_time', + valueType: 'dateRange', + hideInTable: true, + }, + MyColumns.EnumTag({ + title: '生成方式', + dataIndex: 'create_type', + valueEnum: PatrolTasksCreateTypeEnum, + }), + MyColumns.EnumTag({ + title: '任务状态', + dataIndex: 'status', + valueEnum: PatrolTasksStatusEnum, + search: false, + }), + { + title: '指派时间', + dataIndex: 'assign_time', + search: false, + }, + { + title: '关联工单', + dataIndex: 'house_work_orders_id', + search: false, + }, + { + title: '完成时间', + dataIndex: 'complete_time', + search: false, + }, + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + {item?.status === 'Unassigned' && ( + + )} + {item.status !== 'Unassigned' && ( + + )} + + Apis.Patrol.PatrolTasks.Delete({ id: item.id }).then(() => + action?.reload(), + ) + } + /> + + ), + }), + ]} + /> + ); +} diff --git a/src/pages/patrol/patrol_tasks/modals/Create.tsx b/src/pages/patrol/patrol_tasks/modals/Create.tsx new file mode 100644 index 0000000..cbf9e8f --- /dev/null +++ b/src/pages/patrol/patrol_tasks/modals/Create.tsx @@ -0,0 +1,125 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyFormItems, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { HouseWorkOrdersLevelEnum } from '@/gen/Enums'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; +import dayjs from 'dayjs'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`添加临时任务`} + layout="horizontal" + labelCol={{ span: 4 }} + wrapperCol={{ span: 20 }} + labelAlign="left" + width="600px" + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + trigger={} + onFinish={async (values) => + Apis.Patrol.PatrolTasks.Store({ + ...values, + }) + .then(() => { + props.reload?.(); + message.success('添加成功'); + return true; + }) + .catch(() => false) + } + columns={[ + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + { + valueType: 'dependency', + name: ['asset_projects_id'], + columns: ({ asset_projects_id }) => { + return asset_projects_id + ? [ + Selects?.PatrolRoutesSelect({ + title: '选择路线', + key: 'patrol_routes_id', + params: { + asset_projects_id: asset_projects_id, + }, + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + }), + ] + : [ + Selects?.PatrolRoutesSelect({ + title: '选择路线', + key: 'patrol_routes_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + fieldProps: { disabled: true }, + }), + ]; + }, + }, + { + title: '开始时间', + key: 'start_time', + valueType: 'dateTime', + colProps: { span: 24 }, + fieldProps: { + style: { width: '100%' }, + placeholder: '请设置开始时间', + disabledDate: (current: any) => { + // 只能选择当天及之后的时间 + return current && current < dayjs().startOf('day'); + }, + }, + formItemProps: { + ...rulesHelper.text, + }, + }, + { + title: '结束时间', + key: 'end_time', + valueType: 'dateTime', + colProps: { span: 24 }, + fieldProps: { + style: { width: '100%' }, + placeholder: '请设置结束日期', + disabledDate: (current: any) => { + //选择时间必须在开始时间之后,且为同一天 + return ( + current && current < dayjs(form.getFieldValue('start_time')) + ); + }, + }, + formItemProps: { + ...rulesHelper.text, + }, + }, + MyFormItems.EnumRadio({ + key: 'level', + title: '任务等级', + colProps: { span: 24 }, + valueEnum: HouseWorkOrdersLevelEnum, + required: true, + }), + ]} + /> + ); +} diff --git a/src/pages/patrol/patrol_tasks/modals/PatrolOrderAssign.tsx b/src/pages/patrol/patrol_tasks/modals/PatrolOrderAssign.tsx new file mode 100644 index 0000000..6bc393d --- /dev/null +++ b/src/pages/patrol/patrol_tasks/modals/PatrolOrderAssign.tsx @@ -0,0 +1,78 @@ +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'; + +const JudgmentEnum = { + Yes: { text: '有效工单', color: '#ff0000', value: 'Yes' }, + No: { text: '无效工单', color: '#00ff00', value: 'No' }, +}; + +type FormDataType = ApiTypes.WorkOrder.HouseWorkOrders.Assign & { + attachments?: any[]; + judgment?: string; +}; + +export default function WorkOrderAssign( + props: MyBetaModalFormProps & { item: any }, +) { + const [form] = Form.useForm(); + return ( + + {...MyModalFormProps.props} + title={`指派工单`} + wrapperCol={{ span: 19 }} + width="500px" + layout="horizontal" + labelCol={{ span: 5 }} + trigger={ + + } + key={new Date().getTime()} + form={form} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + onFinish={async (values: any) => { + return Apis.WorkOrder.HouseWorkOrders.Assign({ + ...values, + id: props.item.house_work_orders_id, + predict_complete_at: props.item.end_time, + level: props.item.level, + }) + .then(() => { + props.reload?.(); + message.success('指派工单成功'); + return true; + }) + .catch(() => false); + }} + columns={[ + Selects?.Employees({ + title: '选择处理人', + key: 'assign_employees_id', + colProps: { span: 24 }, + formItemProps: { ...rulesHelper.text }, + required: true, + }), + { + title: '备注', + key: 'assign_remark', + valueType: 'textarea', + colProps: { span: 24 }, + fieldProps: { + style: { width: '100%' }, + }, + }, + ]} + /> + ); +} diff --git a/src/pages/patrol/patrol_tasks/modals/PatrolOrderShow.tsx b/src/pages/patrol/patrol_tasks/modals/PatrolOrderShow.tsx new file mode 100644 index 0000000..6a1e9f5 --- /dev/null +++ b/src/pages/patrol/patrol_tasks/modals/PatrolOrderShow.tsx @@ -0,0 +1,182 @@ +import { MyButtons, MyProTableProps } from '@/common'; +import { Apis } from '@/gen/Apis'; +import { + PatrolTaskLocationsStatusEnum, + PatrolTasksStatusEnum, +} from '@/gen/Enums'; +import { ProDescriptions, ProTable } from '@ant-design/pro-components'; +import { Divider, Image, Modal, Space } from 'antd'; +import { useState } from 'react'; +import PatrolOrderAssign from './PatrolOrderAssign'; + +interface PatrolOrderShowProps { + item: any; + title?: string; + reload?: () => void; +} + +export default function PatrolOrderShow({ + item, + title = '巡更详情', + reload, +}: PatrolOrderShowProps) { + const [open, setOpen] = useState(false); + const [data, setData] = useState(null); + + const handleOpen = async () => { + try { + const res = await Apis.Patrol.PatrolTasks.Show({ id: item.id }); + setData(res.data); + setOpen(true); + } catch (error) { + console.error('获取详情失败:', error); + } + }; + + return ( + <> + + setOpen(false)} + footer={null} + width={800} + > + {data && ( + <> + { + const assigneeInfo = record?.house_work_order + ?.assign_employee?.name + ? `${ + record.house_work_order.assign_employee.name || '' + }-${ + record.house_work_order.assign_employee.phone || '' + }` + : '未分配'; + return ( + + {assigneeInfo} + + + ); + }, + }, + { + title: '开始时间', + dataIndex: 'start_time', + }, + { + title: '结束时间', + dataIndex: 'end_time', + }, + { + title: '创建时间', + dataIndex: 'created_at', + valueType: 'dateTime', + }, + { + title: '更新时间', + dataIndex: 'updated_at', + valueType: 'dateTime', + }, + { + title: '完成时间', + dataIndex: 'complete_time', + }, + ]} + /> + + + record?.id_card || index} + size="small" + columns={[ + { + title: '处理人', + dataIndex: 'name', + }, + { + title: '点位名称', + dataIndex: ['patrol_location_json', 'name'], + }, + { + title: '任务状态', + dataIndex: 'status', + valueEnum: PatrolTaskLocationsStatusEnum, + }, + { + title: '完成时间', + dataIndex: 'updated_at', + render: (_, item) => { + return item?.status === + PatrolTaskLocationsStatusEnum.Completed.value + ? item?.updated_at + : '-'; + }, + }, + { + title: '现场照片', + render: (_, item) => { + return ( + + {item?.images?.[0] && ( + + )} + + ); + }, + }, + ]} + /> + + )} + + + ); +} diff --git a/src/pages/system/sys_roles/components/AdminRole/index.tsx b/src/pages/system/sys_roles/components/AdminRole/index.tsx new file mode 100644 index 0000000..06101dc --- /dev/null +++ b/src/pages/system/sys_roles/components/AdminRole/index.tsx @@ -0,0 +1,229 @@ +import { MyButtons, MyProTableProps, useCurrentPermissions } from '@/common'; +import { flattenToMultiLevelFormatWithRowSpanAdvancedNew } from '@/common/utils/flattenIterative'; +import { Apis } from '@/gen/Apis'; +import { ProCard, ProTable } from '@ant-design/pro-components'; +import { Checkbox, message, Space, Tabs } from 'antd'; +import { useEffect, useState } from 'react'; +import Create from '../../modals/Create'; +interface SelectedBuilding { + id: number; + name: string; +} +export default function Index({ title = '角色' }) { + const getCurrentPermissions = useCurrentPermissions(); + const [selectedBuilding, setSelectedBuilding] = + useState(null); + const [selectedPermissionsIds, setSelectedPermissionsIds] = useState( + [], + ); + const [dataSource, setDataSource] = useState([]); + const [dataTabsSource, setDataTabsSource] = useState([]); + const [tabsKey, setTabsKey] = useState(''); + const getSysPermissions = () => { + Apis.Permission.Roles.PermissionTree().then((res) => { + setDataSource( + flattenToMultiLevelFormatWithRowSpanAdvancedNew( + res?.data[0]?.children || [], + ), + ); + console.log(res, 'res'); + }); + }; + + const onSave = () => { + if (selectedPermissionsIds?.length && selectedBuilding?.id) { + Apis.Permission.Roles.SetPermissions({ + permissions_ids: selectedPermissionsIds, + id: selectedBuilding?.id || 0, + }).then(() => { + message.success('保存成功'); + }); + } else { + message.error('请选择角色和勾选权限!'); + } + }; + + const getPermissions = (id: any) => { + setTabsKey(id); + // 更新选中的角色信息 + const selectedRole = dataTabsSource.find((item: any) => item.id === id); + if (selectedRole) { + setSelectedBuilding({ + id: selectedRole.id, + name: selectedRole.name, + }); + } + Apis.Permission.Roles.GetPermissions({ + id: id ?? 0, + }).then((res) => { + setSelectedPermissionsIds(res?.data?.permissions_ids || []); + }); + }; + + const getSysRoles = () => { + Apis.Permission.Roles.List({ guard_name: 'Company' }).then((res) => { + setDataTabsSource(res?.data || []); + if (res?.data?.length) { + const firstRole = res?.data[0]; + getPermissions(firstRole?.id || 0); + // 初始化选中第一个角色 + setSelectedBuilding({ + id: firstRole?.id, + name: firstRole?.name, + }); + } + console.log(res, 'res'); + }); + }; + + const onSelect = () => { + //删除角色 + Apis.Permission.Roles.Delete({ + id: tabsKey, + }).then(() => { + getSysRoles(); + message.success('删除成功'); + }); + }; + + useEffect(() => { + getSysRoles(); + getSysPermissions(); + }, []); + + let toolBarRender = () => { + return getCurrentPermissions({ + add: getSysRoles()} title={title} />, + delete: ( + onSelect()} + // 如果当前选中角色是管理员,则禁用删除按钮 + disabled={selectedBuilding?.name === '管理员'} + /> + ), + save: ( + onSave()} + /> + ), + }); + }; + + return ( + {toolBarRender()}} + headerBordered + > +
+
+ ({ + label: item?.name, + key: item?.id, + }))} + activeKey={tabsKey} + onChange={(key: any) => { + getPermissions(key); + console.log(key, 'key'); + }} + /> +
+ +
+ { + setSelectedPermissionsIds(e); + console.log(e, 'e'); + }} + > + ( + // { + // setGuardName(e as string); + // }} + // value={guardName} + // /> + // )} + style={{ + width: '100%', + maxHeight: 'calc(100vh - 280px)', // 设置最大高度,可根据实际需求调整 + overflowY: 'auto', // 启用垂直滚动 + }} + dataSource={dataSource} + options={false} + size="small" + columns={[ + { + title: '目录', + dataIndex: 'name', + key: 'name', + width: '120px', + render: (_, item: any) => { + return {item?.name}; + }, + onCell: (res, index?: number) => { + const rowSpan = res.row_spans?.rowSpan; + const firstIndex = res.row_spans?.firstIndex; + if (index === firstIndex && rowSpan > 0) { + return { rowSpan }; + } + return { rowSpan: 0 }; + }, + }, + { + title: '页面', + dataIndex: 'name2', + key: 'name2', + width: '160px', + render: (_, item: any) => { + return item?.name2 ? ( + {item?.name2} + ) : null; + }, + }, + { + title: '页签/按钮', + width: '800px', + render: (_, item: any) => { + if (item?.buttonList?.length) { + return item?.buttonList?.map( + (res: any, index: number) => { + return res?.name ? ( + + {res?.name} + + ) : null; + }, + ); + } + }, + }, + ]} + /> + +
+
+
+ ); +} diff --git a/src/pages/system/sys_roles/components/EmployeeRole/index.tsx b/src/pages/system/sys_roles/components/EmployeeRole/index.tsx new file mode 100644 index 0000000..7c08a6b --- /dev/null +++ b/src/pages/system/sys_roles/components/EmployeeRole/index.tsx @@ -0,0 +1,227 @@ +import { MyButtons, MyProTableProps, useCurrentPermissions } from '@/common'; +import { flattenToMultiLevelFormatWithRowSpanAdvancedNew } from '@/common/utils/flattenIterative'; +import { Apis } from '@/gen/Apis'; +import { ProCard, ProTable } from '@ant-design/pro-components'; +import { Checkbox, message, Space, Tabs } from 'antd'; +import { useEffect, useState } from 'react'; +import Create from './modals/Create'; +interface SelectedBuilding { + id: number; + name: string; +} +export default function Index({ title = '角色' }) { + const getCurrentPermissions = useCurrentPermissions(); + const [selectedBuilding, setSelectedBuilding] = + useState(null); + const [selectedPermissionsIds, setSelectedPermissionsIds] = useState( + [], + ); + const [dataSource, setDataSource] = useState([]); + const [dataTabsSource, setDataTabsSource] = useState([]); + const [tabsKey, setTabsKey] = useState(''); + const getSysPermissions = () => { + Apis.Company.EmployeeRoles.PermissionTree().then((res) => { + setDataSource( + flattenToMultiLevelFormatWithRowSpanAdvancedNew( + res?.data[0]?.children || [], + ), + ); + console.log(res, 'res'); + }); + }; + + const onSave = () => { + if (selectedPermissionsIds?.length && selectedBuilding?.id) { + Apis.Company.EmployeeRoles.SetPermissions({ + permissions_ids: selectedPermissionsIds, + id: selectedBuilding?.id || 0, + }).then(() => { + message.success('保存成功'); + }); + } else { + message.error('请选择角色和勾选权限!'); + } + }; + + const getPermissions = (id: any) => { + setTabsKey(id); + // 更新选中的角色信息 + const selectedRole = dataTabsSource.find((item: any) => item.id === id); + if (selectedRole) { + setSelectedBuilding({ + id: selectedRole.id, + name: selectedRole.name, + }); + } + Apis.Company.EmployeeRoles.GetPermissions({ + id: id ?? 0, + }).then((res) => { + setSelectedPermissionsIds(res?.data?.permissions_ids || []); + }); + }; + + const getSysRoles = () => { + Apis.Company.EmployeeRoles.List().then((res) => { + setDataTabsSource(res?.data || []); + if (res?.data?.length) { + const firstRole = res?.data[0]; + getPermissions(firstRole?.id || 0); + // 初始化选中第一个角色 + setSelectedBuilding({ + id: firstRole?.id, + name: firstRole?.name, + }); + } + console.log(res, 'res'); + }); + }; + + const onSelect = () => { + //删除角色 + Apis.Company.EmployeeRoles.Delete({ + id: tabsKey, + }).then(() => { + getSysRoles(); + message.success('删除成功'); + }); + }; + + useEffect(() => { + getSysRoles(); + getSysPermissions(); + }, []); + + let toolBarRender = () => { + return getCurrentPermissions({ + add: getSysRoles()} title={title} />, + delete: ( + onSelect()} + /> + ), + save: ( + onSave()} + /> + ), + }); + }; + + return ( + {toolBarRender()}} + > +
+
+ ({ + label: item?.name, + key: item?.id, + }))} + activeKey={tabsKey} + onChange={(key: any) => { + getPermissions(key); + console.log(key, 'key'); + }} + /> +
+ +
+ { + setSelectedPermissionsIds(e); + console.log(e, 'e'); + }} + > + ( + // { + // setGuardName(e as string); + // }} + // value={guardName} + // /> + // )} + style={{ + width: '100%', + maxHeight: 'calc(100vh - 280px)', // 设置最大高度,可根据实际需求调整 + overflowY: 'auto', // 启用垂直滚动 + }} + dataSource={dataSource} + options={false} + size="small" + columns={[ + { + title: '目录', + dataIndex: 'name', + key: 'name', + width: '120px', + render: (_, item: any) => { + return {item?.name}; + }, + onCell: (res, index?: number) => { + const rowSpan = res.row_spans?.rowSpan; + const firstIndex = res.row_spans?.firstIndex; + if (index === firstIndex && rowSpan > 0) { + return { rowSpan }; + } + return { rowSpan: 0 }; + }, + }, + { + title: '页面', + dataIndex: 'name2', + key: 'name2', + width: '160px', + render: (_, item: any) => { + return item?.name2 ? ( + {item?.name2} + ) : null; + }, + }, + { + title: '页签/按钮', + width: '800px', + render: (_, item: any) => { + if (item?.buttonList?.length) { + return item?.buttonList?.map( + (res: any, index: number) => { + return res?.name ? ( + + {res?.name} + + ) : null; + }, + ); + } + }, + }, + ]} + /> + +
+
+
+ ); +} diff --git a/src/pages/system/sys_roles/components/EmployeeRole/modals/Create.tsx b/src/pages/system/sys_roles/components/EmployeeRole/modals/Create.tsx new file mode 100644 index 0000000..04ed21c --- /dev/null +++ b/src/pages/system/sys_roles/components/EmployeeRole/modals/Create.tsx @@ -0,0 +1,47 @@ +import { + MyBetaModalFormProps, + MyButtons, + MyModalFormProps, + rulesHelper, +} from '@/common'; +import { Apis } from '@/gen/Apis'; +import { BetaSchemaForm } from '@ant-design/pro-components'; +import { Form, message } from 'antd'; + +export default function Create(props: MyBetaModalFormProps) { + const [form] = Form.useForm(); + + return ( + + {...MyModalFormProps.props} + form={form} + title={`添加${props.title}`} + wrapperCol={{ span: 24 }} + key={new Date().getTime()} + width="420px" + trigger={} + onOpenChange={(open: any) => { + if (open) { + form.resetFields(); // 清空表单数据 + } + }} + onFinish={async (values) => + Apis.Company.EmployeeRoles.Store(values) + .then(() => { + props.reload?.(); + message.success(props.title + '成功'); + return true; + }) + .catch(() => false) + } + columns={[ + { + key: 'name', + title: '角色名称', + formItemProps: { ...rulesHelper.text }, + }, + // MyFormItems.ColorPicker(), + ]} + /> + ); +} diff --git a/src/pages/system/sys_roles/index.tsx b/src/pages/system/sys_roles/index.tsx index d73017d..29990e7 100644 --- a/src/pages/system/sys_roles/index.tsx +++ b/src/pages/system/sys_roles/index.tsx @@ -1,128 +1,20 @@ -import { - MyButtons, - MyPageContainer, - MyProTableProps, - useCurrentPermissions, -} from '@/common'; -import { flattenToMultiLevelFormatWithRowSpanAdvancedNew } from '@/common/utils/flattenIterative'; -import { Apis } from '@/gen/Apis'; -import { ProCard, ProTable } from '@ant-design/pro-components'; -import { Checkbox, message, Space, Tabs } from 'antd'; -import { useEffect, useState } from 'react'; -import Create from './modals/Create'; -interface SelectedBuilding { - id: number; - name: string; -} +import { MyPageContainer } from '@/common'; +import { Tabs, TabsProps } from 'antd'; +import AdminRole from './components/AdminRole'; +import EmployeeRole from './components/EmployeeRole'; export default function Index({ title = '角色' }) { - const getCurrentPermissions = useCurrentPermissions(); - const [selectedBuilding, setSelectedBuilding] = - useState(null); - const [selectedPermissionsIds, setSelectedPermissionsIds] = useState( - [], - ); - const [dataSource, setDataSource] = useState([]); - const [dataTabsSource, setDataTabsSource] = useState([]); - const [tabsKey, setTabsKey] = useState(''); - const getSysPermissions = () => { - Apis.Permission.Roles.PermissionTree().then((res) => { - setDataSource( - flattenToMultiLevelFormatWithRowSpanAdvancedNew( - res?.data[0]?.children || [], - ), - ); - console.log(res, 'res'); - }); - }; - - const onSave = () => { - if (selectedPermissionsIds?.length && selectedBuilding?.id) { - Apis.Permission.Roles.SetPermissions({ - permissions_ids: selectedPermissionsIds, - id: selectedBuilding?.id || 0, - }).then(() => { - message.success('保存成功'); - }); - } else { - message.error('请选择角色和勾选权限!'); - } - }; - - const getPermissions = (id: any) => { - setTabsKey(id); - // 更新选中的角色信息 - const selectedRole = dataTabsSource.find((item: any) => item.id === id); - if (selectedRole) { - setSelectedBuilding({ - id: selectedRole.id, - name: selectedRole.name, - }); - } - Apis.Permission.Roles.GetPermissions({ - id: id ?? 0, - }).then((res) => { - setSelectedPermissionsIds(res?.data?.permissions_ids || []); - }); - }; - - const getSysRoles = () => { - Apis.Permission.Roles.List().then((res) => { - setDataTabsSource(res?.data || []); - if (res?.data?.length) { - const firstRole = res?.data[0]; - getPermissions(firstRole?.id || 0); - // 初始化选中第一个角色 - setSelectedBuilding({ - id: firstRole?.id, - name: firstRole?.name, - }); - } - console.log(res, 'res'); - }); - }; - - const onSelect = () => { - //删除角色 - Apis.Permission.Roles.Delete({ - id: tabsKey, - }).then(() => { - getSysRoles(); - message.success('删除成功'); - }); - }; - useEffect(() => { - getSysRoles(); - getSysPermissions(); - }, []); - - let toolBarRender = () => { - return getCurrentPermissions({ - add: getSysRoles()} title={title} />, - delete: ( - onSelect()} - // 如果当前选中角色是管理员,则禁用删除按钮 - disabled={selectedBuilding?.name === '管理员'} - /> - ), - save: ( - onSave()} - /> - ), - }); - }; + const items: TabsProps['items'] = [ + { + key: '1', + label: '后台角色', + children: , + }, + { + key: '2', + label: '员工角色', + children: , + }, + ]; return ( - {toolBarRender()}} - > -
-
- ({ - label: item?.name, - key: item?.id, - }))} - onChange={(key: any) => { - getPermissions(key); - console.log(key, 'key'); - }} - /> -
- -
- { - setSelectedPermissionsIds(e); - console.log(e, 'e'); - }} - > - { - return ( - {item?.name} - ); - }, - onCell: (res, index?: number) => { - const rowSpan = res.row_spans?.rowSpan; - const firstIndex = res.row_spans?.firstIndex; - if (index === firstIndex && rowSpan > 0) { - return { rowSpan }; - } - return { rowSpan: 0 }; - }, - }, - { - title: '页面', - dataIndex: 'name2', - key: 'name2', - width: '160px', - render: (_, item: any) => { - return item?.name2 ? ( - {item?.name2} - ) : null; - }, - }, - { - title: '页签/按钮', - width: '800px', - render: (_, item: any) => { - if (item?.buttonList?.length) { - return item?.buttonList?.map( - (res: any, index: number) => { - return res?.name ? ( - - {res?.name} - - ) : null; - }, - ); - } - }, - }, - ]} - /> - -
-
-
+
); } diff --git a/src/pages/work_order/patrol_work/index.tsx b/src/pages/work_order/patrol_work/index.tsx new file mode 100644 index 0000000..1e15d32 --- /dev/null +++ b/src/pages/work_order/patrol_work/index.tsx @@ -0,0 +1,245 @@ +import { + MyButtons, + MyColumns, + MyProTableProps, + useCurrentPermissions, +} from '@/common'; +import { Selects } from '@/components/Select'; +import { Apis } from '@/gen/Apis'; +import { + HouseWorkOrdersAssignStatusEnum, + HouseWorkOrdersLevelEnum, + HouseWorkOrdersLocationEnum, + HouseWorkOrdersTypeEnum, +} from '@/gen/Enums'; +import { ProTable } from '@ant-design/pro-components'; +import { Space } from 'antd'; +import WorkOrderAssign from '../list/modals/WorkOrderAssign'; +import WorkOrderCreate from '../list/modals/WorkOrderCreate'; +import WorkOrderShow from '../list/modals/WorkOrderShow'; +import WorkOrderUpdate from '../list/modals/WorkOrderUpdate'; + +export const RenovationWorkOrdersStatusEnum = { + Pending: { text: '待处理', color: '#FFA500', value: 'Pending' }, + Processing: { text: '处理中', color: '#1E90FF', value: 'Processing' }, + Completed: { text: '已完成', color: '#28A745', value: 'Completed' }, + Closed: { text: '已关闭', color: '#6C757D', value: 'Closed' }, +}; + +export default function PatrolWorkIndex({ title = '巡更工单' }) { + const getCurrentPermissions = useCurrentPermissions(); + + let tableRender = (item: any, action: any) => { + return getCurrentPermissions( + { + show: ( + + ), + assign: ( + <> + {item.assign_status === 'Unassigned' && + item.type !== 'SecurityInspection' && ( + + )} + + ), + update: ( + <> + {item.status === 'Pending' && ( + + )} + + ), + delete: ( + + Apis.WorkOrder.HouseWorkOrders.SoftDelete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + ), + }, + 'MyDecorationWorkorder', + ); + }; + + const WorkTypeEnum: any = () => { + let obj: any = JSON.parse(JSON.stringify(HouseWorkOrdersTypeEnum)); + delete obj.Repair; + delete obj.Incident; + delete obj.Complaint; + delete obj.RenovationInspection; + delete obj.RenovationAcceptance; + delete obj.Emergency; + delete obj.EquipmentMaintenance; + delete obj.QualityCheck; + return obj; + }; + + return ( + > + {...MyProTableProps.props} + headerTitle={title} + request={async (params, sort) => { + return MyProTableProps.request( + { + ...params, + type: [HouseWorkOrdersTypeEnum.SecurityInspection.value], + }, + sort, + Apis.WorkOrder.HouseWorkOrders.List, + ); + }} + toolBarRender={(action) => [ + , + ]} + columns={[ + MyColumns.ID({ search: false }), + Selects?.AssetProjects({ + title: '选择项目', + key: 'asset_projects_id', + hidden: true, + }), + MyColumns.EnumTag({ + title: '处理状态', + dataIndex: 'status', + valueEnum: RenovationWorkOrdersStatusEnum, + }), + { + title: '项目名称', + dataIndex: 'project_name', + hidden: true, + }, + MyColumns.EnumTag({ + title: '分配状态', + dataIndex: 'assign_status', + valueEnum: HouseWorkOrdersAssignStatusEnum, + }), + MyColumns.EnumTag({ + title: '工单类型', + dataIndex: 'type', + valueEnum: HouseWorkOrdersTypeEnum, + search: false, + }), + MyColumns.EnumTag({ + title: '报修位置', + dataIndex: 'location', + valueEnum: HouseWorkOrdersLocationEnum, + search: false, + }), + { + title: '位置信息', + dataIndex: ['asset_house', 'full_name'], + render: (_, record) => { + return ( + + {record?.asset_house?.full_name + ? record?.asset_house?.full_name + : record?.asset_project?.name} + + ); + }, + search: { + transform: (value) => { + return { house_name: value }; + }, + }, + }, + { + title: '工单描述', + dataIndex: 'content', + search: false, + width: 120, // 关键:固定列宽(若父容器过窄,可设 minWidth: 200 优先保证列宽) + render: (text) => ( +
+ {text} +
+ ), + }, + MyColumns.EnumTag({ + title: '优先级', + dataIndex: 'level', + valueEnum: HouseWorkOrdersLevelEnum, + search: false, + }), + + { + title: '处理人', + dataIndex: ['assign_employee', 'name'], + search: false, + render: (_, record) => { + return `${record?.assign_employee?.name || ''}-${ + record?.assign_employee?.phone || '' + }`; + }, + }, + MyColumns.CreatedAt(), + MyColumns.Option({ + render: (_, item: any, index, action) => ( + + + + {item.assign_status === 'Unassigned' && + item.type !== 'SecurityInspection' && ( + + )} + + {item.status === 'Pending' && ( + + )} + + Apis.WorkOrder.HouseWorkOrders.SoftDelete({ + id: item.id, + }).then(() => action?.reload()) + } + /> + + ), + }), + ]} + /> + ); +}