|
@@ -1,4 +1,4 @@
|
|
|
-import React from 'react';
|
|
|
+import React, { useMemo } from 'react';
|
|
|
import { Collapse, Layout, List } from 'antd';
|
|
|
import {
|
|
|
UserOutlined,
|
|
@@ -7,105 +7,12 @@ import {
|
|
|
ExceptionOutlined,
|
|
|
} from '@ant-design/icons';
|
|
|
import { PageContainer } from '@ant-design/pro-components';
|
|
|
-import { Link } from '@umijs/max';
|
|
|
+import { Link, useRequest } from '@umijs/max';
|
|
|
+import { queryAuditList, queryClassify } from '@/services/boom';
|
|
|
|
|
|
const { Sider, Content } = Layout;
|
|
|
const { Panel } = Collapse;
|
|
|
|
|
|
-const categories = [
|
|
|
- {
|
|
|
- name: '请假审批',
|
|
|
- items: [
|
|
|
- {
|
|
|
- name: '病假申请',
|
|
|
- icon: <UserOutlined />,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '事假申请',
|
|
|
- icon: <FileOutlined />,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '探亲假申请',
|
|
|
- icon: <UserOutlined />,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '婚假申请',
|
|
|
- icon: <UserOutlined />,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '产假申请',
|
|
|
- icon: <UserOutlined />,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '陪产假申请',
|
|
|
- icon: <UserOutlined />,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '丧假申请',
|
|
|
- icon: <UserOutlined />,
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- name: '加班审批',
|
|
|
- items: [
|
|
|
- {
|
|
|
- name: '普通加班申请',
|
|
|
- icon: <EditOutlined />,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '周末加班申请',
|
|
|
- icon: <EditOutlined />,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '节假日加班申请',
|
|
|
- icon: <EditOutlined />,
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- name: '报销审批',
|
|
|
- items: [
|
|
|
- {
|
|
|
- name: '差旅费报销',
|
|
|
- icon: <FileOutlined />,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '通讯费报销',
|
|
|
- icon: <FileOutlined />,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '餐费报销',
|
|
|
- icon: <FileOutlined />,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '办公用品采购报销办公用品采购报销办公用品采购报销办公用品采购报销',
|
|
|
- icon: <FileOutlined />,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '项目费用报销',
|
|
|
- icon: <FileOutlined />,
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- name: '异常审批',
|
|
|
- items: [
|
|
|
- {
|
|
|
- name: '物品遗失申请',
|
|
|
- icon: <ExceptionOutlined />,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '客诉申请',
|
|
|
- icon: <ExceptionOutlined />,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '工作计划申请',
|
|
|
- icon: <ExceptionOutlined />,
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
-];
|
|
|
const getBackgroundColors = (index) => {
|
|
|
const backgroundColors = [
|
|
|
'#1ABC9C', // 深绿色
|
|
@@ -121,52 +28,82 @@ const getBackgroundColors = (index) => {
|
|
|
return backgroundColors[index % backgroundColors.length];
|
|
|
};
|
|
|
const Approval = () => {
|
|
|
+ const { data: classify, loading } = useRequest(queryClassify, {
|
|
|
+ defaultParams: [{ c_type: 1 }],
|
|
|
+ });
|
|
|
+ const { data: auditList } = useRequest(queryAuditList, {
|
|
|
+ defaultParams: [{ flow_type: 1 }],
|
|
|
+ });
|
|
|
+
|
|
|
+ const categories = useMemo(() => {
|
|
|
+ if (!auditList || !classify) return [];
|
|
|
+ let categories = {};
|
|
|
+ auditList.forEach((item) => {
|
|
|
+ const { classify_id } = item;
|
|
|
+ if (!categories[classify_id]) {
|
|
|
+ categories[classify_id] = {
|
|
|
+ id: classify_id,
|
|
|
+ name: classify.find((item) => item.id == classify_id)?.name,
|
|
|
+ items: [],
|
|
|
+ };
|
|
|
+ }
|
|
|
+ categories[classify_id].items.push(item);
|
|
|
+ });
|
|
|
+ return Object.values(categories);
|
|
|
+ }, [classify, auditList]);
|
|
|
+
|
|
|
return (
|
|
|
- <PageContainer>
|
|
|
- <Collapse defaultActiveKey={categories.map((category) => category.name)}>
|
|
|
- {categories.map((category, index) => (
|
|
|
- <Panel style={{userSelect: 'none'}} header={category.name} key={category.name}>
|
|
|
- <List
|
|
|
- grid={{ gutter: 16, column: 3 }}
|
|
|
- dataSource={category.items}
|
|
|
- renderItem={(item) => (
|
|
|
- <List.Item key={item.name}>
|
|
|
- <Link
|
|
|
- to={`/oa/${item.name}`}
|
|
|
- style={{ display: 'flex', alignItems: 'center' }}
|
|
|
- >
|
|
|
- <div
|
|
|
- style={{
|
|
|
- width: 48,
|
|
|
- height: 48,
|
|
|
- borderRadius: 8,
|
|
|
- textAlign: 'center',
|
|
|
- lineHeight: '48px',
|
|
|
- color: '#fff',
|
|
|
- fontSize: 24,
|
|
|
- backgroundColor: getBackgroundColors(index),
|
|
|
- }}
|
|
|
- >
|
|
|
- {item.icon}
|
|
|
- </div>
|
|
|
- <span
|
|
|
- style={{
|
|
|
- marginLeft: 12,
|
|
|
- flex: 1,
|
|
|
- fontSize: 18,
|
|
|
- maxWidth: '100%',
|
|
|
- paddingRight: 30,
|
|
|
- }}
|
|
|
+ <PageContainer loading={loading}>
|
|
|
+ {categories.length > 0 && (
|
|
|
+ <Collapse defaultActiveKey={categories.map((category) => category.id)}>
|
|
|
+ {categories.map((category, index) => (
|
|
|
+ <Panel
|
|
|
+ style={{ userSelect: 'none' }}
|
|
|
+ header={category.name}
|
|
|
+ key={category.id}
|
|
|
+ >
|
|
|
+ <List
|
|
|
+ grid={{ gutter: 16, column: 3 }}
|
|
|
+ dataSource={category.items}
|
|
|
+ renderItem={(item) => (
|
|
|
+ <List.Item key={item.id}>
|
|
|
+ <Link
|
|
|
+ to={`/oa/detail/${item.id}`}
|
|
|
+ style={{ display: 'flex', alignItems: 'center' }}
|
|
|
>
|
|
|
- {item.name}
|
|
|
- </span>
|
|
|
- </Link>
|
|
|
- </List.Item>
|
|
|
- )}
|
|
|
- ></List>
|
|
|
- </Panel>
|
|
|
- ))}
|
|
|
- </Collapse>
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ width: 48,
|
|
|
+ height: 48,
|
|
|
+ borderRadius: 8,
|
|
|
+ textAlign: 'center',
|
|
|
+ lineHeight: '48px',
|
|
|
+ color: '#fff',
|
|
|
+ fontSize: 24,
|
|
|
+ backgroundColor: getBackgroundColors(index),
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <UserOutlined />
|
|
|
+ </div>
|
|
|
+ <span
|
|
|
+ style={{
|
|
|
+ marginLeft: 12,
|
|
|
+ flex: 1,
|
|
|
+ fontSize: 18,
|
|
|
+ maxWidth: '100%',
|
|
|
+ paddingRight: 30,
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {item.name}
|
|
|
+ </span>
|
|
|
+ </Link>
|
|
|
+ </List.Item>
|
|
|
+ )}
|
|
|
+ ></List>
|
|
|
+ </Panel>
|
|
|
+ ))}
|
|
|
+ </Collapse>
|
|
|
+ )}
|
|
|
</PageContainer>
|
|
|
);
|
|
|
};
|