147 lines
4.9 KiB
JavaScript
147 lines
4.9 KiB
JavaScript
|
|
import React, { useEffect } from 'react';
|
||
|
|
import { Modal, Form, Input, Select, Switch, Button } from 'antd';
|
||
|
|
import dayjs from 'dayjs';
|
||
|
|
|
||
|
|
const { Option } = Select;
|
||
|
|
const { TextArea } = Input;
|
||
|
|
|
||
|
|
const ProjectDetailForm = ({ visible, project, onCancel, onSave }) => {
|
||
|
|
const [form] = Form.useForm();
|
||
|
|
|
||
|
|
useEffect(() => {
|
||
|
|
if (project && visible) {
|
||
|
|
// 格式化日期字段为字符串
|
||
|
|
const formattedProject = { ...project };
|
||
|
|
['actual_start_time', 'planned_completion_time', 'completion_time', 'next_review_time'].forEach(field => {
|
||
|
|
if (formattedProject[field]) {
|
||
|
|
formattedProject[field] = dayjs(formattedProject[field]).format('YYYY-MM-DD');
|
||
|
|
}
|
||
|
|
});
|
||
|
|
form.setFieldsValue(formattedProject);
|
||
|
|
}
|
||
|
|
}, [form, project, visible]);
|
||
|
|
|
||
|
|
const handleSave = () => {
|
||
|
|
form.validateFields()
|
||
|
|
.then(values => {
|
||
|
|
onSave({ ...project, ...values });
|
||
|
|
})
|
||
|
|
.catch(info => {
|
||
|
|
console.log('验证失败:', info);
|
||
|
|
});
|
||
|
|
};
|
||
|
|
|
||
|
|
return (
|
||
|
|
<Modal
|
||
|
|
title="项目详情"
|
||
|
|
open={visible}
|
||
|
|
width={800}
|
||
|
|
onCancel={onCancel}
|
||
|
|
footer={[
|
||
|
|
<Button key="cancel" onClick={onCancel}>
|
||
|
|
取消
|
||
|
|
</Button>,
|
||
|
|
<Button key="save" type="primary" onClick={handleSave}>
|
||
|
|
保存
|
||
|
|
</Button>
|
||
|
|
]}
|
||
|
|
>
|
||
|
|
<Form
|
||
|
|
form={form}
|
||
|
|
layout="vertical"
|
||
|
|
>
|
||
|
|
<Form.Item label="单位" name="unit">
|
||
|
|
<Input />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="项目编号" name="project_number">
|
||
|
|
<Input />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="安全编码" name="safety_code">
|
||
|
|
<Input />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="大项工程名称" name="major_project_name">
|
||
|
|
<Input />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="单项工程名称" name="sub_project_name">
|
||
|
|
<Input />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="在施工程作业范围" name="construction_scope">
|
||
|
|
<TextArea rows={2} />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="工程规模" name="project_scale">
|
||
|
|
<Input />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="安全总监" name="safety_director">
|
||
|
|
<Input />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="建设单位" name="construction_unit">
|
||
|
|
<Input />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="监理单位" name="supervision_unit">
|
||
|
|
<Input />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="施工单位" name="construction_company">
|
||
|
|
<Input />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="工程位置" name="project_location">
|
||
|
|
<Input />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="实际开工时间" name="actual_start_time">
|
||
|
|
<Input placeholder="YYYY-MM-DD" />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="计划竣工时间" name="planned_completion_time">
|
||
|
|
<Input placeholder="YYYY-MM-DD" />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="完成时间" name="completion_time">
|
||
|
|
<Input placeholder="YYYY-MM-DD" />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="下次梳理时间" name="next_review_time">
|
||
|
|
<Input placeholder="YYYY-MM-DD" />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="参建人数" name="participants_count">
|
||
|
|
<Input type="number" />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="新班组进场数量" name="new_team_count">
|
||
|
|
<Input type="number" />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="新人进场数量" name="new_person_count">
|
||
|
|
<Input type="number" />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="带班人姓名、电话" name="leader_info">
|
||
|
|
<Input />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="下周作业计划" name="next_week_plan">
|
||
|
|
<TextArea rows={2} />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="下周8+2工况内容" name="next_week_condition">
|
||
|
|
<TextArea rows={2} />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="工期是否紧张" name="is_schedule_tight" valuePropName="checked">
|
||
|
|
<Switch />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="是否存在账外事" name="has_off_book_matters" valuePropName="checked">
|
||
|
|
<Switch />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="当前风险等级" name="current_risk_level">
|
||
|
|
<Select>
|
||
|
|
<Option value="高风险">高风险</Option>
|
||
|
|
<Option value="中风险">中风险</Option>
|
||
|
|
<Option value="低风险">低风险</Option>
|
||
|
|
</Select>
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="当前风险判断理由" name="risk_judgment_reason">
|
||
|
|
<TextArea rows={2} />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="隐患提示/工作要求" name="risk_tips">
|
||
|
|
<TextArea rows={2} />
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="备注" name="remarks">
|
||
|
|
<TextArea rows={2} />
|
||
|
|
</Form.Item>
|
||
|
|
</Form>
|
||
|
|
</Modal>
|
||
|
|
);
|
||
|
|
};
|
||
|
|
|
||
|
|
export default ProjectDetailForm;
|