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 { useLocation, useNavigate } from '@umijs/max';
|
||||
import { Breadcrumb, Space } from 'antd';
|
||||
import { useEffect, useState } from 'react';
|
||||
// import './MyPageContainer.scss';
|
||||
import { Breadcrumb, Button, Space, Tooltip } from 'antd';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
|
||||
export interface TabItem {
|
||||
key: string;
|
||||
label: string;
|
||||
path: string;
|
||||
closable?: boolean;
|
||||
}
|
||||
interface BreadcrumbItem {
|
||||
title: string;
|
||||
path: string;
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
export interface MyPageContainerProps extends PageContainerProps {
|
||||
/* 多标签页功能已废弃,此参数不再生效,保留以避免破坏现有调用方 */
|
||||
enableTabs?: boolean;
|
||||
/* 多标签页功能已废弃,此参数不再生效,保留以避免破坏现有调用方 */
|
||||
tabKey?: string;
|
||||
/* 多标签页功能已废弃,此参数不再生效,保留以避免破坏现有调用方 */
|
||||
tabLabel?: string;
|
||||
/* 多标签页功能已废弃,此参数不再生效,保留以避免破坏现有调用方 */
|
||||
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({
|
||||
title,
|
||||
children,
|
||||
enableTabs = false, // 默认关闭多标签页功能
|
||||
tabKey,
|
||||
tabLabel,
|
||||
onTabChange,
|
||||
enableTabs: _enableTabs,
|
||||
tabKey: _tabKey,
|
||||
tabLabel: _tabLabel,
|
||||
onTabChange: _onTabChange,
|
||||
...rest
|
||||
}: MyPageContainerProps) {
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation(); // 使用useLocation钩子
|
||||
const [dataBre, setDataBre] = useState<any>(
|
||||
const location = useLocation();
|
||||
const [dataBre, setDataBre] = useState<BreadcrumbItem[]>(
|
||||
JSON.parse(sessionStorage.getItem('breadcrumbs') || '[]'),
|
||||
);
|
||||
const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
|
||||
// 简化的面包屑更新逻辑
|
||||
const updateBreadcrumbs = () => {
|
||||
const canGoBack = location.pathname !== '/';
|
||||
|
||||
const handleGoBack = useCallback(() => {
|
||||
navigate(-1);
|
||||
}, [navigate]);
|
||||
|
||||
const updateBreadcrumbs = useCallback(() => {
|
||||
try {
|
||||
// 获取当前路径和标题
|
||||
const currentPath = location.pathname + location.search;
|
||||
const currentTitle =
|
||||
typeof title === 'string'
|
||||
? title
|
||||
: String(title?.props?.children || '');
|
||||
: String(
|
||||
(title as { props?: { children?: unknown } })?.props?.children ??
|
||||
'',
|
||||
);
|
||||
|
||||
// 清空无效的面包屑数据(重置逻辑)
|
||||
const newBreadcrumbs: BreadcrumbItem[] = [];
|
||||
|
||||
// 只添加当前页面的面包屑
|
||||
if (currentPath && currentTitle) {
|
||||
newBreadcrumbs.push({
|
||||
title: currentTitle,
|
||||
@ -229,30 +62,31 @@ export function MyPageContainer({
|
||||
});
|
||||
}
|
||||
|
||||
// 更新sessionStorage
|
||||
try {
|
||||
sessionStorage.setItem('breadcrumbs', JSON.stringify(newBreadcrumbs));
|
||||
} catch (storageError) {
|
||||
console.error('存储到sessionStorage失败:', storageError);
|
||||
}
|
||||
|
||||
// 更新状态
|
||||
setDataBre(newBreadcrumbs);
|
||||
} catch (error) {
|
||||
console.error('更新面包屑时出错:', error);
|
||||
// 出错时重置面包屑
|
||||
setDataBre([]);
|
||||
}
|
||||
};
|
||||
}, [location.pathname, location.search, title]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log('title', title);
|
||||
setTimeout(() => {
|
||||
timeoutRef.current = setTimeout(() => {
|
||||
updateBreadcrumbs();
|
||||
}, 250);
|
||||
}, [location.pathname, location.search, title]);
|
||||
// 不再需要标签页相关的状态和逻辑
|
||||
// 直接返回简化版的PageContainer
|
||||
|
||||
return () => {
|
||||
if (timeoutRef.current) {
|
||||
clearTimeout(timeoutRef.current);
|
||||
}
|
||||
};
|
||||
}, [updateBreadcrumbs]);
|
||||
|
||||
return (
|
||||
<PageContainer
|
||||
fixedHeader
|
||||
@ -260,15 +94,24 @@ export function MyPageContainer({
|
||||
breadcrumb: {},
|
||||
title: (
|
||||
<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
|
||||
items={[
|
||||
{
|
||||
title: <HomeOutlined />,
|
||||
onClick: () => {
|
||||
navigate('/');
|
||||
},
|
||||
onClick: () => navigate('/'),
|
||||
},
|
||||
...dataBre?.map((res: any) => ({
|
||||
...dataBre.map((res) => ({
|
||||
title: res.title || '',
|
||||
onClick: () => {
|
||||
navigate(res.path);
|
||||
@ -301,6 +144,3 @@ export function MyPageContainer({
|
||||
</PageContainer>
|
||||
);
|
||||
}
|
||||
|
||||
// 不再导出标签页管理器
|
||||
// export { tabsManager };
|
||||
|
||||
@ -8,8 +8,9 @@ import {
|
||||
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';
|
||||
import Create from './modals/Create';
|
||||
import Update from './modals/Update';
|
||||
|
||||
export default function Index({
|
||||
title = '班次管理',
|
||||
@ -18,8 +19,6 @@ export default function Index({
|
||||
title?: string;
|
||||
noPermission?: boolean;
|
||||
}) {
|
||||
const navigate = useNavigate();
|
||||
|
||||
return (
|
||||
<ProTable
|
||||
{...MyProTableProps.props}
|
||||
@ -31,17 +30,13 @@ export default function Index({
|
||||
)
|
||||
}
|
||||
headerTitle={title}
|
||||
toolBarRender={() =>
|
||||
toolBarRender={(action) =>
|
||||
noPermission
|
||||
? [
|
||||
<MyButtons.Default
|
||||
<Create
|
||||
key="Create"
|
||||
size="middle"
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
navigate('/attendance/attendance_shifts/pages/create');
|
||||
}}
|
||||
title="新增班次"
|
||||
reload={() => action?.reload()}
|
||||
title={title}
|
||||
/>,
|
||||
]
|
||||
: [
|
||||
@ -49,14 +44,10 @@ export default function Index({
|
||||
key="toolbar"
|
||||
actions={{
|
||||
add: (
|
||||
<MyButtons.Default
|
||||
<Create
|
||||
key="Create"
|
||||
size="middle"
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
navigate('/attendance/attendance_shifts/pages/create');
|
||||
}}
|
||||
title="新增班次"
|
||||
reload={() => action?.reload()}
|
||||
title={title}
|
||||
/>
|
||||
),
|
||||
}}
|
||||
@ -72,16 +63,16 @@ export default function Index({
|
||||
key: 'asset_projects_id',
|
||||
hidden: true,
|
||||
}),
|
||||
{
|
||||
title: '关联项目',
|
||||
dataIndex: ['asset_project', 'name'],
|
||||
// search: {
|
||||
// transform: (value) => {
|
||||
// return { project_name: value };
|
||||
// },
|
||||
// },
|
||||
search: false,
|
||||
},
|
||||
// {
|
||||
// title: '关联项目',
|
||||
// dataIndex: ['asset_project', 'name'],
|
||||
// // search: {
|
||||
// // transform: (value) => {
|
||||
// // return { project_name: value };
|
||||
// // },
|
||||
// // },
|
||||
// search: false,
|
||||
// },
|
||||
{
|
||||
title: '班次名称',
|
||||
dataIndex: 'name',
|
||||
@ -96,7 +87,7 @@ export default function Index({
|
||||
const periodTexts = periods.map((res: any) => {
|
||||
return `时段${
|
||||
res?.period_order
|
||||
}: ${res?.work_start_time?.substring(
|
||||
}: ${res?.work_start_time?.substring(
|
||||
0,
|
||||
5,
|
||||
)}-${res?.work_end_time?.substring(0, 5)}`;
|
||||
@ -129,7 +120,10 @@ export default function Index({
|
||||
{
|
||||
title: '可打卡时间范围',
|
||||
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,
|
||||
},
|
||||
@ -151,16 +145,11 @@ export default function Index({
|
||||
<MyTableActions
|
||||
actions={{
|
||||
update: (
|
||||
<MyButtons.Default
|
||||
<Update
|
||||
key="Update"
|
||||
size="small"
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
navigate(
|
||||
`/attendance/attendance_shifts/pages/update?id=${item.id}`,
|
||||
);
|
||||
}}
|
||||
title="编辑"
|
||||
item={item}
|
||||
reload={action?.reload}
|
||||
title={title}
|
||||
/>
|
||||
),
|
||||
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 { Apis } from '@/gen/Apis';
|
||||
import { HouseBillsTypeEnum } from '@/gen/Enums';
|
||||
import { Spin } from 'antd';
|
||||
import { useState } from 'react';
|
||||
import HasCar from '../components/HasCar';
|
||||
import HasHouse from '../components/HasHouse';
|
||||
@ -42,20 +43,26 @@ function getPageType(chargeType: string) {
|
||||
export default function Show(props: MyBetaModalFormProps) {
|
||||
const { item, reload, title = '详情' } = props;
|
||||
const [data, setData] = useState<any>({});
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const pageType = getPageType(item?.charge_type);
|
||||
const meterConfig = getMeterConfig(item?.charge_type);
|
||||
|
||||
const loadShow = () => {
|
||||
setLoading(true);
|
||||
Apis.HouseCharge.HouseChargeStandards.Show({
|
||||
id: item?.id ?? 0,
|
||||
}).then((res) => {
|
||||
setData(res?.data || {});
|
||||
});
|
||||
reload?.();
|
||||
})
|
||||
.then((res) => {
|
||||
setData(res?.data || {});
|
||||
})
|
||||
.finally(() => {
|
||||
setLoading(false);
|
||||
});
|
||||
};
|
||||
|
||||
const renderContent = () => {
|
||||
if (!data?.id) return null;
|
||||
if (pageType === 'Meter') {
|
||||
return (
|
||||
<Instrument
|
||||
@ -93,7 +100,7 @@ export default function Show(props: MyBetaModalFormProps) {
|
||||
onOpen={() => {
|
||||
loadShow();
|
||||
}}
|
||||
node={renderContent()}
|
||||
node={<Spin spinning={loading}>{renderContent()}</Spin>}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@ -377,7 +377,7 @@ export default function Create() {
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '合同标地',
|
||||
title: '合同标的',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
dataIndex: 'object_name',
|
||||
colProps: { span: 6 },
|
||||
|
||||
@ -246,7 +246,7 @@ export default function Index({ title = '编辑合同账单' }) {
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '合同标地',
|
||||
title: '合同标的',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
dataIndex: 'object_name',
|
||||
fieldProps: {
|
||||
|
||||
@ -266,7 +266,7 @@ export default function Index({ title = '新增补充协议' }) {
|
||||
},
|
||||
required: true,
|
||||
fieldProps: {
|
||||
placeholder: '请选择签约主体',
|
||||
placeholder: '请选择供应商',
|
||||
},
|
||||
}),
|
||||
]
|
||||
@ -285,7 +285,45 @@ export default function Index({ title = '新增补充协议' }) {
|
||||
},
|
||||
required: true,
|
||||
fieldProps: {
|
||||
placeholder: '请选择签约主体',
|
||||
placeholder: '请选择内部企业',
|
||||
},
|
||||
}),
|
||||
]
|
||||
: counterparty_type === 'CustomerCompany'
|
||||
? [
|
||||
SelectContract.SupplierName({
|
||||
key: 'counterparty',
|
||||
title: '',
|
||||
params: {
|
||||
counterparty: 'CustomerCompany',
|
||||
},
|
||||
colProps: { span: 12 },
|
||||
formItemProps: {
|
||||
...rulesHelper.text,
|
||||
wrapperCol: { span: 24 },
|
||||
},
|
||||
required: true,
|
||||
fieldProps: {
|
||||
placeholder: '请选择客户单位',
|
||||
},
|
||||
}),
|
||||
]
|
||||
: counterparty_type === 'Other'
|
||||
? [
|
||||
SelectContract.SupplierName({
|
||||
key: 'counterparty',
|
||||
title: '',
|
||||
params: {
|
||||
counterparty: 'Other',
|
||||
},
|
||||
colProps: { span: 12 },
|
||||
formItemProps: {
|
||||
...rulesHelper.text,
|
||||
wrapperCol: { span: 24 },
|
||||
},
|
||||
required: true,
|
||||
fieldProps: {
|
||||
placeholder: '请选择其他',
|
||||
},
|
||||
}),
|
||||
]
|
||||
|
||||
@ -240,7 +240,7 @@ export default function Index({ title = '修改补充协议' }) {
|
||||
},
|
||||
required: true,
|
||||
fieldProps: {
|
||||
placeholder: '请选择签约主体',
|
||||
placeholder: '请选择供应商',
|
||||
},
|
||||
}),
|
||||
]
|
||||
@ -259,7 +259,45 @@ export default function Index({ title = '修改补充协议' }) {
|
||||
},
|
||||
required: true,
|
||||
fieldProps: {
|
||||
placeholder: '请选择签约主体',
|
||||
placeholder: '请选择内部企业',
|
||||
},
|
||||
}),
|
||||
]
|
||||
: counterparty_type === 'CustomerCompany'
|
||||
? [
|
||||
SelectContract.SupplierName({
|
||||
key: 'counterparty',
|
||||
title: '',
|
||||
params: {
|
||||
counterparty: 'CustomerCompany',
|
||||
},
|
||||
colProps: { span: 12 },
|
||||
formItemProps: {
|
||||
...rulesHelper.text,
|
||||
wrapperCol: { span: 24 },
|
||||
},
|
||||
required: true,
|
||||
fieldProps: {
|
||||
placeholder: '请选择客户单位',
|
||||
},
|
||||
}),
|
||||
]
|
||||
: counterparty_type === 'Other'
|
||||
? [
|
||||
SelectContract.SupplierName({
|
||||
key: 'counterparty',
|
||||
title: '',
|
||||
params: {
|
||||
counterparty: 'Other',
|
||||
},
|
||||
colProps: { span: 12 },
|
||||
formItemProps: {
|
||||
...rulesHelper.text,
|
||||
wrapperCol: { span: 24 },
|
||||
},
|
||||
required: true,
|
||||
fieldProps: {
|
||||
placeholder: '请选择其他',
|
||||
},
|
||||
}),
|
||||
]
|
||||
|
||||
@ -597,15 +597,22 @@ export default function Index({ title = '新增合同' }) {
|
||||
buttonStyle: 'solid',
|
||||
},
|
||||
}),
|
||||
MyFormItems.EnumRadio({
|
||||
MyFormItems.EnumSelect({
|
||||
key: 'counterparty_type',
|
||||
title: '',
|
||||
valueEnum: CompanySuppliersCounterpartyEnum,
|
||||
colProps: { span: 7 },
|
||||
colProps: { span: 5 },
|
||||
formItemProps: {
|
||||
...rulesHelper.text,
|
||||
wrapperCol: { span: 24 },
|
||||
},
|
||||
// fieldProps: {
|
||||
// buttonStyle: 'solid',
|
||||
// onChange: () => {
|
||||
// // 切换计量单位时清空计费模式
|
||||
// form.setFieldValue('counterparty', undefined);
|
||||
// },
|
||||
// },
|
||||
}),
|
||||
{
|
||||
valueType: 'dependency',
|
||||
@ -619,7 +626,7 @@ export default function Index({ title = '新增合同' }) {
|
||||
params: {
|
||||
counterparty: 'Supplier',
|
||||
},
|
||||
colProps: { span: 10 },
|
||||
colProps: { span: 12 },
|
||||
formItemProps: {
|
||||
...rulesHelper.text,
|
||||
wrapperCol: { span: 24 },
|
||||
@ -638,14 +645,52 @@ export default function Index({ title = '新增合同' }) {
|
||||
params: {
|
||||
counterparty: 'InternalCompany',
|
||||
},
|
||||
colProps: { span: 10 },
|
||||
colProps: { span: 12 },
|
||||
formItemProps: {
|
||||
...rulesHelper.text,
|
||||
wrapperCol: { span: 24 },
|
||||
},
|
||||
required: true,
|
||||
fieldProps: {
|
||||
placeholder: '请选择内部公司',
|
||||
placeholder: '请选择内部企业',
|
||||
},
|
||||
}),
|
||||
]
|
||||
: counterparty_type === 'CustomerCompany'
|
||||
? [
|
||||
SelectContract.SupplierName({
|
||||
key: 'counterparty',
|
||||
title: '',
|
||||
params: {
|
||||
counterparty: 'CustomerCompany',
|
||||
},
|
||||
colProps: { span: 12 },
|
||||
formItemProps: {
|
||||
...rulesHelper.text,
|
||||
wrapperCol: { span: 24 },
|
||||
},
|
||||
required: true,
|
||||
fieldProps: {
|
||||
placeholder: '请选择客户单位',
|
||||
},
|
||||
}),
|
||||
]
|
||||
: counterparty_type === 'Other'
|
||||
? [
|
||||
SelectContract.SupplierName({
|
||||
key: 'counterparty',
|
||||
title: '',
|
||||
params: {
|
||||
counterparty: 'Other',
|
||||
},
|
||||
colProps: { span: 12 },
|
||||
formItemProps: {
|
||||
...rulesHelper.text,
|
||||
wrapperCol: { span: 24 },
|
||||
},
|
||||
required: true,
|
||||
fieldProps: {
|
||||
placeholder: '请选择其他',
|
||||
},
|
||||
}),
|
||||
]
|
||||
@ -656,7 +701,7 @@ export default function Index({ title = '新增合同' }) {
|
||||
params: {
|
||||
counterparty: 'InternalCompany',
|
||||
},
|
||||
colProps: { span: 10 },
|
||||
colProps: { span: 12 },
|
||||
formItemProps: {
|
||||
...rulesHelper.text,
|
||||
wrapperCol: { span: 24 },
|
||||
@ -833,12 +878,12 @@ export default function Index({ title = '新增合同' }) {
|
||||
fieldProps: {
|
||||
options: contractData?.peoples
|
||||
?.filter((item: any) => {
|
||||
// 当收入类型为Income时,只显示内部公司
|
||||
// 当收入类型为Income时,只显示内部企业
|
||||
if (contractData?.income_expense_type === 'Income') {
|
||||
return item?.counterparty_type === 'InternalCompany';
|
||||
}
|
||||
// 其他情况显示所有
|
||||
return item?.counterparty_type === 'Supplier';
|
||||
// 支出时显示外部单位
|
||||
return item?.counterparty_type !== 'InternalCompany';
|
||||
})
|
||||
.map((item: any) => ({
|
||||
label: item?.counterparty,
|
||||
@ -855,12 +900,12 @@ export default function Index({ title = '新增合同' }) {
|
||||
fieldProps: {
|
||||
options: contractData?.peoples
|
||||
?.filter((item: any) => {
|
||||
// 当收入类型为Income时,只显示内部公司
|
||||
// 当支出类型为Expense时,只显示内部企业
|
||||
if (contractData?.income_expense_type === 'Expense') {
|
||||
return item?.counterparty_type === 'InternalCompany';
|
||||
}
|
||||
// 其他情况显示所有
|
||||
return item?.counterparty_type === 'Supplier';
|
||||
// 收入时显示外部单位
|
||||
return item?.counterparty_type !== 'InternalCompany';
|
||||
})
|
||||
.map((item: any) => ({
|
||||
label: item?.counterparty,
|
||||
|
||||
@ -35,7 +35,7 @@ export default function Index({ title = '编辑合同' }) {
|
||||
const [submitModalVisible, setSubmitModalVisible] = useState<boolean>(false);
|
||||
const [currentStep, setCurrentStep] = useState<number>(0);
|
||||
const [contractData, setContractData] = useState<any>({});
|
||||
// const [billsData, setBillsData] = useState<any[]>([]);
|
||||
const [billsData, setBillsData] = useState<any[]>([]);
|
||||
|
||||
const loadShow = () => {
|
||||
Apis.Contract.Contracts.Show({ id: Number(id) }).then((res) => {
|
||||
@ -44,8 +44,8 @@ export default function Index({ title = '编辑合同' }) {
|
||||
setContractData(contractData);
|
||||
setSelectedRow(res?.data?.resource);
|
||||
// 提取账单数据
|
||||
// const bills = contractData?.contract_bills || [];
|
||||
// setBillsData(bills);
|
||||
const bills = contractData?.contract_bills || [];
|
||||
setBillsData(bills);
|
||||
form2.setFieldsValue({
|
||||
...contractData,
|
||||
payee: res?.data?.contract_bills?.[0]?.payee,
|
||||
@ -76,9 +76,9 @@ export default function Index({ title = '编辑合同' }) {
|
||||
}, [id]);
|
||||
|
||||
const onSave = (formData: any, subType: number = 1) => {
|
||||
// formData?.peoples?.forEach((res: any) => {
|
||||
// res.company_suppliers_id = res?.counterparty?.split(':')?.[0];
|
||||
// });
|
||||
formData?.peoples?.forEach((res: any) => {
|
||||
res.company_suppliers_id = res?.counterparty?.split(':')?.[0];
|
||||
});
|
||||
const contractDataToSave = {
|
||||
...formData,
|
||||
is_deposit:
|
||||
@ -336,10 +336,10 @@ export default function Index({ title = '编辑合同' }) {
|
||||
onClick={() => {
|
||||
// 先保存合同,然后显示提审弹窗
|
||||
const values = form.getFieldsValue();
|
||||
// values?.peoples?.forEach((res: any) => {
|
||||
// res.company_suppliers_id =
|
||||
// res?.counterparty?.split(':')?.[0];
|
||||
// });
|
||||
values?.peoples?.forEach((res: any) => {
|
||||
res.company_suppliers_id =
|
||||
res?.counterparty?.split(':')?.[0];
|
||||
});
|
||||
form?.validateFields().then(() => {
|
||||
Apis.Contract.Contracts.Update({
|
||||
...values,
|
||||
@ -662,11 +662,11 @@ export default function Index({ title = '编辑合同' }) {
|
||||
buttonStyle: 'solid',
|
||||
},
|
||||
}),
|
||||
MyFormItems.EnumRadio({
|
||||
MyFormItems.EnumSelect({
|
||||
key: 'counterparty_type',
|
||||
title: '',
|
||||
valueEnum: CompanySuppliersCounterpartyEnum,
|
||||
colProps: { span: 7 },
|
||||
colProps: { span: 6 },
|
||||
formItemProps: {
|
||||
...rulesHelper.text,
|
||||
wrapperCol: { span: 24 },
|
||||
@ -691,7 +691,7 @@ export default function Index({ title = '编辑合同' }) {
|
||||
params: {
|
||||
counterparty: 'Supplier',
|
||||
},
|
||||
colProps: { span: 10 },
|
||||
colProps: { span: 12 },
|
||||
formItemProps: {
|
||||
...rulesHelper.text,
|
||||
wrapperCol: { span: 24 },
|
||||
@ -710,14 +710,52 @@ export default function Index({ title = '编辑合同' }) {
|
||||
params: {
|
||||
counterparty: 'InternalCompany',
|
||||
},
|
||||
colProps: { span: 10 },
|
||||
colProps: { span: 12 },
|
||||
formItemProps: {
|
||||
...rulesHelper.text,
|
||||
wrapperCol: { span: 24 },
|
||||
},
|
||||
required: true,
|
||||
fieldProps: {
|
||||
placeholder: '请选择内部公司',
|
||||
placeholder: '请选择内部企业',
|
||||
},
|
||||
}),
|
||||
]
|
||||
: counterparty_type === 'CustomerCompany'
|
||||
? [
|
||||
SelectContract.SupplierName({
|
||||
key: 'counterparty',
|
||||
title: '',
|
||||
params: {
|
||||
counterparty: 'CustomerCompany',
|
||||
},
|
||||
colProps: { span: 12 },
|
||||
formItemProps: {
|
||||
...rulesHelper.text,
|
||||
wrapperCol: { span: 24 },
|
||||
},
|
||||
required: true,
|
||||
fieldProps: {
|
||||
placeholder: '请选择客户单位',
|
||||
},
|
||||
}),
|
||||
]
|
||||
: counterparty_type === 'Other'
|
||||
? [
|
||||
SelectContract.SupplierName({
|
||||
key: 'counterparty',
|
||||
title: '',
|
||||
params: {
|
||||
counterparty: 'Other',
|
||||
},
|
||||
colProps: { span: 12 },
|
||||
formItemProps: {
|
||||
...rulesHelper.text,
|
||||
wrapperCol: { span: 24 },
|
||||
},
|
||||
required: true,
|
||||
fieldProps: {
|
||||
placeholder: '请选择其他',
|
||||
},
|
||||
}),
|
||||
]
|
||||
@ -728,7 +766,7 @@ export default function Index({ title = '编辑合同' }) {
|
||||
params: {
|
||||
counterparty: 'InternalCompany',
|
||||
},
|
||||
colProps: { span: 10 },
|
||||
colProps: { span: 12 },
|
||||
formItemProps: {
|
||||
...rulesHelper.text,
|
||||
wrapperCol: { span: 24 },
|
||||
@ -904,12 +942,12 @@ export default function Index({ title = '编辑合同' }) {
|
||||
fieldProps: {
|
||||
options: contractData?.peoples
|
||||
?.filter((item: any) => {
|
||||
// 当收入类型为Income时,只显示内部公司
|
||||
// 当收入类型为Income时,只显示内部企业
|
||||
if (contractData?.income_expense_type === 'Income') {
|
||||
return item?.counterparty_type === 'InternalCompany';
|
||||
}
|
||||
// 其他情况显示所有
|
||||
return item?.counterparty_type === 'Supplier';
|
||||
// 支出时显示外部单位
|
||||
return item?.counterparty_type !== 'InternalCompany';
|
||||
})
|
||||
.map((item: any) => ({
|
||||
label: item?.counterparty,
|
||||
@ -926,12 +964,12 @@ export default function Index({ title = '编辑合同' }) {
|
||||
fieldProps: {
|
||||
options: contractData?.peoples
|
||||
?.filter((item: any) => {
|
||||
// 当收入类型为Income时,只显示内部公司
|
||||
// 当支出类型为Expense时,只显示内部企业
|
||||
if (contractData?.income_expense_type === 'Expense') {
|
||||
return item?.counterparty_type === 'InternalCompany';
|
||||
}
|
||||
// 其他情况显示所有
|
||||
return item?.counterparty_type === 'Supplier';
|
||||
// 收入时显示外部单位
|
||||
return item?.counterparty_type !== 'InternalCompany';
|
||||
})
|
||||
.map((item: any) => ({
|
||||
label: item?.counterparty,
|
||||
|
||||
@ -37,7 +37,7 @@ export default function Index({ title = '合同详情' }) {
|
||||
},
|
||||
{
|
||||
key: '3',
|
||||
label: '合同标地',
|
||||
label: '合同标的',
|
||||
children: <MyContractBillObjects item={showData} />,
|
||||
},
|
||||
{
|
||||
|
||||
@ -15,7 +15,7 @@ export default function Index(props: MyBetaModalFormProps) {
|
||||
Apis.Contract.ContractBillObjects.List,
|
||||
)
|
||||
}
|
||||
headerTitle="合同标地"
|
||||
headerTitle="合同标的"
|
||||
search={false}
|
||||
columns={[
|
||||
MyColumns.ID({
|
||||
|
||||
@ -29,7 +29,7 @@ export default function Index({ title = '合同详情' }) {
|
||||
},
|
||||
{
|
||||
key: '3',
|
||||
label: '合同标地',
|
||||
label: '合同标的',
|
||||
children: <MyContractBillObjects item={showData} />,
|
||||
},
|
||||
{
|
||||
|
||||
@ -15,7 +15,7 @@ export default function Index(props: MyBetaModalFormProps) {
|
||||
Apis.Contract.ContractBillObjects.List,
|
||||
)
|
||||
}
|
||||
headerTitle="合同标地"
|
||||
headerTitle="合同标的"
|
||||
search={false}
|
||||
columns={[
|
||||
MyColumns.ID({
|
||||
|
||||
@ -142,20 +142,20 @@ export default function CommonMeter({ title = '公摊表' }) {
|
||||
// search: { transform: (value) => ({ project_name: value }) }
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '房屋',
|
||||
render: (_, item: any) => {
|
||||
return (
|
||||
<Space>
|
||||
{item.house_meter_has_houses?.map(
|
||||
(res: { full_name: string }) => {
|
||||
return res?.full_name;
|
||||
},
|
||||
)}
|
||||
</Space>
|
||||
);
|
||||
},
|
||||
},
|
||||
// {
|
||||
// title: '房屋',
|
||||
// render: (_, item: any) => {
|
||||
// return (
|
||||
// <Space>
|
||||
// {item.house_meter_has_houses?.map(
|
||||
// (res: { full_name: string }) => {
|
||||
// return res?.full_name;
|
||||
// },
|
||||
// )}
|
||||
// </Space>
|
||||
// );
|
||||
// },
|
||||
// },
|
||||
{
|
||||
title: '仪表编号',
|
||||
dataIndex: 'name',
|
||||
|
||||
@ -12,16 +12,16 @@ import {
|
||||
EmergencyEventsStatusEnum,
|
||||
} from '@/gen/Enums';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import { useNavigate } from '@umijs/max';
|
||||
import { Space } from 'antd';
|
||||
import CategoriesModal from './modals/CategoriesModal';
|
||||
import EventApplyClose from './modals/EventApplyClose';
|
||||
import EventCreate from './modals/EventCreate';
|
||||
import EventReview from './modals/EventReview';
|
||||
import EventUpdate from './modals/EventUpdate';
|
||||
import LevelsModal from './modals/LevelsModal';
|
||||
import TeamsModal from './modals/TeamsModal';
|
||||
|
||||
export default function Index({ title = '突发事件' }) {
|
||||
const navigate = useNavigate();
|
||||
|
||||
return (
|
||||
<MyPageContainer
|
||||
title={title}
|
||||
@ -50,36 +50,9 @@ export default function Index({ title = '突发事件' }) {
|
||||
title={title}
|
||||
/>
|
||||
),
|
||||
teams: (
|
||||
<MyButtons.Default
|
||||
key="Teams"
|
||||
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="级别配置"
|
||||
/>
|
||||
),
|
||||
teams: <TeamsModal key="TeamsModal" />,
|
||||
categories: <CategoriesModal key="CategoriesModal" />,
|
||||
levels: <LevelsModal key="LevelsModal" />,
|
||||
}}
|
||||
/>,
|
||||
]}
|
||||
|
||||
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 {
|
||||
MyButtons,
|
||||
MyColumns,
|
||||
MyPageContainer,
|
||||
MyProTableProps,
|
||||
} from '@/common';
|
||||
import { MyButtons, MyColumns, MyProTableProps } from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import { Space } from 'antd';
|
||||
@ -12,83 +7,76 @@ import Update from '../modals/TeamUpdate';
|
||||
|
||||
export default function Index({ title = '应急小组' }) {
|
||||
return (
|
||||
<MyPageContainer
|
||||
title={title}
|
||||
enableTabs={true}
|
||||
tabKey="emergency_events_teams"
|
||||
tabLabel={title}
|
||||
>
|
||||
<ProTable
|
||||
{...MyProTableProps.props}
|
||||
request={async (params, sort) =>
|
||||
MyProTableProps.request(
|
||||
params,
|
||||
sort,
|
||||
Apis.Emergency.EmergencyEventTeams.List,
|
||||
)
|
||||
}
|
||||
headerTitle="应急小组"
|
||||
toolBarRender={(action) => [
|
||||
<Create key="Create" reload={action?.reload} title="应急小组" />,
|
||||
]}
|
||||
columns={[
|
||||
MyColumns.ID({
|
||||
search: false,
|
||||
}),
|
||||
{
|
||||
title: '项目',
|
||||
dataIndex: ['asset_project', 'name'],
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '名称',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
{
|
||||
title: '队长',
|
||||
dataIndex: ['company_employee', 'name'],
|
||||
search: false,
|
||||
},
|
||||
MyColumns.Boolean({
|
||||
title: '是否启用',
|
||||
dataIndex: 'is_enabled',
|
||||
search: false,
|
||||
}),
|
||||
{
|
||||
title: '成员',
|
||||
search: false,
|
||||
render: (_, item: any) => {
|
||||
return (
|
||||
<Space>
|
||||
{item?.emergency_team_members?.map(
|
||||
(res: any, index: number) => {
|
||||
return (
|
||||
<div key={`item_${index}`}>{res?.employee_name}</div>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</Space>
|
||||
);
|
||||
},
|
||||
},
|
||||
MyColumns.UpdatedAt(),
|
||||
MyColumns.CreatedAt(),
|
||||
MyColumns.Option({
|
||||
render: (_, item: any, index, action) => (
|
||||
<Space key={index}>
|
||||
<Update item={item} reload={action?.reload} title={title} />
|
||||
<MyButtons.Delete
|
||||
onConfirm={() =>
|
||||
Apis.Emergency.EmergencyEventTeams.Delete({
|
||||
id: item.id,
|
||||
}).then(() => action?.reload())
|
||||
}
|
||||
/>
|
||||
<ProTable
|
||||
{...MyProTableProps.props}
|
||||
request={async (params, sort) =>
|
||||
MyProTableProps.request(
|
||||
params,
|
||||
sort,
|
||||
Apis.Emergency.EmergencyEventTeams.List,
|
||||
)
|
||||
}
|
||||
headerTitle="应急小组"
|
||||
toolBarRender={(action) => [
|
||||
<Create key="Create" reload={action?.reload} title="应急小组" />,
|
||||
]}
|
||||
columns={[
|
||||
MyColumns.ID({
|
||||
search: false,
|
||||
}),
|
||||
{
|
||||
title: '项目',
|
||||
dataIndex: ['asset_project', 'name'],
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '名称',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
{
|
||||
title: '队长',
|
||||
dataIndex: ['company_employee', 'name'],
|
||||
search: false,
|
||||
},
|
||||
MyColumns.Boolean({
|
||||
title: '是否启用',
|
||||
dataIndex: 'is_enabled',
|
||||
search: false,
|
||||
}),
|
||||
{
|
||||
title: '成员',
|
||||
search: false,
|
||||
render: (_, item: any) => {
|
||||
return (
|
||||
<Space>
|
||||
{item?.emergency_team_members?.map(
|
||||
(res: any, index: number) => {
|
||||
return (
|
||||
<div key={`item_${index}`}>{res?.employee_name}</div>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</Space>
|
||||
),
|
||||
}),
|
||||
]}
|
||||
/>
|
||||
</MyPageContainer>
|
||||
);
|
||||
},
|
||||
},
|
||||
MyColumns.UpdatedAt(),
|
||||
MyColumns.CreatedAt(),
|
||||
MyColumns.Option({
|
||||
render: (_, item: any, index, action) => (
|
||||
<Space key={index}>
|
||||
<Update item={item} reload={action?.reload} title={title} />
|
||||
<MyButtons.Delete
|
||||
onConfirm={() =>
|
||||
Apis.Emergency.EmergencyEventTeams.Delete({
|
||||
id: item.id,
|
||||
}).then(() => action?.reload())
|
||||
}
|
||||
/>
|
||||
</Space>
|
||||
),
|
||||
}),
|
||||
]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@ -2,12 +2,10 @@ import { MyButtons, MyColumns, MyProTableProps } from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { RenovationAppliesStatusEnum } from '@/gen/Enums';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import { useNavigate } from '@umijs/max';
|
||||
import { Space } from 'antd';
|
||||
import Review from '../modals/Review';
|
||||
|
||||
export default function Index() {
|
||||
const navigate = useNavigate();
|
||||
|
||||
return (
|
||||
<ProTable<Record<any, any>>
|
||||
{...MyProTableProps.props}
|
||||
@ -74,16 +72,12 @@ export default function Index() {
|
||||
},
|
||||
MyColumns.CreatedAt(),
|
||||
MyColumns.Option({
|
||||
render: (_, item: any, index) => (
|
||||
render: (_, item: any, index, action) => (
|
||||
<Space key={index}>
|
||||
<MyButtons.Default
|
||||
key="Update"
|
||||
size="small"
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
navigate(`/quality/renovation/pages/review?id=${item.id}`);
|
||||
}}
|
||||
title="查看并审核"
|
||||
<Review
|
||||
key="Review"
|
||||
item={item}
|
||||
reload={action?.reload}
|
||||
/>
|
||||
</Space>
|
||||
),
|
||||
|
||||
@ -178,6 +178,44 @@ export default function Info(props: MyBetaModalFormProps) {
|
||||
</>
|
||||
)}
|
||||
|
||||
{props?.item?.major_construction?.length > 0 && (
|
||||
<ProCard bordered title="重大施工项目" style={{ marginTop: 16 }}>
|
||||
{props.item.major_construction.map(
|
||||
(item: any, index: number, arr: any[]) => (
|
||||
<div
|
||||
key={index}
|
||||
style={{
|
||||
marginBottom:
|
||||
index < arr.length - 1 ? 16 : 0,
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{ fontWeight: 'bold', marginBottom: 8 }}
|
||||
>
|
||||
项目 {index + 1}:{item.name || '-'}
|
||||
</div>
|
||||
<ProDescriptions column={3}>
|
||||
<ProDescriptions.Item label="施工图纸">
|
||||
{item.draw ? '已上传' : '-'}
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="执业证件">
|
||||
{item.certificate ? '已上传' : '-'}
|
||||
</ProDescriptions.Item>
|
||||
</ProDescriptions>
|
||||
{index < arr.length - 1 && (
|
||||
<div
|
||||
style={{
|
||||
borderBottom: '1px solid #f0f0f0',
|
||||
margin: '16px 0',
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
),
|
||||
)}
|
||||
</ProCard>
|
||||
)}
|
||||
|
||||
<ProCard bordered title="其他附件" style={{ marginTop: 16 }}>
|
||||
<ProDescriptions column={3}>
|
||||
<ProDescriptions.Item label="施工图">
|
||||
|
||||
@ -16,8 +16,10 @@ import { PlusOutlined } from '@ant-design/icons';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import { useNavigate } from '@umijs/max';
|
||||
import { Space } from 'antd';
|
||||
import AuditModal from './modals/AuditModal';
|
||||
import DepositPay from './modals/DepositPay';
|
||||
import DepositRefund from './modals/DepositRefund';
|
||||
import InspectionRulesModal from './modals/InspectionRulesModal';
|
||||
import MyWorkerCreate from './modals/WorkerCreate';
|
||||
|
||||
export default function Index({ title = '装修管理' }) {
|
||||
@ -56,26 +58,8 @@ export default function Index({ title = '装修管理' }) {
|
||||
title="装修申请"
|
||||
/>
|
||||
),
|
||||
rules: (
|
||||
<MyButtons.Default
|
||||
key="InspectionRules"
|
||||
size="middle"
|
||||
onClick={() => {
|
||||
navigate('/quality/renovation/inspection_rules');
|
||||
}}
|
||||
title="巡检配置"
|
||||
/>
|
||||
),
|
||||
audit: (
|
||||
<MyButtons.Default
|
||||
key="Audit"
|
||||
size="middle"
|
||||
onClick={() => {
|
||||
navigate('/quality/renovation/audit');
|
||||
}}
|
||||
title="资料审核"
|
||||
/>
|
||||
),
|
||||
rules: <InspectionRulesModal key="InspectionRulesModal" />,
|
||||
audit: <AuditModal key="AuditModal" />,
|
||||
}}
|
||||
/>,
|
||||
]}
|
||||
|
||||
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>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@ -8,7 +8,6 @@ import {
|
||||
import { Selects } from '@/components/Select';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { BetaSchemaForm } from '@ant-design/pro-components';
|
||||
import { useNavigate } from '@umijs/max';
|
||||
import { Form, message } from 'antd';
|
||||
|
||||
const DormigoryBedAuditFlowsAuditStatusEnum = {
|
||||
@ -17,7 +16,6 @@ const DormigoryBedAuditFlowsAuditStatusEnum = {
|
||||
};
|
||||
export default function Update(props: MyBetaModalFormProps) {
|
||||
const [form] = Form.useForm();
|
||||
const navigate = useNavigate();
|
||||
return (
|
||||
<BetaSchemaForm<ApiTypes.Renovation.RenovationApplies.Audit>
|
||||
{...MyModalFormProps.props}
|
||||
@ -39,7 +37,7 @@ export default function Update(props: MyBetaModalFormProps) {
|
||||
})
|
||||
.then(() => {
|
||||
message.success('审核成功');
|
||||
navigate(-1);
|
||||
props.reload?.();
|
||||
return true;
|
||||
})
|
||||
.catch(() => false)
|
||||
@ -55,8 +53,8 @@ export default function Update(props: MyBetaModalFormProps) {
|
||||
{
|
||||
valueType: 'dependency',
|
||||
name: ['status'],
|
||||
columns: ({ audit_status }) => {
|
||||
return audit_status === 'Rejected'
|
||||
columns: ({ status }) => {
|
||||
return status === 'Rejected'
|
||||
? [
|
||||
{
|
||||
title: '驳回理由',
|
||||
@ -92,10 +90,14 @@ export default function Update(props: MyBetaModalFormProps) {
|
||||
min: 1,
|
||||
},
|
||||
},
|
||||
Selects?.ProjectReceiptAccountsSelect({
|
||||
Selects?.ProjectAccounts({
|
||||
key: 'receipt_accounts_id',
|
||||
title: '选择收款账户',
|
||||
colProps: { span: 12 },
|
||||
params: {
|
||||
asset_projects_id:
|
||||
props.item?.asset_projects_id,
|
||||
},
|
||||
formItemProps: { ...rulesHelper.number },
|
||||
fieldProps: {
|
||||
showSearch: true,
|
||||
|
||||
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>
|
||||
</>
|
||||
);
|
||||
}
|
||||
60
src/pages/quality/renovation/modals/Review.tsx
Normal file
60
src/pages/quality/renovation/modals/Review.tsx
Normal file
@ -0,0 +1,60 @@
|
||||
import { MyBetaModalFormProps, MyButtons } from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { Modal } from 'antd';
|
||||
import { useEffect, useState } from 'react';
|
||||
import MyInfo from '../components/info';
|
||||
import AuditReview from './AuditReview';
|
||||
|
||||
export default function Review(props: MyBetaModalFormProps) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const [data, setData] = useState<any>({});
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (open && props.item?.id) {
|
||||
setLoading(true);
|
||||
Apis.Renovation.RenovationApplies.Show({ id: Number(props.item.id) })
|
||||
.then((res) => {
|
||||
setData(res?.data || {});
|
||||
})
|
||||
.finally(() => {
|
||||
setLoading(false);
|
||||
});
|
||||
}
|
||||
}, [open, props.item?.id]);
|
||||
|
||||
const handleAuditSuccess = () => {
|
||||
props.reload?.();
|
||||
setOpen(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<MyButtons.Default
|
||||
type="primary"
|
||||
size="small"
|
||||
title="审核"
|
||||
onClick={() => setOpen(true)}
|
||||
/>
|
||||
<Modal
|
||||
title="装修申请审核"
|
||||
open={open}
|
||||
onCancel={() => setOpen(false)}
|
||||
width={1000}
|
||||
footer={
|
||||
<div style={{ display: 'flex', justifyContent: 'flex-end', gap: 8 }}>
|
||||
<MyButtons.Default
|
||||
size="middle"
|
||||
title="关闭"
|
||||
onClick={() => setOpen(false)}
|
||||
/>
|
||||
<AuditReview item={data} reload={handleAuditSuccess} title="审核" />
|
||||
</div>
|
||||
}
|
||||
destroyOnClose
|
||||
>
|
||||
<MyInfo item={{ ...data, loading }} />
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@ -325,13 +325,13 @@ export default function Index({ title = '新装修申请' }) {
|
||||
{
|
||||
title: '公司负责人姓名',
|
||||
key: 'company_principal_name',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
// formItemProps: { ...rulesHelper.text },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
title: '公司负责人手机',
|
||||
key: 'company_principal_phone',
|
||||
formItemProps: { ...rulesHelper.phone },
|
||||
// formItemProps: { ...rulesHelper.phone },
|
||||
colProps: { span: 6 },
|
||||
fieldProps: {
|
||||
maxLength: 11,
|
||||
|
||||
@ -1,539 +0,0 @@
|
||||
import {
|
||||
MyFormItems,
|
||||
MyModalFormProps,
|
||||
MyPageContainer,
|
||||
rulesHelper,
|
||||
} from '@/common';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import {
|
||||
HouseOccupantsCardTypeEnum,
|
||||
RenovationAppliesProcessTypeEnum,
|
||||
RenovationAppliesRenovationContentEnum,
|
||||
RenovationAppliesTypeEnum,
|
||||
} from '@/gen/Enums';
|
||||
import { BetaSchemaForm, ProCard } from '@ant-design/pro-components';
|
||||
import { useNavigate, useSearchParams } from '@umijs/max';
|
||||
import { Form, Space } from 'antd';
|
||||
import { useEffect, useState } from 'react';
|
||||
import Review from '../modals/AuditReview';
|
||||
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 [getSelectHouse, setSelectHouse] = useState<any>({});
|
||||
|
||||
const loadShow = () => {
|
||||
Apis.Renovation.RenovationApplies.Show({ id: Number(id) }).then((res) => {
|
||||
setShow(res?.data);
|
||||
setSelectHouse(res?.data?.asset_house);
|
||||
form.setFieldsValue(res?.data); // 编辑赋值
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
loadShow();
|
||||
}, [id]);
|
||||
|
||||
return (
|
||||
<MyPageContainer
|
||||
title={
|
||||
<Space
|
||||
style={{ cursor: 'pointer' }}
|
||||
onClick={() => {
|
||||
navigate(-1);
|
||||
}}
|
||||
>
|
||||
{/* <LeftCircleOutlined size={34} /> */}
|
||||
{title}
|
||||
</Space>
|
||||
}
|
||||
enableTabs={false}
|
||||
tabKey="renovation_applies-review"
|
||||
tabLabel={title}
|
||||
>
|
||||
<ProCard>
|
||||
<div style={{ width: 900, minHeight: '83vh', margin: '0 auto' }}>
|
||||
<BetaSchemaForm<ApiTypes.Renovation.RenovationApplies.Update>
|
||||
{...MyModalFormProps.props}
|
||||
title={title}
|
||||
// 基础表单
|
||||
layoutType="Form"
|
||||
labelCol={{ span: 24 }}
|
||||
wrapperCol={{ span: 24 }}
|
||||
labelAlign="left"
|
||||
width="900px"
|
||||
form={form}
|
||||
submitter={{
|
||||
render: () => {
|
||||
return [<Review item={data} key="review" />];
|
||||
},
|
||||
}}
|
||||
columns={[
|
||||
{
|
||||
colProps: { span: 24 },
|
||||
key: 'asset_houses_id',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
renderFormItem: () => {
|
||||
return (
|
||||
<ProCard bordered title="房屋信息">
|
||||
<div>{getSelectHouse?.full_name}</div>
|
||||
</ProCard>
|
||||
);
|
||||
},
|
||||
},
|
||||
MyFormItems.EnumRadio({
|
||||
key: 'type',
|
||||
title: '装修类型',
|
||||
valueEnum: RenovationAppliesTypeEnum,
|
||||
colProps: { span: 6 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
}),
|
||||
MyFormItems.EnumRadio({
|
||||
key: 'process_type',
|
||||
title: '办理类型',
|
||||
valueEnum: RenovationAppliesProcessTypeEnum,
|
||||
colProps: { span: 6 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
}),
|
||||
{
|
||||
title: '是否有保证金',
|
||||
colProps: { span: 6 },
|
||||
key: 'is_deposit',
|
||||
valueType: 'switch',
|
||||
},
|
||||
|
||||
{
|
||||
valueType: 'dependency',
|
||||
name: ['is_deposit'],
|
||||
columns: ({ is_deposit }) => {
|
||||
return is_deposit
|
||||
? [
|
||||
{
|
||||
title: '保证金金额',
|
||||
colProps: { span: 6 },
|
||||
key: 'deposit_amount',
|
||||
valueType: 'digit',
|
||||
formItemProps: { ...rulesHelper.number },
|
||||
fieldProps: {
|
||||
style: {
|
||||
width: '100%',
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
: [];
|
||||
},
|
||||
},
|
||||
{
|
||||
valueType: 'divider',
|
||||
fieldProps: {
|
||||
orientation: 'left',
|
||||
children: '业主信息',
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '业主姓名',
|
||||
key: 'owner_name',
|
||||
colProps: { span: 6 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
title: '业主手机',
|
||||
key: 'owner_phone',
|
||||
colProps: { span: 6 },
|
||||
fieldProps: {
|
||||
maxLength: 11,
|
||||
},
|
||||
formItemProps: { ...rulesHelper.phone },
|
||||
},
|
||||
MyFormItems.EnumSelect({
|
||||
key: 'card_type',
|
||||
title: '证件类型',
|
||||
valueEnum: HouseOccupantsCardTypeEnum,
|
||||
colProps: { span: 6 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
}),
|
||||
{
|
||||
title: '证件号码',
|
||||
key: 'owner_id_card',
|
||||
colProps: { span: 6 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
fieldProps: {
|
||||
maxLength: 18,
|
||||
},
|
||||
},
|
||||
MyFormItems.UploadImages({
|
||||
key: 'id_card_front',
|
||||
title: '证件正面',
|
||||
max: 1,
|
||||
colProps: { span: 6 },
|
||||
formItemProps: { ...rulesHelper.array },
|
||||
}),
|
||||
MyFormItems.UploadImages({
|
||||
key: 'id_card_back',
|
||||
title: '证件反面',
|
||||
max: 1,
|
||||
colProps: { span: 6 },
|
||||
formItemProps: { ...rulesHelper.array },
|
||||
}),
|
||||
MyFormItems.UploadImages({
|
||||
key: 'property_certificate',
|
||||
title: '房产证明',
|
||||
max: 1,
|
||||
colProps: { span: 8 },
|
||||
formItemProps: { ...rulesHelper.array },
|
||||
}),
|
||||
{
|
||||
valueType: 'dependency',
|
||||
name: ['process_type'],
|
||||
columns: ({ process_type }) => {
|
||||
return process_type === 'AgentProcess'
|
||||
? [
|
||||
{
|
||||
valueType: 'divider',
|
||||
fieldProps: {
|
||||
orientation: 'left',
|
||||
children: '代理人信息',
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '代理人名称',
|
||||
key: 'agent_name',
|
||||
colProps: { span: 6 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
title: '代理人手机',
|
||||
key: 'agent_phone',
|
||||
colProps: { span: 6 },
|
||||
fieldProps: {
|
||||
maxLength: 11,
|
||||
},
|
||||
formItemProps: { ...rulesHelper.phone },
|
||||
},
|
||||
MyFormItems.EnumSelect({
|
||||
key: 'agent_card_type',
|
||||
title: '证件类型',
|
||||
valueEnum: HouseOccupantsCardTypeEnum,
|
||||
colProps: { span: 6 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
}),
|
||||
{
|
||||
title: '证件号码',
|
||||
key: 'agent_id_card',
|
||||
colProps: { span: 6 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
fieldProps: {
|
||||
maxLength: 18,
|
||||
},
|
||||
},
|
||||
MyFormItems.UploadImages({
|
||||
key: 'agent_id_card_front',
|
||||
title: '证件正面',
|
||||
max: 1,
|
||||
colProps: { span: 6 },
|
||||
}),
|
||||
MyFormItems.UploadImages({
|
||||
key: 'agent_id_card_back',
|
||||
title: '证件反面',
|
||||
max: 1,
|
||||
colProps: { span: 6 },
|
||||
}),
|
||||
MyFormItems.UploadImages({
|
||||
key: 'power_attorney',
|
||||
title: '代理人授权书',
|
||||
max: 1,
|
||||
colProps: { span: 6 },
|
||||
}),
|
||||
]
|
||||
: [];
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
valueType: 'dependency',
|
||||
name: ['type'],
|
||||
columns: ({ type }) => {
|
||||
return type === 'RenovationCompany'
|
||||
? [
|
||||
{
|
||||
valueType: 'divider',
|
||||
fieldProps: {
|
||||
orientation: 'left',
|
||||
children: '装修公司信息',
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '公司名称',
|
||||
key: 'company_name',
|
||||
colProps: { span: 6 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
title: '营业执照号',
|
||||
key: 'company_business_license_num',
|
||||
colProps: { span: 6 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
fieldProps: {
|
||||
maxLength: 18,
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '公司负责人手机',
|
||||
key: 'company_principal_phone',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
title: '负责人手机号',
|
||||
key: 'company_principal_phone',
|
||||
formItemProps: { ...rulesHelper.phone },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
valueType: 'dependency',
|
||||
name: ['type'],
|
||||
columns: ({ type }) => {
|
||||
return type === 'RenovationCompany'
|
||||
? [
|
||||
MyFormItems.UploadImages({
|
||||
key: 'company_business_license',
|
||||
title: '装修公司营业执照',
|
||||
max: 1,
|
||||
colProps: { span: 6 },
|
||||
formItemProps: { ...rulesHelper.array },
|
||||
}),
|
||||
MyFormItems.UploadImages({
|
||||
key: 'company_asset_certificate',
|
||||
title: '装修公司资质证明',
|
||||
max: 1,
|
||||
colProps: { span: 6 },
|
||||
formItemProps: { ...rulesHelper.array },
|
||||
}),
|
||||
MyFormItems.UploadImages({
|
||||
key: 'company_power_attorney',
|
||||
title: '装修公司装修授权书',
|
||||
max: 1,
|
||||
colProps: { span: 6 },
|
||||
formItemProps: { ...rulesHelper.array },
|
||||
}),
|
||||
]
|
||||
: [];
|
||||
},
|
||||
},
|
||||
]
|
||||
: [];
|
||||
},
|
||||
},
|
||||
{
|
||||
valueType: 'divider',
|
||||
fieldProps: {
|
||||
orientation: 'left',
|
||||
children: '施工信息',
|
||||
},
|
||||
},
|
||||
{
|
||||
valueType: 'dependency',
|
||||
name: ['type'],
|
||||
columns: ({ type }) => {
|
||||
return type === 'RenovationCompany'
|
||||
? [
|
||||
{
|
||||
title: '施工负责人名称',
|
||||
key: 'construction_principal_name',
|
||||
colProps: { span: 6 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
{
|
||||
title: '施工负责人手机',
|
||||
key: 'construction_principal_phone',
|
||||
colProps: { span: 6 },
|
||||
formItemProps: { ...rulesHelper.phone },
|
||||
},
|
||||
MyFormItems.EnumSelect({
|
||||
key: 'construction_principal_card_type',
|
||||
title: '证件类型',
|
||||
valueEnum: HouseOccupantsCardTypeEnum,
|
||||
colProps: { span: 6 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
}),
|
||||
{
|
||||
title: '施工负责人证件号',
|
||||
key: 'construction_principal_id_card',
|
||||
colProps: { span: 6 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
fieldProps: {
|
||||
maxLength: 18,
|
||||
},
|
||||
},
|
||||
MyFormItems.UploadImages({
|
||||
key: 'construction_principal_id_card_front',
|
||||
title: '施工负责人身份证正面',
|
||||
max: 1,
|
||||
colProps: { span: 6 },
|
||||
}),
|
||||
MyFormItems.UploadImages({
|
||||
key: 'construction_principal_id_card_back',
|
||||
title: '施工负责人身份证反面',
|
||||
max: 1,
|
||||
colProps: { span: 6 },
|
||||
}),
|
||||
]
|
||||
: [];
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
valueType: 'group',
|
||||
columns: [
|
||||
{
|
||||
title: '施工开始时间',
|
||||
valueType: 'date',
|
||||
key: 'construction_start_date',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
colProps: { span: 6 },
|
||||
fieldProps: {
|
||||
format: 'YYYY-MM-DD',
|
||||
onChange: (value: string, dateString: string) => {
|
||||
form.setFieldValue(
|
||||
'construction_start_date',
|
||||
dateString,
|
||||
);
|
||||
console.log('construction_start_date', value);
|
||||
},
|
||||
style: {
|
||||
width: '100%',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '施工结束时间',
|
||||
valueType: 'date',
|
||||
key: 'construction_end_date',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
colProps: { span: 6 },
|
||||
fieldProps: {
|
||||
format: 'YYYY-MM-DD',
|
||||
onChange: (value: string, dateString: string) => {
|
||||
form.setFieldValue('construction_end_date', dateString);
|
||||
console.log('construction_end_date', value);
|
||||
},
|
||||
style: {
|
||||
width: '100%',
|
||||
},
|
||||
},
|
||||
},
|
||||
MyFormItems.EnumRadio({
|
||||
key: 'renovation_content',
|
||||
title: '装修内容',
|
||||
valueEnum: RenovationAppliesRenovationContentEnum,
|
||||
colProps: { span: 12 },
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
}),
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
valueType: 'divider',
|
||||
fieldProps: {
|
||||
orientation: 'left',
|
||||
children: '其他附件',
|
||||
},
|
||||
},
|
||||
MyFormItems.UploadImages({
|
||||
key: 'construction_draw',
|
||||
title: '施工图',
|
||||
uploadType: 'file',
|
||||
max: 1,
|
||||
colProps: { span: 6 },
|
||||
}),
|
||||
MyFormItems.UploadImages({
|
||||
key: 'construction_commitment_letter',
|
||||
title: '施工承诺书',
|
||||
uploadType: 'file',
|
||||
max: 1,
|
||||
colProps: { span: 6 },
|
||||
}),
|
||||
MyFormItems.UploadImages({
|
||||
key: 'other_attachments',
|
||||
title: '其他补充附件',
|
||||
max: 100,
|
||||
uploadType: 'file',
|
||||
colProps: { span: 6 },
|
||||
}),
|
||||
{
|
||||
valueType: 'divider',
|
||||
fieldProps: {
|
||||
orientation: 'left',
|
||||
children: '重大施工项目',
|
||||
},
|
||||
},
|
||||
{
|
||||
valueType: 'formList',
|
||||
dataIndex: 'major_construction',
|
||||
// title: '重大施工项目',
|
||||
fieldProps: {
|
||||
copyIconProps: false,
|
||||
// deleteIconProps: false,
|
||||
},
|
||||
formItemProps: {
|
||||
...rulesHelper.array,
|
||||
wrapperCol: { span: 24 },
|
||||
},
|
||||
initialValue: [
|
||||
{
|
||||
sign_party: null,
|
||||
counterparty_type: null,
|
||||
counterparty: null,
|
||||
},
|
||||
{
|
||||
sign_party: null,
|
||||
counterparty_type: null,
|
||||
counterparty: null,
|
||||
},
|
||||
],
|
||||
columns: [
|
||||
{
|
||||
valueType: 'group',
|
||||
title: '',
|
||||
colProps: { span: 24 },
|
||||
columns: [
|
||||
{
|
||||
title: '重大施工内容',
|
||||
key: 'name',
|
||||
colProps: { span: 12 },
|
||||
// formItemProps: { ...rulesHelper.text },
|
||||
},
|
||||
MyFormItems.UploadImages({
|
||||
key: 'draw',
|
||||
title: '施工图纸',
|
||||
uploadType: 'file',
|
||||
max: 1,
|
||||
colProps: { span: 6 },
|
||||
}),
|
||||
MyFormItems.UploadImages({
|
||||
key: 'certificate',
|
||||
title: '执业证件',
|
||||
uploadType: 'file',
|
||||
max: 1,
|
||||
colProps: { span: 6 },
|
||||
}),
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
key: 'renovation_remark',
|
||||
valueType: 'textarea',
|
||||
colProps: { span: 24 },
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
</ProCard>
|
||||
</MyPageContainer>
|
||||
);
|
||||
}
|
||||
@ -447,13 +447,13 @@ export default function Index({ title = '编辑新装修申请' }) {
|
||||
{
|
||||
title: '公司负责人姓名',
|
||||
key: 'company_principal_name',
|
||||
formItemProps: { ...rulesHelper.text },
|
||||
// formItemProps: { ...rulesHelper.text },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
title: '公司负责人手机',
|
||||
key: 'company_principal_phone',
|
||||
formItemProps: { ...rulesHelper.phone },
|
||||
// formItemProps: { ...rulesHelper.phone },
|
||||
colProps: { span: 6 },
|
||||
fieldProps: {
|
||||
maxLength: 11,
|
||||
|
||||
@ -15,7 +15,6 @@ export default function SurveysListShow(props: MyBetaModalFormProps) {
|
||||
title={props.title || '查看问卷'}
|
||||
type={props.item?.type || 'primary'}
|
||||
width="800px"
|
||||
trigger={props?.trigger}
|
||||
onOpen={() => {
|
||||
if (props?.item?.id) {
|
||||
setLoading(true);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user