|
@@ -1,8 +1,26 @@
|
|
import { Button, DatePicker, Form, Modal, Table, TreeSelect } from 'antd';
|
|
import { Button, DatePicker, Form, Modal, Table, TreeSelect } from 'antd';
|
|
import styles from './index.less';
|
|
import styles from './index.less';
|
|
|
|
+import { useRequest, useSafeState } from 'ahooks';
|
|
|
|
+import { approvalLogProjectsList } from '@/services/record';
|
|
|
|
+import { useEffect, useState } from 'react';
|
|
|
|
+import moment from 'moment';
|
|
const { RangePicker } = DatePicker;
|
|
const { RangePicker } = DatePicker;
|
|
-const ProjectRecordModal = ({ visible, depUserTree, onOk, onClose }) => {
|
|
|
|
- const [form] = Form.useForm();
|
|
|
|
|
|
+const ProjectRecordModal = ({ visible, currentItem, depUserTree, onOk, onClose }) => {
|
|
|
|
+ const [searchData, setSearchData] = useState({
|
|
|
|
+ author: '',
|
|
|
|
+ s_time: '',
|
|
|
|
+ e_time: '',
|
|
|
|
+ pageSize: 1,
|
|
|
|
+ });
|
|
|
|
+ const { data, run, loading } = useRequest(
|
|
|
|
+ data => approvalLogProjectsList({ ...data, id: currentItem.id }),
|
|
|
|
+ {
|
|
|
|
+ manual: true,
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ useEffect(() => {
|
|
|
|
+ if (visible && currentItem?.id) run({});
|
|
|
|
+ }, [visible, currentItem]);
|
|
const columns = [
|
|
const columns = [
|
|
{
|
|
{
|
|
title: '提交人',
|
|
title: '提交人',
|
|
@@ -24,22 +42,28 @@ const ProjectRecordModal = ({ visible, depUserTree, onOk, onClose }) => {
|
|
dataIndex: 'time',
|
|
dataIndex: 'time',
|
|
width: '20%',
|
|
width: '20%',
|
|
},
|
|
},
|
|
- {
|
|
|
|
- title: '操作',
|
|
|
|
- width: '12%',
|
|
|
|
- render: () => <a>详情</a>,
|
|
|
|
- },
|
|
|
|
|
|
+ // {
|
|
|
|
+ // title: '操作',
|
|
|
|
+ // width: '12%',
|
|
|
|
+ // render: () => <a>详情</a>,
|
|
|
|
+ // },
|
|
];
|
|
];
|
|
|
|
|
|
- const dataSource = [
|
|
|
|
- {
|
|
|
|
- name: '管理员',
|
|
|
|
- title: '管理员的金科环境项目日志',
|
|
|
|
- time: '1993-49-49 22:23:99',
|
|
|
|
- doc:
|
|
|
|
- '十八大不愧是你打卡是你打卡是你打卡机阿萨你打看那看你打卡是你打卡机阿萨你打看那看你打卡机阿萨你打看那看手打',
|
|
|
|
- },
|
|
|
|
- ];
|
|
|
|
|
|
+ const onAuthorChange = ids => {
|
|
|
|
+ const [user_id, dep_id] = ids.split('||');
|
|
|
|
+ setSearchData({ ...searchData, author: user_id });
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ const onDateChange = date => {
|
|
|
|
+ const s_time = moment(date[0]).format('YYYY-MM-DD');
|
|
|
|
+ const e_time = moment(date[1]).format('YYYY-MM-DD');
|
|
|
|
+ setSearchData({ ...searchData, s_time, e_time });
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ const handleTableChange = pagination => {
|
|
|
|
+ setSearchData({ ...searchData, pageSize: pagination.current });
|
|
|
|
+ };
|
|
|
|
+
|
|
return (
|
|
return (
|
|
<Modal
|
|
<Modal
|
|
title="日志详情"
|
|
title="日志详情"
|
|
@@ -55,7 +79,6 @@ const ProjectRecordModal = ({ visible, depUserTree, onOk, onClose }) => {
|
|
width="100%"
|
|
width="100%"
|
|
layout="inline"
|
|
layout="inline"
|
|
style={{ marginBottom: 20 }}
|
|
style={{ marginBottom: 20 }}
|
|
- form={form}
|
|
|
|
>
|
|
>
|
|
<Form.Item label="提交人:">
|
|
<Form.Item label="提交人:">
|
|
<TreeSelect
|
|
<TreeSelect
|
|
@@ -64,6 +87,7 @@ const ProjectRecordModal = ({ visible, depUserTree, onOk, onClose }) => {
|
|
style={{ width: 240 }}
|
|
style={{ width: 240 }}
|
|
placeholder="请选择提交人"
|
|
placeholder="请选择提交人"
|
|
multiple={false}
|
|
multiple={false}
|
|
|
|
+ onChange={onAuthorChange}
|
|
treeData={depUserTree}
|
|
treeData={depUserTree}
|
|
filterTreeNode={(input, option) => {
|
|
filterTreeNode={(input, option) => {
|
|
return option.props.title === input;
|
|
return option.props.title === input;
|
|
@@ -71,13 +95,21 @@ const ProjectRecordModal = ({ visible, depUserTree, onOk, onClose }) => {
|
|
/>
|
|
/>
|
|
</Form.Item>
|
|
</Form.Item>
|
|
<Form.Item label="时间:">
|
|
<Form.Item label="时间:">
|
|
- <RangePicker style={{ width: 240 }} />
|
|
|
|
|
|
+ <RangePicker style={{ width: 240 }} onChange={onDateChange} />
|
|
</Form.Item>
|
|
</Form.Item>
|
|
<Form.Item wrapperCol={{ span: 10, offset: 14 }}>
|
|
<Form.Item wrapperCol={{ span: 10, offset: 14 }}>
|
|
- <Button type="primary">查询</Button>
|
|
|
|
|
|
+ <Button type="primary" onClick={() => run(searchData)}>
|
|
|
|
+ 查询
|
|
|
|
+ </Button>
|
|
</Form.Item>
|
|
</Form.Item>
|
|
</Form>
|
|
</Form>
|
|
- <Table columns={columns} dataSource={dataSource} />
|
|
|
|
|
|
+ <Table
|
|
|
|
+ loading={loading}
|
|
|
|
+ columns={columns}
|
|
|
|
+ dataSource={data?.list}
|
|
|
|
+ onChange={handleTableChange}
|
|
|
|
+ pagination={data?.pagination}
|
|
|
|
+ />
|
|
</Modal>
|
|
</Modal>
|
|
);
|
|
);
|
|
};
|
|
};
|