diff --git a/config/config.ts b/config/config.ts index 5083fa4..75ff48b 100644 --- a/config/config.ts +++ b/config/config.ts @@ -25,14 +25,14 @@ export default { key: '2', name: '关于', path: '/about', - redirect: '/about/m', + redirect: '', routes: [ { id: 21, key: '2-1', name: '关于你', path: '/about/u', - redirect: '/about/u/1', + redirect: '', pid: 2, routes: [ { @@ -40,6 +40,7 @@ export default { key: '2-1-1', name: '关于你1', path: '/about/u/index', + component:"@/pages/about/u/index", redirect: '', pid: 21 }, @@ -48,6 +49,7 @@ export default { key: '2-1-2', name: '关于你2', path: '/about/u/2', + component:"@/pages/about/u/$id", redirect: '', pid: 21 } @@ -59,6 +61,7 @@ export default { path: '/about/m', redirect: '', name: '(页面元素权限)关于我', + component:"@/pages/about/m", pid: 2 }, { @@ -67,6 +70,7 @@ export default { path: '/about/um', redirect: '', name: '关于你和我', + component:"@/pages/about/um", pid: 2 } ] @@ -76,7 +80,7 @@ export default { key: '3', name: '教师', path: '/teacher', - redirect: '/teacher/u', + redirect: '', routes: [ { id: 31, @@ -84,6 +88,7 @@ export default { path: '/teacher/u', redirect: '', name: '(403)关于你教师', + component:"@/pages/teacher/u", pid: 3 }, { @@ -92,6 +97,7 @@ export default { path: '/teacher/m', redirect: '', name: '关于我教师', + component:"@/pages/teacher/m", pid: 3 }, { @@ -100,6 +106,7 @@ export default { path: '/teacher/um', redirect: '', name: '关于你和我教师', + component:"@/pages/teacher/um", pid: 3 } ] diff --git a/mock/user.ts b/mock/user.ts index 2493864..c6d1945 100644 --- a/mock/user.ts +++ b/mock/user.ts @@ -145,14 +145,14 @@ const userApi = { key: '2', name: '关于', path: '/about', - redirect: '/about/m', + redirect: '', children: [ { id: 21, key: '2-1', name: '关于你', path: '/about/u', - redirect: '/about/u/1', + redirect: '', pid: 2, children: [ { @@ -196,7 +196,7 @@ const userApi = { key: '3', name: '教师', path: '/teacher', - redirect: '/teacher/u', + redirect: '', children: [ { id: 31, diff --git a/src/assets/upMenu.svg b/src/assets/upMenu.svg new file mode 100644 index 0000000..d60e5c8 --- /dev/null +++ b/src/assets/upMenu.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/layouts/index.tsx b/src/layouts/index.tsx index d4c62a0..8ad5a95 100644 --- a/src/layouts/index.tsx +++ b/src/layouts/index.tsx @@ -13,6 +13,7 @@ import handleGetCurrentLocation from '@/utils/handleGetCurrentLocation'; import { MenuDataItem, ProLayout } from '@ant-design/pro-components'; import './index.less' import logo from '../assets/logo.svg'; +import upMenu from '@/assets/upMenu.svg' import Icon, { DoubleRightOutlined, SmileOutlined } from '@ant-design/icons'; import { ProfileModelState } from '@/models/global'; import React from 'react'; @@ -52,7 +53,6 @@ const BasicLayout: FC<{ user: UserModelState, global: ProfileModelState, dispatc const [collapsed, setCollapsed] = useState(false); const { pathname } = useLocation(); - const { dispatch, user: { @@ -67,10 +67,9 @@ const BasicLayout: FC<{ user: UserModelState, global: ProfileModelState, dispatc console.log('props', props); console.log('pathname', pathname); const validMenuItem = indexValidMenuItemByPath[pathname]; + console.log('validMenuItem', validMenuItem); // const selectedKeys = validMenuItem?.key; - const [activeKey, setActiveKey] = useState(validMenuItem?.key || '/') - - + const [activeKey, setActiveKey] = useState(validMenuItem?.path || '/') //Menu中的selectedKeys和openKeys不是一回事: //openKeys: @@ -229,6 +228,9 @@ const BasicLayout: FC<{ user: UserModelState, global: ProfileModelState, dispatc } ] + console.log('tabsRoutes', tabsRoutes); + + return ( { - history.push(value) - setActiveKey(value) + // history.push(value) + // setActiveKey(value) }} activeKey={activeKey} onEdit={handleEdit} @@ -352,7 +354,7 @@ const BasicLayout: FC<{ user: UserModelState, global: ProfileModelState, dispatc e.preventDefault() }}> - + diff --git a/src/pages/about/u/index.tsx b/src/pages/about/u/index.tsx index 84de6ce..bb53f6e 100644 --- a/src/pages/about/u/index.tsx +++ b/src/pages/about/u/index.tsx @@ -1,14 +1,169 @@ -import { PureComponent } from 'react'; +import { connect } from "umi"; +import React, { useRef, useState } from "react"; +import ProCard from "@ant-design/pro-card"; +import { MenuFoldOutlined } from "@ant-design/icons"; +import type { FormInstance } from "antd"; +import { Button, message, Space, Spin, Tree } from "antd"; +import useRequest from "@ahooksjs/use-request"; +import { getServerpartTree } from "@/services/options"; +import type { ActionType } from "@ant-design/pro-table"; +import ProTable from "@ant-design/pro-table"; -class Index extends PureComponent { - render() { +const saleRankReport = (props: any) => { + const { currentUser } = props + const downloadBtnRef = useRef() + const actionRef = useRef(); + const formRef = useRef(); + const [reqDetailList, setReqDetailList] = useState(); // 合计项数据源 + const [printOut, setPrintOut] = useState(); // 打印数据的内容 + const [collapsible, setCollapsible] = useState(false) + const [treeView, setTreeView] = useState() + const [printIndex, setPrintIndex] = useState(new Date().getTime()) - return ( -
/about/u
- ); + + // 树相关的属性和方法 + const [selectedId, setSelectedId] = useState() + // 导出的加载效果 + const [showLoading, setShowLoading] = useState(false) + // 是否显示打印的表格 + const [showExportTable, setShowExportTable] = useState(false) + // 查询的条件 + const [searchParams, setSearchParams] = useState() + + const columns: any = [] + + const exportTable = (e) => { + e.stopPropagation(); // 防止Collapse组件收起 + const main = document.getElementsByClassName(`saleReportHideBox${printIndex}`)[0] + const thead = main.querySelector('thead').cloneNode(true); // 深克隆DOM节点 + const tbody = main.querySelector('tbody').cloneNode(true); // 深克隆DOM节点 + const container = document.querySelector('#hiddenBox'); + + const tempTable = document.createElement('table'); + tempTable.appendChild(thead); + tempTable.appendChild(tbody); + + tempTable.setAttribute('id', 'table-to-xls-saleRankReport'); // 给table添加id,值与按钮上的table字段对应 + + container.appendChild(tempTable); // 把创建的节点添加到页面容器中 + + setShowLoading(false) + + downloadBtnRef.current.handleDownload(); + setShowExportTable(false) + tempTable.remove() // 防止重复打印一个内容 } + + return ( +
{ + // 打印报表 + if (!reqDetailList || reqDetailList.length === 0) return; + setPrintOut(el); + }} > + + { + showLoading ? +
+
+ + 数据导出中... +
+
: '' + } + +
+ { + showExportTable && reqDetailList && reqDetailList.length > 0 ? + : '' + } +
+
+ +
+
+ 单品销售排行统计} + search={{ span: 6 }} + request={async (params) => { + if (!selectedId) { + return + } + + setSearchParams(params) + }} + toolbar={{ + actions: [ + + + , + + ] + }} + /> +
+
+
+ ) } -export default Index; +export default connect(({ user }: ConnectState) => ({ + currentUser: user.currentUser +}))(saleRankReport);