瀏覽代碼

个人中心

hanxin 2 年之前
父節點
當前提交
f134bd674d
共有 2 個文件被更改,包括 50 次插入21 次删除
  1. 47 20
      src/pages/Profile/index.js
  2. 3 1
      src/services/boom.js

+ 47 - 20
src/pages/Profile/index.js

@@ -1,11 +1,12 @@
 import React, { Fragment, useState, useEffect, useMemo, useRef } from 'react';
 import { useNavigate } from 'umi';
-import { Card, Table, Empty, Button, Modal, message, Form, DatePicker, Row, Col } from 'antd';
+import { Card, Table, Empty, Button, Modal, message, Form, DatePicker, Select } from 'antd';
 import { PageContainer } from '@ant-design/pro-components';
 const { RangePicker } = DatePicker;
 import { useRequest } from '@umijs/max';
 import {
-  queryProfileList
+  queryProfileList,
+  queryApplyList
 } from '@/services/boom'
 import dayjs from 'dayjs';
 function profile(props) {
@@ -18,29 +19,20 @@ function profile(props) {
   const approveFormRef = useRef();
   const applyFormRef = useRef();
   let navigate = useNavigate();
-  const queryProfileListRequest = useRequest(queryProfileList, {
-    // manual: true,
-    onSuccess: data => {
-      console.log(data)
-    }
-  });
+  const queryProfileListRequest = useRequest(queryProfileList, {});
+  const queryApplyListRequest = useRequest(queryApplyList, {});
   const onTabChange = activeKey => {
     setTabActive(activeKey)
   }
   const columns = [
     {
       title: '标题',
-      dataIndex: 'table_name'
-    },
-    {
-
-      title: '摘要',
-      dataIndex: 'table_desc'
+      dataIndex: 'name'
     },
     {
 
       title: '发起人',
-      dataIndex: 'AuthorInfo.CName'
+      render: (record) => record.AuthorInfo.CName
     },
     {
 
@@ -52,8 +44,27 @@ function profile(props) {
     {
 
       title: '流程状态',
-      dataIndex: 'status'
+      render: (record) => {
+        switch (record.audit_status) {
+          case 0: return '审核中'
+          case 1: return '通过'
+          case 2: return '拒绝'
+          case 3: return '终审通过'
+        }
+      }
     },
+    {
+      title: '操作',
+      render: (text, record) => (
+        <Fragment>
+          <>
+            <a style={{ color: "#4096ff" }} onClick={() => {
+              navigate(`/oa/detail/${record.flow_id}/${record.id}`)
+            }}>申请</a>
+          </>
+        </Fragment>
+      ),
+    }
   ]
   const approveColumns = [
     {
@@ -97,6 +108,7 @@ function profile(props) {
   ]
   const handleApplySubmit = (values) => {
     console.log(values);
+    queryApplyListRequest.run(values)
   };
   const handleApproveSubmit = (values) => {
     console.log(values);
@@ -111,8 +123,18 @@ function profile(props) {
         ref={applyFormRef}
       >
         <div style={{ display: 'flex' }}>
-          <Form.Item name="range-picker" label="申请时间:">
-            <RangePicker />
+          <Form.Item name="audit_status" label="状态:">
+            <Select
+              style={{ width: 120 }}
+              defaultValue=''
+              options={[
+                { value: '', label: '全部' },
+                { value: '0', label: '审核中' },
+                { value: '1', label: '通过' },
+                { value: '2', label: '拒绝' },
+                { value: '3', label: '终审通过' },
+              ]}
+            />
           </Form.Item>
           <Form.Item>
             <Button type="primary" htmlType="submit" style={{ marginLeft: 10 }}>
@@ -122,11 +144,14 @@ function profile(props) {
         </div>
         <Table
           columns={columns}
+          dataSource={queryApplyListRequest?.data?.list}
+          pagination={queryApplyListRequest?.data?.pagination}
         />
       </Form>
       </>
     else if (activeKey == '2')
-      return <> <Form
+      return <>
+        {/* <Form
         name="basic"
         // labelCol={{ span: 0 }}
         // wrapperCol={{ span: 24 }}
@@ -143,11 +168,13 @@ function profile(props) {
             </Button>
           </Form.Item>
         </div>
-      </Form>
+      </Form> */}
         <Table
           rowKey='id'
+          loading={queryProfileListRequest.loading}
           columns={approveColumns}
           dataSource={queryProfileListRequest?.data?.list}
+          pagination={queryProfileListRequest?.data?.pagination}
         />
       </>
   }

+ 3 - 1
src/services/boom.js

@@ -176,7 +176,9 @@ export async function queryProfileList() {
   console.log(profileList);
   return profileList;
 }
-
+export async function queryApplyList(params) {
+  return request(`/api/v1/oa/audit/my/list`, { params });
+}
 // /**
 //   project_id
 //   version_id	大版本id