develop #22
@ -1,227 +1,60 @@
|
|||||||
import { HomeOutlined } from '@ant-design/icons';
|
import { HomeOutlined, LeftOutlined } from '@ant-design/icons';
|
||||||
import { PageContainer, PageContainerProps } from '@ant-design/pro-components';
|
import { PageContainer, PageContainerProps } from '@ant-design/pro-components';
|
||||||
import { useLocation, useNavigate } from '@umijs/max';
|
import { useLocation, useNavigate } from '@umijs/max';
|
||||||
import { Breadcrumb, Space } from 'antd';
|
import { Breadcrumb, Button, Space, Tooltip } from 'antd';
|
||||||
import { useEffect, useState } from 'react';
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
// import './MyPageContainer.scss';
|
|
||||||
|
|
||||||
export interface TabItem {
|
|
||||||
key: string;
|
|
||||||
label: string;
|
|
||||||
path: string;
|
|
||||||
closable?: boolean;
|
|
||||||
}
|
|
||||||
interface BreadcrumbItem {
|
interface BreadcrumbItem {
|
||||||
title: string;
|
title: string;
|
||||||
path: string;
|
path: string;
|
||||||
onClick?: () => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MyPageContainerProps extends PageContainerProps {
|
export interface MyPageContainerProps extends PageContainerProps {
|
||||||
|
/* 多标签页功能已废弃,此参数不再生效,保留以避免破坏现有调用方 */
|
||||||
enableTabs?: boolean;
|
enableTabs?: boolean;
|
||||||
|
/* 多标签页功能已废弃,此参数不再生效,保留以避免破坏现有调用方 */
|
||||||
tabKey?: string;
|
tabKey?: string;
|
||||||
|
/* 多标签页功能已废弃,此参数不再生效,保留以避免破坏现有调用方 */
|
||||||
tabLabel?: string;
|
tabLabel?: string;
|
||||||
|
/* 多标签页功能已废弃,此参数不再生效,保留以避免破坏现有调用方 */
|
||||||
onTabChange?: (activeKey: string) => void;
|
onTabChange?: (activeKey: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 注释掉标签页管理相关代码,不再使用
|
|
||||||
// // 全局标签页状态管理
|
|
||||||
// class TabsManager {
|
|
||||||
// private tabs: TabItem[] = [];
|
|
||||||
// private activeKey: string = '';
|
|
||||||
// private listeners: Set<() => void> = new Set();
|
|
||||||
|
|
||||||
// subscribe(listener: () => void) {
|
|
||||||
// this.listeners.add(listener);
|
|
||||||
// return () => this.listeners.delete(listener);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// private notify() {
|
|
||||||
// this.listeners.forEach((listener) => listener());
|
|
||||||
// }
|
|
||||||
|
|
||||||
// getTabs() {
|
|
||||||
// return this.tabs;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// getActiveKey() {
|
|
||||||
// return this.activeKey;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// addTab(tab: TabItem) {
|
|
||||||
// const existingIndex = this.tabs.findIndex((t) => t.key === tab.key);
|
|
||||||
// if (existingIndex === -1) {
|
|
||||||
// // 如果是新标签页,插入到当前激活标签页的右边
|
|
||||||
// const currentActiveIndex = this.tabs.findIndex(
|
|
||||||
// (t) => t.key === this.activeKey,
|
|
||||||
// );
|
|
||||||
// if (currentActiveIndex !== -1) {
|
|
||||||
// // 在当前激活标签页的右边插入新标签页
|
|
||||||
// this.tabs.splice(currentActiveIndex + 1, 0, tab);
|
|
||||||
// } else {
|
|
||||||
// // 如果没有当前激活标签页,添加到末尾
|
|
||||||
// this.tabs.push(tab);
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// // 如果标签页已存在,更新其信息
|
|
||||||
// this.tabs[existingIndex] = { ...this.tabs[existingIndex], ...tab };
|
|
||||||
// }
|
|
||||||
// this.activeKey = tab.key;
|
|
||||||
// this.notify();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// addTabNext(tab: TabItem) {
|
|
||||||
// const existingIndex = this.tabs.findIndex((t) => t.key === tab.key);
|
|
||||||
// if (existingIndex === -1) {
|
|
||||||
// // 强制在当前激活标签页的右边插入新标签页
|
|
||||||
// const currentActiveIndex = this.tabs.findIndex(
|
|
||||||
// (t) => t.key === this.activeKey,
|
|
||||||
// );
|
|
||||||
// if (currentActiveIndex !== -1) {
|
|
||||||
// this.tabs.splice(currentActiveIndex + 1, 0, tab);
|
|
||||||
// } else {
|
|
||||||
// this.tabs.push(tab);
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// // 如果标签页已存在,移动到当前激活标签页的右边
|
|
||||||
// const existingTab = this.tabs[existingIndex];
|
|
||||||
// this.tabs.splice(existingIndex, 1); // 先移除原位置的标签页
|
|
||||||
// const currentActiveIndex = this.tabs.findIndex(
|
|
||||||
// (t) => t.key === this.activeKey,
|
|
||||||
// );
|
|
||||||
// if (currentActiveIndex !== -1) {
|
|
||||||
// this.tabs.splice(currentActiveIndex + 1, 0, { ...existingTab, ...tab });
|
|
||||||
// } else {
|
|
||||||
// this.tabs.push({ ...existingTab, ...tab });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// this.activeKey = tab.key;
|
|
||||||
// this.notify();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// removeTab(targetKey: string) {
|
|
||||||
// const targetIndex = this.tabs.findIndex((tab) => tab.key === targetKey);
|
|
||||||
// if (targetIndex === -1) return;
|
|
||||||
|
|
||||||
// const newTabs = this.tabs.filter((tab) => tab.key !== targetKey);
|
|
||||||
|
|
||||||
// if (newTabs.length === 0) {
|
|
||||||
// this.tabs = [];
|
|
||||||
// this.activeKey = '';
|
|
||||||
// history.push('/');
|
|
||||||
// } else {
|
|
||||||
// this.tabs = newTabs;
|
|
||||||
// if (this.activeKey === targetKey) {
|
|
||||||
// // 如果关闭的是当前激活的标签,激活相邻的标签
|
|
||||||
// const newActiveKey =
|
|
||||||
// targetIndex > 0 ? newTabs[targetIndex - 1].key : newTabs[0].key;
|
|
||||||
// this.activeKey = newActiveKey;
|
|
||||||
// const targetTab = newTabs.find((tab) => tab.key === newActiveKey);
|
|
||||||
// if (targetTab) {
|
|
||||||
// history.push(targetTab.path);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// this.notify();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// setActiveKey(key: string) {
|
|
||||||
// this.activeKey = key;
|
|
||||||
// const targetTab = this.tabs.find((tab) => tab.key === key);
|
|
||||||
// if (targetTab) {
|
|
||||||
// history.push(targetTab.path);
|
|
||||||
// }
|
|
||||||
// this.notify();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// closeOtherTabs(currentKey: string) {
|
|
||||||
// const currentTab = this.tabs.find((tab) => tab.key === currentKey);
|
|
||||||
// if (currentTab) {
|
|
||||||
// this.tabs = [currentTab];
|
|
||||||
// this.activeKey = currentKey;
|
|
||||||
// this.notify();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// closeLeftTabs(currentKey: string) {
|
|
||||||
// const currentIndex = this.tabs.findIndex((tab) => tab.key === currentKey);
|
|
||||||
// if (currentIndex > 0) {
|
|
||||||
// this.tabs = this.tabs.slice(currentIndex);
|
|
||||||
// this.notify();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// closeRightTabs(currentKey: string) {
|
|
||||||
// const currentIndex = this.tabs.findIndex((tab) => tab.key === currentKey);
|
|
||||||
// if (currentIndex !== -1) {
|
|
||||||
// this.tabs = this.tabs.slice(0, currentIndex + 1);
|
|
||||||
// this.notify();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// refreshTab(key: string) {
|
|
||||||
// // 通过路由跳转的方式刷新当前标签页,避免整个页面刷新导致标签页状态丢失
|
|
||||||
// const targetTab = this.tabs.find((tab) => tab.key === key);
|
|
||||||
// if (targetTab) {
|
|
||||||
// const originalPath = targetTab.path;
|
|
||||||
// // 移除可能存在的刷新参数,确保获取干净的原始路径
|
|
||||||
// const cleanPath = originalPath
|
|
||||||
// .replace(/[?&]_refresh=\d+/g, '')
|
|
||||||
// .replace(/\?$/, '');
|
|
||||||
|
|
||||||
// // 添加时间戳参数强制刷新
|
|
||||||
// const refreshPath = cleanPath.includes('?')
|
|
||||||
// ? `${cleanPath}&_refresh=${Date.now()}`
|
|
||||||
// : `${cleanPath}?_refresh=${Date.now()}`;
|
|
||||||
|
|
||||||
// // 先更新为带刷新参数的路径并跳转
|
|
||||||
// targetTab.path = refreshPath;
|
|
||||||
// this.setActiveKey(key);
|
|
||||||
|
|
||||||
// // 延迟恢复原始路径,确保路由跳转完成
|
|
||||||
// setTimeout(() => {
|
|
||||||
// // 恢复为干净的原始路径
|
|
||||||
// targetTab.path = cleanPath;
|
|
||||||
// // 再次跳转到干净路径,移除URL中的刷新参数
|
|
||||||
// history.push(cleanPath);
|
|
||||||
// this.notify();
|
|
||||||
// }, 300);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // 全局标签页管理器实例
|
|
||||||
// const tabsManager = new TabsManager();
|
|
||||||
|
|
||||||
export function MyPageContainer({
|
export function MyPageContainer({
|
||||||
title,
|
title,
|
||||||
children,
|
children,
|
||||||
enableTabs = false, // 默认关闭多标签页功能
|
enableTabs: _enableTabs,
|
||||||
tabKey,
|
tabKey: _tabKey,
|
||||||
tabLabel,
|
tabLabel: _tabLabel,
|
||||||
onTabChange,
|
onTabChange: _onTabChange,
|
||||||
...rest
|
...rest
|
||||||
}: MyPageContainerProps) {
|
}: MyPageContainerProps) {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const location = useLocation(); // 使用useLocation钩子
|
const location = useLocation();
|
||||||
const [dataBre, setDataBre] = useState<any>(
|
const [dataBre, setDataBre] = useState<BreadcrumbItem[]>(
|
||||||
JSON.parse(sessionStorage.getItem('breadcrumbs') || '[]'),
|
JSON.parse(sessionStorage.getItem('breadcrumbs') || '[]'),
|
||||||
);
|
);
|
||||||
|
const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||||
|
|
||||||
// 简化的面包屑更新逻辑
|
const canGoBack = location.pathname !== '/';
|
||||||
const updateBreadcrumbs = () => {
|
|
||||||
|
const handleGoBack = useCallback(() => {
|
||||||
|
navigate(-1);
|
||||||
|
}, [navigate]);
|
||||||
|
|
||||||
|
const updateBreadcrumbs = useCallback(() => {
|
||||||
try {
|
try {
|
||||||
// 获取当前路径和标题
|
|
||||||
const currentPath = location.pathname + location.search;
|
const currentPath = location.pathname + location.search;
|
||||||
const currentTitle =
|
const currentTitle =
|
||||||
typeof title === 'string'
|
typeof title === 'string'
|
||||||
? title
|
? title
|
||||||
: String(title?.props?.children || '');
|
: String(
|
||||||
|
(title as { props?: { children?: unknown } })?.props?.children ??
|
||||||
|
'',
|
||||||
|
);
|
||||||
|
|
||||||
// 清空无效的面包屑数据(重置逻辑)
|
|
||||||
const newBreadcrumbs: BreadcrumbItem[] = [];
|
const newBreadcrumbs: BreadcrumbItem[] = [];
|
||||||
|
|
||||||
// 只添加当前页面的面包屑
|
|
||||||
if (currentPath && currentTitle) {
|
if (currentPath && currentTitle) {
|
||||||
newBreadcrumbs.push({
|
newBreadcrumbs.push({
|
||||||
title: currentTitle,
|
title: currentTitle,
|
||||||
@ -229,30 +62,31 @@ export function MyPageContainer({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新sessionStorage
|
|
||||||
try {
|
try {
|
||||||
sessionStorage.setItem('breadcrumbs', JSON.stringify(newBreadcrumbs));
|
sessionStorage.setItem('breadcrumbs', JSON.stringify(newBreadcrumbs));
|
||||||
} catch (storageError) {
|
} catch (storageError) {
|
||||||
console.error('存储到sessionStorage失败:', storageError);
|
console.error('存储到sessionStorage失败:', storageError);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新状态
|
|
||||||
setDataBre(newBreadcrumbs);
|
setDataBre(newBreadcrumbs);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('更新面包屑时出错:', error);
|
console.error('更新面包屑时出错:', error);
|
||||||
// 出错时重置面包屑
|
|
||||||
setDataBre([]);
|
setDataBre([]);
|
||||||
}
|
}
|
||||||
};
|
}, [location.pathname, location.search, title]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('title', title);
|
timeoutRef.current = setTimeout(() => {
|
||||||
setTimeout(() => {
|
|
||||||
updateBreadcrumbs();
|
updateBreadcrumbs();
|
||||||
}, 250);
|
}, 250);
|
||||||
}, [location.pathname, location.search, title]);
|
|
||||||
// 不再需要标签页相关的状态和逻辑
|
return () => {
|
||||||
// 直接返回简化版的PageContainer
|
if (timeoutRef.current) {
|
||||||
|
clearTimeout(timeoutRef.current);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}, [updateBreadcrumbs]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageContainer
|
<PageContainer
|
||||||
fixedHeader
|
fixedHeader
|
||||||
@ -260,15 +94,24 @@ export function MyPageContainer({
|
|||||||
breadcrumb: {},
|
breadcrumb: {},
|
||||||
title: (
|
title: (
|
||||||
<Space style={{ fontSize: '12px', cursor: 'pointer', color: '#999' }}>
|
<Space style={{ fontSize: '12px', cursor: 'pointer', color: '#999' }}>
|
||||||
|
{canGoBack && (
|
||||||
|
<Tooltip title="返回上级">
|
||||||
|
<Button
|
||||||
|
type="text"
|
||||||
|
size="small"
|
||||||
|
icon={<LeftOutlined />}
|
||||||
|
onClick={handleGoBack}
|
||||||
|
style={{ marginRight: 8, color: '#999' }}
|
||||||
|
/>
|
||||||
|
</Tooltip>
|
||||||
|
)}
|
||||||
<Breadcrumb
|
<Breadcrumb
|
||||||
items={[
|
items={[
|
||||||
{
|
{
|
||||||
title: <HomeOutlined />,
|
title: <HomeOutlined />,
|
||||||
onClick: () => {
|
onClick: () => navigate('/'),
|
||||||
navigate('/');
|
|
||||||
},
|
},
|
||||||
},
|
...dataBre.map((res) => ({
|
||||||
...dataBre?.map((res: any) => ({
|
|
||||||
title: res.title || '',
|
title: res.title || '',
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
navigate(res.path);
|
navigate(res.path);
|
||||||
@ -301,6 +144,3 @@ export function MyPageContainer({
|
|||||||
</PageContainer>
|
</PageContainer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 不再导出标签页管理器
|
|
||||||
// export { tabsManager };
|
|
||||||
|
|||||||
@ -8,8 +8,9 @@ import {
|
|||||||
import { Selects } from '@/components/Select';
|
import { Selects } from '@/components/Select';
|
||||||
import { Apis } from '@/gen/Apis';
|
import { Apis } from '@/gen/Apis';
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
import { ProTable } from '@ant-design/pro-components';
|
||||||
import { useNavigate } from '@umijs/max';
|
|
||||||
import { Space, Tooltip } from 'antd';
|
import { Space, Tooltip } from 'antd';
|
||||||
|
import Create from './modals/Create';
|
||||||
|
import Update from './modals/Update';
|
||||||
|
|
||||||
export default function Index({
|
export default function Index({
|
||||||
title = '班次管理',
|
title = '班次管理',
|
||||||
@ -18,8 +19,6 @@ export default function Index({
|
|||||||
title?: string;
|
title?: string;
|
||||||
noPermission?: boolean;
|
noPermission?: boolean;
|
||||||
}) {
|
}) {
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ProTable
|
<ProTable
|
||||||
{...MyProTableProps.props}
|
{...MyProTableProps.props}
|
||||||
@ -31,17 +30,13 @@ export default function Index({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
headerTitle={title}
|
headerTitle={title}
|
||||||
toolBarRender={() =>
|
toolBarRender={(action) =>
|
||||||
noPermission
|
noPermission
|
||||||
? [
|
? [
|
||||||
<MyButtons.Default
|
<Create
|
||||||
key="Create"
|
key="Create"
|
||||||
size="middle"
|
reload={() => action?.reload()}
|
||||||
type="primary"
|
title={title}
|
||||||
onClick={() => {
|
|
||||||
navigate('/attendance/attendance_shifts/pages/create');
|
|
||||||
}}
|
|
||||||
title="新增班次"
|
|
||||||
/>,
|
/>,
|
||||||
]
|
]
|
||||||
: [
|
: [
|
||||||
@ -49,14 +44,10 @@ export default function Index({
|
|||||||
key="toolbar"
|
key="toolbar"
|
||||||
actions={{
|
actions={{
|
||||||
add: (
|
add: (
|
||||||
<MyButtons.Default
|
<Create
|
||||||
key="Create"
|
key="Create"
|
||||||
size="middle"
|
reload={() => action?.reload()}
|
||||||
type="primary"
|
title={title}
|
||||||
onClick={() => {
|
|
||||||
navigate('/attendance/attendance_shifts/pages/create');
|
|
||||||
}}
|
|
||||||
title="新增班次"
|
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
@ -72,16 +63,16 @@ export default function Index({
|
|||||||
key: 'asset_projects_id',
|
key: 'asset_projects_id',
|
||||||
hidden: true,
|
hidden: true,
|
||||||
}),
|
}),
|
||||||
{
|
// {
|
||||||
title: '关联项目',
|
// title: '关联项目',
|
||||||
dataIndex: ['asset_project', 'name'],
|
// dataIndex: ['asset_project', 'name'],
|
||||||
// search: {
|
// // search: {
|
||||||
// transform: (value) => {
|
// // transform: (value) => {
|
||||||
// return { project_name: value };
|
// // return { project_name: value };
|
||||||
|
// // },
|
||||||
|
// // },
|
||||||
|
// search: false,
|
||||||
// },
|
// },
|
||||||
// },
|
|
||||||
search: false,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: '班次名称',
|
title: '班次名称',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
@ -96,7 +87,7 @@ export default function Index({
|
|||||||
const periodTexts = periods.map((res: any) => {
|
const periodTexts = periods.map((res: any) => {
|
||||||
return `时段${
|
return `时段${
|
||||||
res?.period_order
|
res?.period_order
|
||||||
}: ${res?.work_start_time?.substring(
|
}: ${res?.work_start_time?.substring(
|
||||||
0,
|
0,
|
||||||
5,
|
5,
|
||||||
)}-${res?.work_end_time?.substring(0, 5)}`;
|
)}-${res?.work_end_time?.substring(0, 5)}`;
|
||||||
@ -129,7 +120,10 @@ export default function Index({
|
|||||||
{
|
{
|
||||||
title: '可打卡时间范围',
|
title: '可打卡时间范围',
|
||||||
render(_, record) {
|
render(_, record) {
|
||||||
return `${record?.allow_checkin_start} - ${record?.allow_checkin_end}`;
|
return `${record?.allow_checkin_start?.substring(
|
||||||
|
0,
|
||||||
|
5,
|
||||||
|
)} - ${record?.allow_checkin_end?.substring(0, 5)}`;
|
||||||
},
|
},
|
||||||
search: false,
|
search: false,
|
||||||
},
|
},
|
||||||
@ -151,16 +145,11 @@ export default function Index({
|
|||||||
<MyTableActions
|
<MyTableActions
|
||||||
actions={{
|
actions={{
|
||||||
update: (
|
update: (
|
||||||
<MyButtons.Default
|
<Update
|
||||||
key="Update"
|
key="Update"
|
||||||
size="small"
|
item={item}
|
||||||
type="primary"
|
reload={action?.reload}
|
||||||
onClick={() => {
|
title={title}
|
||||||
navigate(
|
|
||||||
`/attendance/attendance_shifts/pages/update?id=${item.id}`,
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
title="编辑"
|
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
delete: (
|
delete: (
|
||||||
|
|||||||
156
src/pages/attendance/attendance_shifts/modals/Create.tsx
Normal file
156
src/pages/attendance/attendance_shifts/modals/Create.tsx
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
import {
|
||||||
|
MyBetaModalFormProps,
|
||||||
|
MyButtons,
|
||||||
|
MyFormItems,
|
||||||
|
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 (
|
||||||
|
<BetaSchemaForm<ApiTypes.Attendance.AttendanceShifts.Store>
|
||||||
|
{...MyModalFormProps.props}
|
||||||
|
title="新增班次"
|
||||||
|
trigger={<MyButtons.Create title="新增班次" />}
|
||||||
|
key={new Date().getTime()}
|
||||||
|
width="800px"
|
||||||
|
wrapperCol={{ span: 24 }}
|
||||||
|
form={form}
|
||||||
|
onOpenChange={(open: any) => {
|
||||||
|
if (open) {
|
||||||
|
form.resetFields();
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
onFinish={async (values: any) => {
|
||||||
|
const formattedValues = { ...values };
|
||||||
|
|
||||||
|
if (formattedValues.periods) {
|
||||||
|
formattedValues.periods = formattedValues.periods.map(
|
||||||
|
(period: any) => ({
|
||||||
|
...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`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Apis.Attendance.AttendanceShifts.Store({
|
||||||
|
...formattedValues,
|
||||||
|
is_enabled: true,
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
props.reload?.();
|
||||||
|
message.success('新增成功');
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
.catch(() => false);
|
||||||
|
}}
|
||||||
|
columns={[
|
||||||
|
{
|
||||||
|
title: '班次名称',
|
||||||
|
key: 'name',
|
||||||
|
formItemProps: { ...rulesHelper.text },
|
||||||
|
fieldProps: {
|
||||||
|
placeholder: '请输入(如:早班、晚班)',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
valueType: 'formList',
|
||||||
|
dataIndex: 'periods',
|
||||||
|
title: '设置需打卡时段',
|
||||||
|
formItemProps: { ...rulesHelper.array },
|
||||||
|
fieldProps: {
|
||||||
|
copyIconProps: 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: 'remark',
|
||||||
|
valueType: 'textarea',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
206
src/pages/attendance/attendance_shifts/modals/Update.tsx
Normal file
206
src/pages/attendance/attendance_shifts/modals/Update.tsx
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
import {
|
||||||
|
MyBetaModalFormProps,
|
||||||
|
MyButtons,
|
||||||
|
MyFormItems,
|
||||||
|
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();
|
||||||
|
|
||||||
|
const loadShow = () => {
|
||||||
|
if (!props.item?.id) return;
|
||||||
|
Apis.Attendance.AttendanceShifts.Show({ id: Number(props.item.id) }).then(
|
||||||
|
(res) => {
|
||||||
|
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) => ({
|
||||||
|
...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,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<BetaSchemaForm<ApiTypes.Attendance.AttendanceShifts.Update>
|
||||||
|
{...MyModalFormProps.props}
|
||||||
|
title="编辑班次"
|
||||||
|
trigger={<MyButtons.Default type="primary" size="small" title="编辑" />}
|
||||||
|
key={new Date().getTime()}
|
||||||
|
width="800px"
|
||||||
|
wrapperCol={{ span: 24 }}
|
||||||
|
form={form}
|
||||||
|
onOpenChange={(open: any) => {
|
||||||
|
if (open && props.item) {
|
||||||
|
loadShow();
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
onFinish={async (values: any) => {
|
||||||
|
const formattedValues = { ...values };
|
||||||
|
|
||||||
|
if (formattedValues.periods) {
|
||||||
|
formattedValues.periods = formattedValues.periods.map(
|
||||||
|
(period: any) => ({
|
||||||
|
...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`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Apis.Attendance.AttendanceShifts.Update({
|
||||||
|
...formattedValues,
|
||||||
|
is_enabled: values.is_enabled ? true : false,
|
||||||
|
id: props.item?.id ?? 0,
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
props.reload?.();
|
||||||
|
message.success('编辑成功');
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
.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,
|
||||||
|
},
|
||||||
|
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 },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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: 'remark',
|
||||||
|
valueType: 'textarea',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -1,259 +0,0 @@
|
|||||||
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 (
|
|
||||||
<MyPageContainer
|
|
||||||
title={
|
|
||||||
<Space
|
|
||||||
style={{ cursor: 'pointer' }}
|
|
||||||
onClick={() => {
|
|
||||||
navigate(-1);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{/* <LeftCircleOutlined size={34} /> */}
|
|
||||||
{title}
|
|
||||||
</Space>
|
|
||||||
}
|
|
||||||
enableTabs={false}
|
|
||||||
tabKey="attendance-shifts-create"
|
|
||||||
tabLabel={title}
|
|
||||||
>
|
|
||||||
<ProCard>
|
|
||||||
<div style={{ width: 900, minHeight: '83vh', margin: '0 auto' }}>
|
|
||||||
<BetaSchemaForm<ApiTypes.Attendance.AttendanceShifts.Store>
|
|
||||||
{...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 (
|
|
||||||
// <ProCard size="small" bordered>
|
|
||||||
// <ProTable
|
|
||||||
// {...MyProTableProps.props}
|
|
||||||
// options={false}
|
|
||||||
// size="small"
|
|
||||||
// search={false}
|
|
||||||
// pagination={false}
|
|
||||||
// dataSource={dataSource || []}
|
|
||||||
// headerTitle={
|
|
||||||
// <MyAssetsProjectSelectList
|
|
||||||
// key="select_project"
|
|
||||||
// item={dataSource}
|
|
||||||
// type="radio"
|
|
||||||
// onChange={(e: any) => {
|
|
||||||
// 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) => (
|
|
||||||
// <Space key={index}>
|
|
||||||
// <MyButtons.Delete
|
|
||||||
// onConfirm={() => {
|
|
||||||
// setDataSource(
|
|
||||||
// dataSource.filter(
|
|
||||||
// (res: any) => res?.id !== item?.id,
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }}
|
|
||||||
// />
|
|
||||||
// </Space>
|
|
||||||
// ),
|
|
||||||
// }),
|
|
||||||
// ]}
|
|
||||||
// />
|
|
||||||
// </ProCard>
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
|
|
||||||
Selects?.AssetProjects({
|
|
||||||
title: '关联项目',
|
|
||||||
key: 'asset_projects_id',
|
|
||||||
colProps: { span: 24 },
|
|
||||||
formItemProps: { ...rulesHelper.text },
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
title: '备注',
|
|
||||||
key: 'remark',
|
|
||||||
valueType: 'textarea',
|
|
||||||
colProps: { span: 24 },
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</ProCard>
|
|
||||||
</MyPageContainer>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,263 +0,0 @@
|
|||||||
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<any>({});
|
|
||||||
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 (
|
|
||||||
<MyPageContainer
|
|
||||||
title={
|
|
||||||
<Space
|
|
||||||
style={{ cursor: 'pointer' }}
|
|
||||||
onClick={() => {
|
|
||||||
navigate(-1);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{/* <LeftCircleOutlined size={34} /> */}
|
|
||||||
{title}
|
|
||||||
</Space>
|
|
||||||
}
|
|
||||||
enableTabs={false}
|
|
||||||
tabKey="attendance-shifts-update"
|
|
||||||
tabLabel={title}
|
|
||||||
>
|
|
||||||
<ProCard>
|
|
||||||
<div style={{ width: 900, minHeight: '83vh', margin: '0 auto' }}>
|
|
||||||
<BetaSchemaForm<ApiTypes.Attendance.AttendanceShifts.Update>
|
|
||||||
{...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 },
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</ProCard>
|
|
||||||
</MyPageContainer>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -2,6 +2,7 @@ import { MyBetaModalFormProps } from '@/common';
|
|||||||
import { MyModal } from '@/components/MyModal';
|
import { MyModal } from '@/components/MyModal';
|
||||||
import { Apis } from '@/gen/Apis';
|
import { Apis } from '@/gen/Apis';
|
||||||
import { HouseBillsTypeEnum } from '@/gen/Enums';
|
import { HouseBillsTypeEnum } from '@/gen/Enums';
|
||||||
|
import { Spin } from 'antd';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import HasCar from '../components/HasCar';
|
import HasCar from '../components/HasCar';
|
||||||
import HasHouse from '../components/HasHouse';
|
import HasHouse from '../components/HasHouse';
|
||||||
@ -42,20 +43,26 @@ function getPageType(chargeType: string) {
|
|||||||
export default function Show(props: MyBetaModalFormProps) {
|
export default function Show(props: MyBetaModalFormProps) {
|
||||||
const { item, reload, title = '详情' } = props;
|
const { item, reload, title = '详情' } = props;
|
||||||
const [data, setData] = useState<any>({});
|
const [data, setData] = useState<any>({});
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
const pageType = getPageType(item?.charge_type);
|
const pageType = getPageType(item?.charge_type);
|
||||||
const meterConfig = getMeterConfig(item?.charge_type);
|
const meterConfig = getMeterConfig(item?.charge_type);
|
||||||
|
|
||||||
const loadShow = () => {
|
const loadShow = () => {
|
||||||
|
setLoading(true);
|
||||||
Apis.HouseCharge.HouseChargeStandards.Show({
|
Apis.HouseCharge.HouseChargeStandards.Show({
|
||||||
id: item?.id ?? 0,
|
id: item?.id ?? 0,
|
||||||
}).then((res) => {
|
})
|
||||||
|
.then((res) => {
|
||||||
setData(res?.data || {});
|
setData(res?.data || {});
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
setLoading(false);
|
||||||
});
|
});
|
||||||
reload?.();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderContent = () => {
|
const renderContent = () => {
|
||||||
|
if (!data?.id) return null;
|
||||||
if (pageType === 'Meter') {
|
if (pageType === 'Meter') {
|
||||||
return (
|
return (
|
||||||
<Instrument
|
<Instrument
|
||||||
@ -93,7 +100,7 @@ export default function Show(props: MyBetaModalFormProps) {
|
|||||||
onOpen={() => {
|
onOpen={() => {
|
||||||
loadShow();
|
loadShow();
|
||||||
}}
|
}}
|
||||||
node={renderContent()}
|
node={<Spin spinning={loading}>{renderContent()}</Spin>}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -377,7 +377,7 @@ export default function Create() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '合同标地',
|
title: '合同标的',
|
||||||
formItemProps: { ...rulesHelper.text },
|
formItemProps: { ...rulesHelper.text },
|
||||||
dataIndex: 'object_name',
|
dataIndex: 'object_name',
|
||||||
colProps: { span: 6 },
|
colProps: { span: 6 },
|
||||||
|
|||||||
@ -246,7 +246,7 @@ export default function Index({ title = '编辑合同账单' }) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '合同标地',
|
title: '合同标的',
|
||||||
formItemProps: { ...rulesHelper.text },
|
formItemProps: { ...rulesHelper.text },
|
||||||
dataIndex: 'object_name',
|
dataIndex: 'object_name',
|
||||||
fieldProps: {
|
fieldProps: {
|
||||||
|
|||||||
@ -37,7 +37,7 @@ export default function Index({ title = '合同详情' }) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: '3',
|
key: '3',
|
||||||
label: '合同标地',
|
label: '合同标的',
|
||||||
children: <MyContractBillObjects item={showData} />,
|
children: <MyContractBillObjects item={showData} />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -15,7 +15,7 @@ export default function Index(props: MyBetaModalFormProps) {
|
|||||||
Apis.Contract.ContractBillObjects.List,
|
Apis.Contract.ContractBillObjects.List,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
headerTitle="合同标地"
|
headerTitle="合同标的"
|
||||||
search={false}
|
search={false}
|
||||||
columns={[
|
columns={[
|
||||||
MyColumns.ID({
|
MyColumns.ID({
|
||||||
|
|||||||
@ -29,7 +29,7 @@ export default function Index({ title = '合同详情' }) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: '3',
|
key: '3',
|
||||||
label: '合同标地',
|
label: '合同标的',
|
||||||
children: <MyContractBillObjects item={showData} />,
|
children: <MyContractBillObjects item={showData} />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -15,7 +15,7 @@ export default function Index(props: MyBetaModalFormProps) {
|
|||||||
Apis.Contract.ContractBillObjects.List,
|
Apis.Contract.ContractBillObjects.List,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
headerTitle="合同标地"
|
headerTitle="合同标的"
|
||||||
search={false}
|
search={false}
|
||||||
columns={[
|
columns={[
|
||||||
MyColumns.ID({
|
MyColumns.ID({
|
||||||
|
|||||||
@ -142,20 +142,20 @@ export default function CommonMeter({ title = '公摊表' }) {
|
|||||||
// search: { transform: (value) => ({ project_name: value }) }
|
// search: { transform: (value) => ({ project_name: value }) }
|
||||||
search: false,
|
search: false,
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
title: '房屋',
|
// title: '房屋',
|
||||||
render: (_, item: any) => {
|
// render: (_, item: any) => {
|
||||||
return (
|
// return (
|
||||||
<Space>
|
// <Space>
|
||||||
{item.house_meter_has_houses?.map(
|
// {item.house_meter_has_houses?.map(
|
||||||
(res: { full_name: string }) => {
|
// (res: { full_name: string }) => {
|
||||||
return res?.full_name;
|
// return res?.full_name;
|
||||||
},
|
// },
|
||||||
)}
|
// )}
|
||||||
</Space>
|
// </Space>
|
||||||
);
|
// );
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
title: '仪表编号',
|
title: '仪表编号',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
|
|||||||
@ -12,16 +12,16 @@ import {
|
|||||||
EmergencyEventsStatusEnum,
|
EmergencyEventsStatusEnum,
|
||||||
} from '@/gen/Enums';
|
} from '@/gen/Enums';
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
import { ProTable } from '@ant-design/pro-components';
|
||||||
import { useNavigate } from '@umijs/max';
|
|
||||||
import { Space } from 'antd';
|
import { Space } from 'antd';
|
||||||
|
import CategoriesModal from './modals/CategoriesModal';
|
||||||
import EventApplyClose from './modals/EventApplyClose';
|
import EventApplyClose from './modals/EventApplyClose';
|
||||||
import EventCreate from './modals/EventCreate';
|
import EventCreate from './modals/EventCreate';
|
||||||
import EventReview from './modals/EventReview';
|
import EventReview from './modals/EventReview';
|
||||||
import EventUpdate from './modals/EventUpdate';
|
import EventUpdate from './modals/EventUpdate';
|
||||||
|
import LevelsModal from './modals/LevelsModal';
|
||||||
|
import TeamsModal from './modals/TeamsModal';
|
||||||
|
|
||||||
export default function Index({ title = '突发事件' }) {
|
export default function Index({ title = '突发事件' }) {
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MyPageContainer
|
<MyPageContainer
|
||||||
title={title}
|
title={title}
|
||||||
@ -50,36 +50,9 @@ export default function Index({ title = '突发事件' }) {
|
|||||||
title={title}
|
title={title}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
teams: (
|
teams: <TeamsModal key="TeamsModal" />,
|
||||||
<MyButtons.Default
|
categories: <CategoriesModal key="CategoriesModal" />,
|
||||||
key="Teams"
|
levels: <LevelsModal key="LevelsModal" />,
|
||||||
size="middle"
|
|
||||||
onClick={() => {
|
|
||||||
navigate('/quality/emergency/teams');
|
|
||||||
}}
|
|
||||||
title="应急小组"
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
categories: (
|
|
||||||
<MyButtons.Default
|
|
||||||
key="Categories"
|
|
||||||
size="middle"
|
|
||||||
onClick={() => {
|
|
||||||
navigate('/quality/emergency/categories');
|
|
||||||
}}
|
|
||||||
title="事件分类"
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
levels: (
|
|
||||||
<MyButtons.Default
|
|
||||||
key="Levels"
|
|
||||||
size="middle"
|
|
||||||
onClick={() => {
|
|
||||||
navigate('/quality/emergency/levels');
|
|
||||||
}}
|
|
||||||
title="级别配置"
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
}}
|
}}
|
||||||
/>,
|
/>,
|
||||||
]}
|
]}
|
||||||
|
|||||||
27
src/pages/quality/emergency/modals/CategoriesModal.tsx
Normal file
27
src/pages/quality/emergency/modals/CategoriesModal.tsx
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import { MyButtons } from '@/common';
|
||||||
|
import { Modal } from 'antd';
|
||||||
|
import { useState } from 'react';
|
||||||
|
import CategoriesIndex from '../categories';
|
||||||
|
|
||||||
|
export default function CategoriesModal() {
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<MyButtons.Default
|
||||||
|
size="middle"
|
||||||
|
onClick={() => setOpen(true)}
|
||||||
|
title="事件分类"
|
||||||
|
/>
|
||||||
|
<Modal
|
||||||
|
open={open}
|
||||||
|
onCancel={() => setOpen(false)}
|
||||||
|
footer={null}
|
||||||
|
width="80%"
|
||||||
|
destroyOnClose
|
||||||
|
>
|
||||||
|
<CategoriesIndex />
|
||||||
|
</Modal>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
27
src/pages/quality/emergency/modals/LevelsModal.tsx
Normal file
27
src/pages/quality/emergency/modals/LevelsModal.tsx
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import { MyButtons } from '@/common';
|
||||||
|
import { Modal } from 'antd';
|
||||||
|
import { useState } from 'react';
|
||||||
|
import LevelsIndex from '../levels';
|
||||||
|
|
||||||
|
export default function LevelsModal() {
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<MyButtons.Default
|
||||||
|
size="middle"
|
||||||
|
onClick={() => setOpen(true)}
|
||||||
|
title="级别配置"
|
||||||
|
/>
|
||||||
|
<Modal
|
||||||
|
open={open}
|
||||||
|
onCancel={() => setOpen(false)}
|
||||||
|
footer={null}
|
||||||
|
width="80%"
|
||||||
|
destroyOnClose
|
||||||
|
>
|
||||||
|
<LevelsIndex />
|
||||||
|
</Modal>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
27
src/pages/quality/emergency/modals/TeamsModal.tsx
Normal file
27
src/pages/quality/emergency/modals/TeamsModal.tsx
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import { MyButtons } from '@/common';
|
||||||
|
import { Modal } from 'antd';
|
||||||
|
import { useState } from 'react';
|
||||||
|
import TeamsIndex from '../teams';
|
||||||
|
|
||||||
|
export default function TeamsModal() {
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<MyButtons.Default
|
||||||
|
size="middle"
|
||||||
|
onClick={() => setOpen(true)}
|
||||||
|
title="应急小组"
|
||||||
|
/>
|
||||||
|
<Modal
|
||||||
|
open={open}
|
||||||
|
onCancel={() => setOpen(false)}
|
||||||
|
footer={null}
|
||||||
|
width="80%"
|
||||||
|
destroyOnClose
|
||||||
|
>
|
||||||
|
<TeamsIndex />
|
||||||
|
</Modal>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -1,9 +1,4 @@
|
|||||||
import {
|
import { MyButtons, MyColumns, MyProTableProps } from '@/common';
|
||||||
MyButtons,
|
|
||||||
MyColumns,
|
|
||||||
MyPageContainer,
|
|
||||||
MyProTableProps,
|
|
||||||
} from '@/common';
|
|
||||||
import { Apis } from '@/gen/Apis';
|
import { Apis } from '@/gen/Apis';
|
||||||
import { ProTable } from '@ant-design/pro-components';
|
import { ProTable } from '@ant-design/pro-components';
|
||||||
import { Space } from 'antd';
|
import { Space } from 'antd';
|
||||||
@ -12,12 +7,6 @@ import Update from '../modals/TeamUpdate';
|
|||||||
|
|
||||||
export default function Index({ title = '应急小组' }) {
|
export default function Index({ title = '应急小组' }) {
|
||||||
return (
|
return (
|
||||||
<MyPageContainer
|
|
||||||
title={title}
|
|
||||||
enableTabs={true}
|
|
||||||
tabKey="emergency_events_teams"
|
|
||||||
tabLabel={title}
|
|
||||||
>
|
|
||||||
<ProTable
|
<ProTable
|
||||||
{...MyProTableProps.props}
|
{...MyProTableProps.props}
|
||||||
request={async (params, sort) =>
|
request={async (params, sort) =>
|
||||||
@ -89,6 +78,5 @@ export default function Index({ title = '应急小组' }) {
|
|||||||
}),
|
}),
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</MyPageContainer>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,10 @@ import { PlusOutlined } from '@ant-design/icons';
|
|||||||
import { ProTable } from '@ant-design/pro-components';
|
import { ProTable } from '@ant-design/pro-components';
|
||||||
import { useNavigate } from '@umijs/max';
|
import { useNavigate } from '@umijs/max';
|
||||||
import { Space } from 'antd';
|
import { Space } from 'antd';
|
||||||
|
import AuditModal from './modals/AuditModal';
|
||||||
import DepositPay from './modals/DepositPay';
|
import DepositPay from './modals/DepositPay';
|
||||||
import DepositRefund from './modals/DepositRefund';
|
import DepositRefund from './modals/DepositRefund';
|
||||||
|
import InspectionRulesModal from './modals/InspectionRulesModal';
|
||||||
import MyWorkerCreate from './modals/WorkerCreate';
|
import MyWorkerCreate from './modals/WorkerCreate';
|
||||||
|
|
||||||
export default function Index({ title = '装修管理' }) {
|
export default function Index({ title = '装修管理' }) {
|
||||||
@ -56,26 +58,8 @@ export default function Index({ title = '装修管理' }) {
|
|||||||
title="装修申请"
|
title="装修申请"
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
rules: (
|
rules: <InspectionRulesModal key="InspectionRulesModal" />,
|
||||||
<MyButtons.Default
|
audit: <AuditModal key="AuditModal" />,
|
||||||
key="InspectionRules"
|
|
||||||
size="middle"
|
|
||||||
onClick={() => {
|
|
||||||
navigate('/quality/renovation/inspection_rules');
|
|
||||||
}}
|
|
||||||
title="巡检配置"
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
audit: (
|
|
||||||
<MyButtons.Default
|
|
||||||
key="Audit"
|
|
||||||
size="middle"
|
|
||||||
onClick={() => {
|
|
||||||
navigate('/quality/renovation/audit');
|
|
||||||
}}
|
|
||||||
title="资料审核"
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
}}
|
}}
|
||||||
/>,
|
/>,
|
||||||
]}
|
]}
|
||||||
|
|||||||
27
src/pages/quality/renovation/modals/AuditModal.tsx
Normal file
27
src/pages/quality/renovation/modals/AuditModal.tsx
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import { MyButtons } from '@/common';
|
||||||
|
import { Modal } from 'antd';
|
||||||
|
import { useState } from 'react';
|
||||||
|
import AuditIndex from '../audit';
|
||||||
|
|
||||||
|
export default function AuditModal() {
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<MyButtons.Default
|
||||||
|
size="middle"
|
||||||
|
onClick={() => setOpen(true)}
|
||||||
|
title="资料审核"
|
||||||
|
/>
|
||||||
|
<Modal
|
||||||
|
open={open}
|
||||||
|
onCancel={() => setOpen(false)}
|
||||||
|
footer={null}
|
||||||
|
width="80%"
|
||||||
|
destroyOnClose
|
||||||
|
>
|
||||||
|
<AuditIndex />
|
||||||
|
</Modal>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
27
src/pages/quality/renovation/modals/InspectionRulesModal.tsx
Normal file
27
src/pages/quality/renovation/modals/InspectionRulesModal.tsx
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import { MyButtons } from '@/common';
|
||||||
|
import { Modal } from 'antd';
|
||||||
|
import { useState } from 'react';
|
||||||
|
import InspectionRulesIndex from '../inspection_rules';
|
||||||
|
|
||||||
|
export default function InspectionRulesModal() {
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<MyButtons.Default
|
||||||
|
size="middle"
|
||||||
|
onClick={() => setOpen(true)}
|
||||||
|
title="巡检配置"
|
||||||
|
/>
|
||||||
|
<Modal
|
||||||
|
open={open}
|
||||||
|
onCancel={() => setOpen(false)}
|
||||||
|
footer={null}
|
||||||
|
width="80%"
|
||||||
|
destroyOnClose
|
||||||
|
>
|
||||||
|
<InspectionRulesIndex />
|
||||||
|
</Modal>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -325,13 +325,13 @@ export default function Index({ title = '新装修申请' }) {
|
|||||||
{
|
{
|
||||||
title: '公司负责人姓名',
|
title: '公司负责人姓名',
|
||||||
key: 'company_principal_name',
|
key: 'company_principal_name',
|
||||||
formItemProps: { ...rulesHelper.text },
|
// formItemProps: { ...rulesHelper.text },
|
||||||
colProps: { span: 6 },
|
colProps: { span: 6 },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '公司负责人手机',
|
title: '公司负责人手机',
|
||||||
key: 'company_principal_phone',
|
key: 'company_principal_phone',
|
||||||
formItemProps: { ...rulesHelper.phone },
|
// formItemProps: { ...rulesHelper.phone },
|
||||||
colProps: { span: 6 },
|
colProps: { span: 6 },
|
||||||
fieldProps: {
|
fieldProps: {
|
||||||
maxLength: 11,
|
maxLength: 11,
|
||||||
|
|||||||
@ -447,13 +447,13 @@ export default function Index({ title = '编辑新装修申请' }) {
|
|||||||
{
|
{
|
||||||
title: '公司负责人姓名',
|
title: '公司负责人姓名',
|
||||||
key: 'company_principal_name',
|
key: 'company_principal_name',
|
||||||
formItemProps: { ...rulesHelper.text },
|
// formItemProps: { ...rulesHelper.text },
|
||||||
colProps: { span: 6 },
|
colProps: { span: 6 },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '公司负责人手机',
|
title: '公司负责人手机',
|
||||||
key: 'company_principal_phone',
|
key: 'company_principal_phone',
|
||||||
formItemProps: { ...rulesHelper.phone },
|
// formItemProps: { ...rulesHelper.phone },
|
||||||
colProps: { span: 6 },
|
colProps: { span: 6 },
|
||||||
fieldProps: {
|
fieldProps: {
|
||||||
maxLength: 11,
|
maxLength: 11,
|
||||||
|
|||||||
@ -15,7 +15,6 @@ export default function SurveysListShow(props: MyBetaModalFormProps) {
|
|||||||
title={props.title || '查看问卷'}
|
title={props.title || '查看问卷'}
|
||||||
type={props.item?.type || 'primary'}
|
type={props.item?.type || 'primary'}
|
||||||
width="800px"
|
width="800px"
|
||||||
trigger={props?.trigger}
|
|
||||||
onOpen={() => {
|
onOpen={() => {
|
||||||
if (props?.item?.id) {
|
if (props?.item?.id) {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user