hanxin 2 роки тому
батько
коміт
54de66b18a
5 змінених файлів з 205 додано та 1 видалено
  1. 11 0
      .umirc.ts
  2. 1 1
      src/pages/Home/index.js
  3. 1 0
      src/pages/Home/index.less
  4. 177 0
      src/pages/Profile/index.js
  5. 15 0
      src/services/boom.js

+ 11 - 0
.umirc.ts

@@ -115,6 +115,17 @@ export default defineConfig({
         },
       ],
     },
+    {
+      name: '个人中心',
+      path: '/profile',
+      component: './Profile/index',
+      hideInMenu: true
+    },
+    {
+      name: '供应商管理',
+      path: '/manufacturer',
+      component: './ManufacturerMng/Firm',
+    },
   ],
   npmClient: 'yarn',
 });

+ 1 - 1
src/pages/Home/index.js

@@ -30,7 +30,7 @@ function HomePage(props) {
       name: 'OA审批',
       active: true,
       click: () => {
-
+        navigate("/oa");
       },
       Icon: require('@/assets/UnityMenu/OA.png')
     },

+ 1 - 0
src/pages/Home/index.less

@@ -59,6 +59,7 @@
   width: 292px;
   height: 220px;
   margin-bottom: 64px;
+  user-select: none;
 }
 .pic {
   width: 152px;

+ 177 - 0
src/pages/Profile/index.js

@@ -0,0 +1,177 @@
+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 { PageContainer } from '@ant-design/pro-components';
+const { RangePicker } = DatePicker;
+import { useRequest } from '@umijs/max';
+import {
+  queryProfileList
+} from '@/services/boom'
+import dayjs from 'dayjs';
+function profile(props) {
+  const {
+    submitting,
+    params,
+    dispatch,
+  } = props;
+  const [tabActive, setTabActive] = useState('1');
+  const approveFormRef = useRef();
+  const applyFormRef = useRef();
+  let navigate = useNavigate();
+  const queryProfileListRequest = useRequest(queryProfileList, {
+    // manual: true,
+    onSuccess: data => {
+      console.log(data)
+    }
+  });
+  const onTabChange = activeKey => {
+    setTabActive(activeKey)
+  }
+  const columns = [
+    {
+      title: '标题',
+      dataIndex: 'table_name'
+    },
+    {
+
+      title: '摘要',
+      dataIndex: 'table_desc'
+    },
+    {
+
+      title: '发起人',
+      dataIndex: 'AuthorInfo.CName'
+    },
+    {
+
+      title: '发起时间',
+      render: (record) => {
+        return dayjs(record.create_time).format('YYYY-MM-DD HH:mm:ss')
+      }
+    },
+    {
+
+      title: '流程状态',
+      dataIndex: 'status'
+    },
+  ]
+  const approveColumns = [
+    {
+      title: '标题',
+      dataIndex: 'table_name'
+    },
+    {
+
+      title: '摘要',
+      dataIndex: 'table_desc'
+    },
+    {
+
+      title: '发起人',
+      dataIndex: 'AuthorInfo.CName'
+    },
+    {
+
+      title: '发起时间',
+      render: (record) => {
+        return dayjs(record.create_time).format('YYYY-MM-DD HH:mm:ss')
+      }
+    },
+    {
+
+      title: '流程状态',
+      dataIndex: 'status'
+    },
+    {
+      title: '操作',
+      render: (text, record) => (
+        <Fragment>
+          <>
+            <a style={{ color: "#4096ff" }} onClick={() => {
+              navigate(`/oa/detail/${record.flow_id}/${record.id}`)
+            }}>审批</a>
+          </>
+        </Fragment>
+      ),
+    }
+  ]
+  const handleApplySubmit = (values) => {
+    console.log(values);
+  };
+  const handleApproveSubmit = (values) => {
+    console.log(values);
+  };
+  const renderPage = activeKey => {
+    if (activeKey == '1')
+      return <> <Form
+        name="basic"
+        // labelCol={{ span: 0 }}
+        // wrapperCol={{ span: 24 }}
+        onFinish={handleApplySubmit}
+        ref={applyFormRef}
+      >
+        <div style={{ display: 'flex' }}>
+          <Form.Item name="range-picker" label="申请时间:">
+            <RangePicker />
+          </Form.Item>
+          <Form.Item>
+            <Button type="primary" htmlType="submit" style={{ marginLeft: 10 }}>
+              查询
+            </Button>
+          </Form.Item>
+        </div>
+        <Table
+          columns={columns}
+        />
+      </Form>
+      </>
+    else if (activeKey == '2')
+      return <> <Form
+        name="basic"
+        // labelCol={{ span: 0 }}
+        // wrapperCol={{ span: 24 }}
+        onFinish={handleApproveSubmit}
+        ref={approveFormRef}
+      >
+        <div style={{ display: 'flex' }}>
+          <Form.Item name="range-picker" label="审批时间:">
+            <RangePicker />
+          </Form.Item>
+          <Form.Item>
+            <Button type="primary" htmlType="submit" style={{ marginLeft: 10 }}>
+              查询
+            </Button>
+          </Form.Item>
+        </div>
+      </Form>
+        <Table
+          rowKey='id'
+          columns={approveColumns}
+          dataSource={queryProfileListRequest?.data?.list}
+        />
+      </>
+  }
+  return (
+    <PageContainer
+      header={{
+        title: '个人中心'
+      }}
+      tabList={[
+        {
+          tab: '我的申请',
+          key: '1',
+        },
+        {
+          tab: '我的审批',
+          key: '2',
+        },
+      ]}
+      onTabChange={onTabChange}
+    >
+      <div>
+        {renderPage(tabActive)}
+      </div>
+    </PageContainer >
+  )
+}
+export default profile;

+ 15 - 0
src/services/boom.js

@@ -63,6 +63,21 @@ export async function queryOSSData() {
   return request(`/config/chart-template-img?destDir=public/bom`);
 }
 
+export async function queryProfileList() {
+  let profileList = await request(`/api/v1/oa/audit/list`, { method: 'GET' });
+  let auditList = await request(`/api/v1/purchase/flow/info?flow_type=1`);
+  profileList?.data?.list.map(item => {
+    var audit = auditList?.data?.find(child => item.flow_id === child?.list.id)
+    if (audit) {
+      item.table_name = item.AuthorInfo?.CName + audit.list.name;
+      item.table_desc = audit.list.desc;
+      item.status = '待审批';
+    }
+  })
+  console.log(profileList);
+  return profileList;
+}
+
 // /**
 //   project_id
 //   version_id	大版本id