Renxy 1 рік тому
батько
коміт
eabe362ffb

+ 1 - 1
src/pages/PurchaseAdmin/PurchaseList/Approval/ManufacturerModal.js

@@ -30,7 +30,7 @@ function FirmModal(props) {
   } = props;
   const [formRef] = Form.useForm();
   const [type, setType] = useState(item?.type || 1);
-  console.log(type);
+  // console.log(type);
   const handleOnOk = async () => {
     formRef
       .validateFields()

+ 52 - 20
src/pages/PurchaseAdmin/PurchaseList/Approval/ProjectRecordModal.js

@@ -1,8 +1,26 @@
 import { Button, DatePicker, Form, Modal, Table, TreeSelect } from 'antd';
 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 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 = [
     {
       title: '提交人',
@@ -24,22 +42,28 @@ const ProjectRecordModal = ({ visible, depUserTree, onOk, onClose }) => {
       dataIndex: 'time',
       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 (
     <Modal
       title="日志详情"
@@ -55,7 +79,6 @@ const ProjectRecordModal = ({ visible, depUserTree, onOk, onClose }) => {
         width="100%"
         layout="inline"
         style={{ marginBottom: 20 }}
-        form={form}
       >
         <Form.Item label="提交人:">
           <TreeSelect
@@ -64,6 +87,7 @@ const ProjectRecordModal = ({ visible, depUserTree, onOk, onClose }) => {
             style={{ width: 240 }}
             placeholder="请选择提交人"
             multiple={false}
+            onChange={onAuthorChange}
             treeData={depUserTree}
             filterTreeNode={(input, option) => {
               return option.props.title === input;
@@ -71,13 +95,21 @@ const ProjectRecordModal = ({ visible, depUserTree, onOk, onClose }) => {
           />
         </Form.Item>
         <Form.Item label="时间:">
-          <RangePicker style={{ width: 240 }} />
+          <RangePicker style={{ width: 240 }} onChange={onDateChange} />
         </Form.Item>
         <Form.Item wrapperCol={{ span: 10, offset: 14 }}>
-          <Button type="primary">查询</Button>
+          <Button type="primary" onClick={() => run(searchData)}>
+            查询
+          </Button>
         </Form.Item>
       </Form>
-      <Table columns={columns} dataSource={dataSource} />
+      <Table
+        loading={loading}
+        columns={columns}
+        dataSource={data?.list}
+        onChange={handleTableChange}
+        pagination={data?.pagination}
+      />
     </Modal>
   );
 };

+ 10 - 10
src/pages/PurchaseAdmin/PurchaseList/DailyRecord/index.js

@@ -25,7 +25,7 @@ const DailyRecord = props => {
     },
   });
 
-  //添加日志
+  //编辑日志
   const { run: runEdit } = useRequest(approvalEditLog, {
     manual: true,
     onSuccess: () => {
@@ -68,15 +68,15 @@ const DailyRecord = props => {
     },
   ];
 
-  const dataSource = [
-    {
-      name: '管理员',
-      title: '管理员的金科环境项目日志',
-      time: '1993-49-49 22:23:99',
-      doc:
-        '十八大不愧是你打卡是你打八大不愧是你打卡是你打卡机阿萨你打看那看手八大不愧是你打卡是你打卡机阿萨你打看那看手八大不愧是你打卡是你打卡机阿萨你打看那看手八大不愧是你打卡是你打卡机阿萨你打看那看手卡机阿萨你打看那看手打',
-    },
-  ];
+  // const dataSource = [
+  //   {
+  //     name: '管理员',
+  //     title: '管理员的金科环境项目日志',
+  //     time: '1993-49-49 22:23:99',
+  //     doc:
+  //       '十八大不愧是你打卡是你打八大不愧是你打卡是你打卡机阿萨你打看那看手八大不愧是你打卡是你打卡机阿萨你打看那看手八大不愧是你打卡是你打卡机阿萨你打看那看手八大不愧是你打卡是你打卡机阿萨你打看那看手卡机阿萨你打看那看手打',
+  //   },
+  // ];
 
   useEffect(() => {
     dispatch({ type: 'record/queryProject' });

+ 6 - 0
src/services/record.js

@@ -18,3 +18,9 @@ export async function approvalEditLog(params) {
 export async function approvalLogOwnList(params) {
   return request(`/api/v2/approval/log-own/list?${stringify(params)}`);
 }
+
+//项目日志列表
+export async function approvalLogProjectsList(params) {
+  const res = await request(`/api/v2/approval/log-projects/${params.id}?${stringify(params)}`);
+  return res?.data;
+}