zhouna 3 lat temu
rodzic
commit
22c1f52bf1

+ 6 - 7
src/components/AHeader/index.js

@@ -12,7 +12,7 @@ import down from '@images/down.png';
 import './index.less'
 import { message } from "antd/lib/index";
 import { add, active } from '@reducers/tabPanes'
-/*import { setSys, setUser} from '@reducers/userInfo.js';*/
+import { setUnReadNum} from '@reducers/userInfo.js';
 import apiObj from '@api/index';
 
 const { post, api, xPost } = apiObj;
@@ -30,15 +30,14 @@ function AHeader({ history, hideName }) {
     const [form] = Form.useForm();
     const [dateTime, setDateTime] = useState('');
     const [visible, setVisible] = useState(false);
-    const [unReadNum,setUnReadNum] = useState(0);
+    //const [unReadNum,setUnReadNum] = useState(0);
     const [systemName,setSystemName] = useState("");
     //const [userName,setUserName] = useState("");
-    console.log(11)
     const userName = getCookie("userName");
     const hospitalId = getCookie("hospitalId");
     const softwareArr = JSON.parse(localStorage.getItem("software"));
 
-    const { user, sysName } = useSelector((state) => {
+    const { user, unReadNum } = useSelector((state) => {
         return state.userInfo;
     });
     //退出
@@ -58,7 +57,7 @@ function AHeader({ history, hideName }) {
                 const data = res.data.data||{};
                 let count = data.count;
                 count = count>99?'99+':count;
-                setUnReadNum(count)
+			  	dispatch(setUnReadNum(count));
                 initWebsocket(count);
             } else {
                 //message.warning(res.data.msg || '请求失败');
@@ -91,7 +90,7 @@ function AHeader({ history, hideName }) {
 
         client.on('message', function (topic, message) {
             let n = num>unReadNum?num:unReadNum;
-            setUnReadNum(+n+1)
+            setUnReadNum(+n)
             console.log('收到消息+1:',message.toString())
         })
     }
@@ -152,7 +151,7 @@ function AHeader({ history, hideName }) {
         return function clearUp() {
             clearInterval(interVal)
         }
-    }, []);
+    }, ['unReadNum']);
     const menu = (
         <Menu>
             <Menu.Item key="0">

+ 1 - 2
src/components/AMenu/index.js

@@ -67,12 +67,11 @@ function AMenu() {
     const { activeTab, panes } = useSelector(state => {
         return state.tabPanes;
     });
-    console.log(44,activeTab)
+    //console.log(44,activeTab)
     //切换菜单、增加tab
     function changeMenu(val) {
         const idName = val.key.split("&");
         const item = panes.find((it) => it.key === val.key);
-        //console.log(item);
         if (item) {   //已存在当前tab,则定位即可不增加
             dispatch(active({idName:val.key}));
             return;

+ 1 - 1
src/components/DrugManager/index.js

@@ -327,7 +327,7 @@ function DrugManager() {
         <Table
 		  rowSelection={{type: 'checkbox',...rowSelection,}}
           columns={columns}
-          scroll={{ y: 'calc(100vh - 320px)' }}
+          scroll={{ y: 'calc(100vh - 350px)' }}
           dataSource={DrugList}
           rowKey={record => record.id}
           pagination={{

+ 26 - 8
src/components/MyMessage/index.js

@@ -16,6 +16,12 @@ function MyMessage() {
     }, []);
 
     const [size, setSize] = useState(15);       //每页显示条数
+    const [current, setCurrent] = useState(1);//当前页
+    const [params, setParams] = useState({
+      pages: 1,
+      current: 1,
+      size: 15
+    });
     const [total, setTotal] = useState(0);       //每页显示条数
     const [dataSource, setDataSource] = useState([]);   //列表数据
     const [visible, setVisible] = useState(false);   //弹窗查看
@@ -26,7 +32,7 @@ function MyMessage() {
         return state.staticInfo;
     });
     const toUnRead = useSelector(state => {     //是否筛选未读
-        console.log(43,state)
+        //console.log(43,state)
         return state.tabPanes.toUnRead;
     });
 
@@ -51,7 +57,7 @@ function MyMessage() {
     function getNotNoticeCount(){
         xPost(api.getNotNoticeCount).then((res) => {
             if (res.data.code === 200) {
-                let count = res.data.count;
+                let count = res.data.data.count;
                 count = count>99?'99+':count;
                 dispatch(setUnReadNum(count));
             } else {
@@ -78,12 +84,21 @@ function MyMessage() {
         });
     }
     //每页显示条数切换
-    function onSizeChange(){
-
+    function onSizeChange(current, pageSize){
+	  params.current = current
+	  params.size = pageSize
+	  setSize(pageSize)
+	  setCurrent(current)
+	  setParams(params)
+	  getTableData(params)
     }
     //翻页
-    function onPageChange(){
-
+    function onPageChange(page, pageSize){
+	  params.current = page
+	  params.size = pageSize
+	  setCurrent(page)
+	  setParams(params)
+	  getTableData(params)
     }
     //表格渲染
     function RenderTable() {
@@ -116,9 +131,12 @@ function MyMessage() {
                         pageSizeOptions:[15,30,60,120],
                         defaultPageSize:size,
                         pageNo: 1,
+					    current:current,
                         size:'small',
                         total: total,
                         showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条数据`,
+                        onShowSizeChange: (current, pageSize) => onSizeChange(current, pageSize), // 改变每页数量时更新显示
+					    onChange: (page, pageSize) => onPageChange(page, pageSize),//点击页码事件
                     }}
                 />
             )
@@ -126,8 +144,8 @@ function MyMessage() {
     }
     //筛选项渲染
     const [form] = Form.useForm();
-    const initialValues = {status:toUnRead?'0':''};console.log(211,initialValues)
-    const onFinish = (values: any) => {
+    const initialValues = {status:toUnRead?'0':''};
+    const onFinish = (values) => {
         getTableData(values);
         console.log('筛选项:', values);
     };

+ 3 - 3
src/components/PageLayout/index.js

@@ -16,11 +16,11 @@ const defaultProps = {};
 
 function PageLayout(){
     const dispatch = useDispatch();
-    const staticInfo =useSelector(state => {
+    /*const staticInfo =useSelector(state => {
         return state.staticInfo;
-    });
+    });*/
     function getStaticInfos() {
-        const { hisTypeList, statusList, titleList, dataList } = staticInfo;
+        //const { hisTypeList, statusList, titleList, dataList } = staticInfo;
         // if ([...hisTypeList, ...statusList, ...titleList, ...dataList].length > 0) {
         //     return;
         // }

+ 1 - 1
src/components/SurgeryManager/index.js

@@ -321,7 +321,7 @@ function SurgManager() {
         <Table
 		  rowSelection={{type: 'checkbox',...rowSelection,}}
           columns={columns}
-          scroll={{ y: 'calc(100vh - 320px)' }}
+          scroll={{ y: 'calc(100vh - 350px)' }}
           dataSource={SurgList}
           rowKey={record => record.id}
           pagination={{