1178232204@qq.com %!s(int64=3) %!d(string=hai) anos
pai
achega
5bb337b2bc

+ 45 - 23
src/components/AHeader/index.js

@@ -2,6 +2,7 @@ import { Layout, Dropdown, Menu, Modal, Input, Form, Space, Button } from 'antd'
 import { withRouter } from 'react-router'
 import { useState, useEffect } from 'react';
 import { useSelector, useDispatch } from 'react-redux';
+import { RedoOutlined } from '@ant-design/icons';
 import MyMessage from "../MyMessage";
 import { panesNow } from '@reducers/tabPanes.js';
 import { getTimeDetail } from '@utils/index';
@@ -12,7 +13,7 @@ import down from '@images/down.png';
 import './index.less'
 import { message } from "antd/lib/index";
 import { add, active } from '@reducers/tabPanes'
-import { setUnReadNum} from '@reducers/userInfo.js';
+import { setUnReadNum, setRegularNum, setRulerNum, setProblemNum, setLossNum } from '@reducers/userInfo.js';
 import apiObj from '@api/index';
 
 const { post, api, xPost } = apiObj;
@@ -24,20 +25,20 @@ const { Header } = Layout;
 
 function AHeader({ history, hideName }) {
     const dispatch = useDispatch();//当前选中的菜单
-    const { panes } = useSelector(state => {
+    const { panes, activeTab } = useSelector(state => {
         return state.tabPanes;
     });
     const [form] = Form.useForm();
     const [dateTime, setDateTime] = useState('');
     const [visible, setVisible] = useState(false);
     //const [unReadNum,setUnReadNum] = useState(0);
-    const [systemName,setSystemName] = useState("");
+    const [systemName, setSystemName] = useState("");
     //const [userName,setUserName] = useState("");
     const userName = localStorage.getItem("userName");
     const hospitalId = localStorage.getItem("hospitalId");
     const softwareArr = JSON.parse(localStorage.getItem("software"));
 
-    const { user, unReadNum } = useSelector((state) => {
+    const { user, unReadNum, regularNum, rulerNum, problemNum, lossNum } = useSelector((state) => {
         return state.userInfo;
     });
     //退出
@@ -49,14 +50,35 @@ function AHeader({ history, hideName }) {
         dispatch(panesNow([]));
         history.push('/login');
     }
+    function getRefresh() {
+        console.log(activeTab);
+        let count
+        if (activeTab.split('&')[0] == "SJZL-ZZSWH") {
+            count = regularNum
+            count++
+            dispatch(setRegularNum(count));
+        } else if (activeTab.split('&')[0] == "SJZL-ZDJYGZWH") {
+            count = rulerNum
+            count++
+            dispatch(setRulerNum(count));
+        } else if (activeTab.split('&')[0] == "SJZL-ZDJYWTMX") {
+            count = problemNum
+            count++
+            dispatch(setProblemNum(count));
+        } else if (activeTab.split('&')[0] == "SJZL-BLSJDSMX") {
+            count = lossNum
+            count++
+            dispatch(setLossNum(count));
+        }
+    }
     //获取未读消息数量
-    function getNotNoticeCount(){
+    function getNotNoticeCount() {
         xPost(api.getNotNoticeCount).then((res) => {
             if (res.data.code === 200) {
-                const data = res.data.data||{};
+                const data = res.data.data || {};
                 let count = data.count;
-                count = count>99?'99+':count;
-			  	dispatch(setUnReadNum(count));
+                count = count > 99 ? '99+' : count;
+                dispatch(setUnReadNum(count));
                 initWebsocket(count);
             } else {
                 //message.warning(res.data.msg || '请求失败');
@@ -64,38 +86,38 @@ function AHeader({ history, hideName }) {
         })
     }
     //未读消息页面显示并带入未读筛选条件
-    function showMyMsgPage(){
+    function showMyMsgPage() {
         const pageKey = 'ZNTZ-WDTZ&我的通知';
         const item = panes.find((it) => it.key === pageKey);
         if (item) {   //已存在当前tab,则定位即可不增加
-            dispatch(active({idName:pageKey,isUnRead:true}));
+            dispatch(active({ idName: pageKey, isUnRead: true }));
             return;
         }
         dispatch(
-            add({ title: '我的通知', content: <MyMessage />, key: pageKey,isUnRead:true})
+            add({ title: '我的通知', content: <MyMessage />, key: pageKey, isUnRead: true })
         )
     }
-    async function initWebsocket(num){
+    async function initWebsocket(num) {
         const mqtt = require('mqtt');
-        const client  = mqtt.connect(api.websocketUrl);
+        const client = mqtt.connect(api.websocketUrl);
         //const hisId = getCookie("hospitalId");
         client.on('connect', function () {
-            client.subscribe(hospitalId+"-"+user.id, function (err) {
+            client.subscribe(hospitalId + "-" + user.id, function (err) {
                 if (!err) {
-                    console.log(hospitalId+"-"+user.id+"订阅成功")
+                    console.log(hospitalId + "-" + user.id + "订阅成功")
                 }
             })
         })
 
         client.on('message', function (topic, message) {
-            let n = num>unReadNum?num:unReadNum;
+            let n = num > unReadNum ? num : unReadNum;
             setUnReadNum(+n)
-            console.log('收到消息+1:',message.toString())
+            console.log('收到消息+1:', message.toString())
         })
     }
     //获取系统、用户名称用于页头显示
-    function getSysName(){
-		setSystemName(localStorage.getItem("systemName"));
+    function getSysName() {
+        setSystemName(localStorage.getItem("systemName"));
     }
     /*function handleUserInfo(data){
         const { userInfo, software } = data;
@@ -139,7 +161,7 @@ function AHeader({ history, hideName }) {
         })
     }
     useEffect(() => {
-	    getSysName();
+        getSysName();
         countTime();
         getNotNoticeCount();
         return function clearUp() {
@@ -159,13 +181,13 @@ function AHeader({ history, hideName }) {
         <Header className='page-header'>
             <img className='logo' src={logo} alt="" />
             {hideName ? '' : <><span className='break-line'>|</span>
-                <span className='sys-name'>{systemName}</span></>}
+                <span className='sys-name'>{systemName}<span className='refresh' onClick={getRefresh}><RedoOutlined /></span></span></>}
             <div className='infos'>
                 <span className='time'>{dateTime}</span>
                 <span className='break-line'>|</span>
                 <div className="unRead-msg-cont" onClick={showMyMsgPage}>
-                    <img className='msg-icon' src={msg} alt="未读消息"/>
-                    {unReadNum?<span className='unRead-msg'>{unReadNum}</span>:''}
+                    <img className='msg-icon' src={msg} alt="未读消息" />
+                    {unReadNum ? <span className='unRead-msg'>{unReadNum}</span> : ''}
                 </div>
                 <div className="user">
                     <Dropdown overlay={menu} trigger={['click']}>

+ 4 - 0
src/components/AHeader/index.less

@@ -56,4 +56,8 @@
   display: inline-block;
   margin-right: 18px;
   vertical-align: middle;
+}
+.refresh{
+  margin-left: 10px;
+  cursor: pointer;
 }

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 16 - 13
src/components/AMenu/index.js


+ 10 - 4
src/components/BlockLossManage/index.js

@@ -1,4 +1,5 @@
 import React, { useState, useEffect, useRef } from 'react';
+import { useSelector, useDispatch } from 'react-redux';
 import { Form, Input, Button, Table, Row, Col, Select, Modal, DatePicker, Space, message } from 'antd';
 import moment from "moment";
 import "moment/locale/zh-cn"
@@ -11,10 +12,7 @@ import { getValueFromEvent, disabledDate, getDaysBetween } from '@utils/index'
 const { post, api, xPost } = apiObj;
 const { Option } = Select;
 function BlockLossManage() {
-    useEffect(() => {
-        getBlockLossPage();
-        blockLossTypeGather(date)
-    }, []);
+    
     const [blockList, setBlockList] = useState([]);
     const [total, setTotal] = useState(0);
     const [title, setTitle] = useState(0);
@@ -47,6 +45,14 @@ function BlockLossManage() {
         startDate: getCurrentDataFront().split('/').join('-') + ' 00:00:00',
         endDate: getCurrentData().split('/').join('-') + ' 23:59:59'
     }
+    const { lossNum } = useSelector((state) => {
+		return state.userInfo;
+	});
+    useEffect(() => {
+        form.resetFields();
+        getBlockLossPage();
+        blockLossTypeGather(date)
+    }, [lossNum]);
     //表格数据
     function getBlockLossPage(param) {
         post(api.getBlockLossPage, param || params).then((res) => {

+ 14 - 8
src/components/FieldProblem/index.js

@@ -1,4 +1,5 @@
 import React, { useState, useEffect, useRef } from 'react';
+import { useSelector, useDispatch } from 'react-redux';
 import { Form, Input, Button, Table, Row, Col, Select, Modal, DatePicker, Space, message } from 'antd';
 import '@common/common.less';
 import moment from "moment";
@@ -11,11 +12,7 @@ import { getValueFromEvent, disabledDate, getDaysBetween } from '@utils/index'
 const { post, api, xPost } = apiObj;
 const { Option } = Select;
 function FieldProblem() {
-    useEffect(() => {
-        getColumnResultPage();
-        getColumnResultNumber(date)
-        getModeName()
-    }, []);
+    
     const [logList, setLogList] = useState([]);
     const [total, setTotal] = useState(0);
     const [type, setType] = useState(0);//1新增 2修改
@@ -49,6 +46,15 @@ function FieldProblem() {
         behospitalStartDate: getCurrentDataFront().split('/').join('-') + ' 00:00:00',
         behospitalEndDate: getCurrentData().split('/').join('-') + ' 23:59:59'
     }
+    const { problemNum } = useSelector((state) => {
+		return state.userInfo;
+	});
+    useEffect(() => {
+        form.resetFields();
+        getColumnResultPage();
+        getColumnResultNumber(date)
+        getModeName()
+    }, [problemNum]);
     //表格数据
     function getColumnResultPage(param) {
         post(api.getColumnResultPage, param || params).then((res) => {
@@ -217,7 +223,7 @@ function FieldProblem() {
                     }}
                 >
                     <Row gutter={24}>
-                        <Col span={7} key={0}>
+                        <Col span={6} key={0}>
                             <Form.Item label="日期" >
                                 <Form.Item name="behospitalStartDate" className='times'>
                                     <DatePicker
@@ -263,7 +269,7 @@ function FieldProblem() {
                                 </Select>
                             </Form.Item>
                         </Col>
-                        <Col span={5} key={5}>
+                        <Col span={4} key={5}>
                             <Form.Item label="问题类型" name="type">
                                 <Select
                                     placeholder="请选择"
@@ -276,7 +282,7 @@ function FieldProblem() {
                                 </Select>
                             </Form.Item>
                         </Col>
-                        <Col span={5} key={7}>
+                        <Col span={4} key={7}>
                             <Form.Item label="状态" name="isSolved">
                                 <Select
                                     placeholder="请选择"

+ 24 - 27
src/components/FieldRules/index.js

@@ -1,13 +1,13 @@
 import React, { useState, useEffect, useRef } from 'react';
+import { useSelector, useDispatch } from 'react-redux';
 import { Form, Input, Button, Table, Row, Col, Select, Modal, DatePicker, Space, message } from 'antd';
-import { DeleteOutlined, PlusOutlined } from '@ant-design/icons';
+import { PlusOutlined } from '@ant-design/icons';
 import '@common/common.less';
 import apiObj from '@api/index';
 import AddRules from './addRules';
 import FiledContext from './filed-context';
 import { getValueFromEvent } from '@utils/index'
 const { post, api, xPost } = apiObj;
-const { RangePicker } = DatePicker;
 const { Option } = Select;
 
 function FieldRules() {
@@ -39,12 +39,16 @@ function FieldRules() {
         size: size,
         desc: ['gmt_create']
     }
+    const { rulerNum } = useSelector((state) => {
+        return state.userInfo;
+    });
     useEffect(() => {
+        form.resetFields();
         getRegular()
         getTableName()
         getColumnName('', '', '', '')
         getColumnVerifyPage();
-    }, []);
+    }, [rulerNum]);
     //表格数据
     function getColumnVerifyPage(param) {
         post(api.getColumnVerifyPage, param || params).then((res) => {
@@ -317,7 +321,7 @@ function FieldRules() {
         getColumnVerifyPage(data);
         setSelectedRowKeys([])
         setDisable(true)
-        
+
     };
     const columns = [
         { title: '序号', dataIndex: 'index', render: (text, record, index) => (current - 1) * params.size + index + 1, width: 60 },
@@ -374,9 +378,9 @@ function FieldRules() {
                     initialValues={{ lossType: '', lossWay: '', isRequired: '' }}
                 >
                     <Row gutter={24}>
-                        <Col span={6} key={0}>
+                        <Space size="middle">
                             <Form.Item label="表名称(中文)" name="tableCname">
-                                <Select showSearch allowClear onChange={(value, option) => tableCnameChange(value, option)} onSearch={cnameSearch} style={{ maxWidth: '159px' }} placeholder="请选择">
+                                <Select showSearch allowClear onChange={(value, option) => tableCnameChange(value, option)} onSearch={cnameSearch} style={{ width: '159px' }} placeholder="请选择">
                                     {tableList.map((item) => {
                                         return (
                                             <Option value={item.tableCname} val={item.tableEname} key={item.tableCname}>{item.tableCname}</Option>
@@ -384,10 +388,9 @@ function FieldRules() {
                                     })}
                                 </Select>
                             </Form.Item>
-                        </Col>
-                        <Col span={6} key={1}>
+
                             <Form.Item label="表名称(英文)" name="tableEname">
-                                <Select showSearch allowClear onChange={(value, option) => tableEnameChange(value, option)} onSearch={enameSearch} style={{ maxWidth: '159px' }} placeholder="请选择">
+                                <Select showSearch allowClear onChange={(value, option) => tableEnameChange(value, option)} onSearch={enameSearch} style={{ width: '159px' }} placeholder="请选择">
                                     {tableList.map((item) => {
                                         return (
                                             <Option value={item.tableEname} val={item.tableCname} key={item.tableEname}>{item.tableEname}</Option>
@@ -395,10 +398,8 @@ function FieldRules() {
                                     })}
                                 </Select>
                             </Form.Item>
-                        </Col>
-                        <Col span={6} key={2}>
                             <Form.Item label="字段名称(中文)" name="columnCname">
-                                <Select showSearch allowClear onChange={(value, option) => colchange(value, option, 1)} onSearch={colmeSearch} style={{ maxWidth: '159px' }} placeholder="请选择" disabled={disable}>
+                                <Select showSearch allowClear onChange={(value, option) => colchange(value, option, 1)} onSearch={colmeSearch} style={{ width: '159px' }} placeholder="请选择" disabled={disable}>
                                     {colList.map((item, i) => {
                                         return (
                                             <Option value={item.columnCname} val={item.columnEname} key={item.columnCname}>{item.columnCname}</Option>
@@ -406,10 +407,8 @@ function FieldRules() {
                                     })}
                                 </Select>
                             </Form.Item>
-                        </Col>
-                        <Col span={6} key={3}>
                             <Form.Item label="字段名称(英文)" name="columnEname">
-                                <Select showSearch allowClear onChange={(value, option) => colchange(value, option, 2)} onSearch={coleneSearch} placeholder="请选择" style={{ maxWidth: '159px' }} disabled={disable}>
+                                <Select showSearch allowClear onChange={(value, option) => colchange(value, option, 2)} onSearch={coleneSearch} placeholder="请选择" style={{ width: '159px' }} disabled={disable}>
                                     {colList.map((item, i) => {
                                         return (
                                             <Option value={item.columnEname} val={item.columnCname} key={item.columnEname}>{item.columnEname}</Option>
@@ -417,7 +416,7 @@ function FieldRules() {
                                     })}
                                 </Select>
                             </Form.Item>
-                        </Col>
+                        </Space>
                         <Col span={5} key={4}>
                             <Form.Item label="是否必填" name="isRequired">
                                 <Select
@@ -435,17 +434,15 @@ function FieldRules() {
                                 <Input placeholder="标准值" autoComplete='off' allowClear maxLength='30' />
                             </Form.Item>
                         </Col>
-                        <Col span={6} key={6}>
-                            <Form.Item label="正则名称" name="regularName">
-                                <Select showSearch allowClear onSearch={onSearch} placeholder="请选择" style={{ maxWidth: '159px' }}>
-                                    {regularList.map((item) => {
-                                        return (
-                                            <Option value={item.name} key={item.id}>{item.name}</Option>
-                                        )
-                                    })}
-                                </Select>
-                            </Form.Item>
-                        </Col>
+                        <Form.Item label="正则名称" name="regularName">
+                            <Select showSearch allowClear onSearch={onSearch} placeholder="请选择" style={{ width: '159px' }}>
+                                {regularList.map((item) => {
+                                    return (
+                                        <Option value={item.name} key={item.id}>{item.name}</Option>
+                                    )
+                                })}
+                            </Select>
+                        </Form.Item>
                         <Col span={6} key={7}>
                             <Form.Item>
                                 <Button type="primary" htmlType="submit">

+ 10 - 6
src/components/RegularManage/index.js

@@ -1,6 +1,7 @@
 import React, { useState, useEffect, useRef } from 'react';
+import { useSelector } from 'react-redux';
 import { Form, Input, Button, Table, Row, Col, Select, Modal, DatePicker, Space } from 'antd';
-import { DeleteOutlined, PlusOutlined } from '@ant-design/icons';
+import { PlusOutlined } from '@ant-design/icons';
 import { getValueFromEvent } from '@utils/index'
 import '@common/common.less';
 import apiObj from '@api/index';
@@ -8,12 +9,8 @@ import AddRegular from './addRegular';
 import RegularContext from './regular-context';
 import { message } from "antd/lib/index";
 const { post, api, xPost } = apiObj;
-const { RangePicker } = DatePicker;
-const { Option } = Select;
 function RegularManage() {
-    useEffect(() => {
-        getRegularPage();
-    }, []);
+    
     const [regularList, setRegularList] = useState([]);
     const [total, setTotal] = useState(0);
     const [title, setTitle] = useState();
@@ -39,6 +36,13 @@ function RegularManage() {
         size: size,
         desc: ['dri.gmt_create']
     }
+    const { regularNum } = useSelector((state) => {
+		return state.userInfo;
+	});
+    useEffect(() => {
+        form.resetFields();
+        getRegularPage();
+    }, [regularNum]);
     //表格数据
     function getRegularPage(param) {
         post(api.getRegularPage, param || params).then((res) => {

+ 32 - 16
src/store/reducers/userInfo.js

@@ -3,31 +3,47 @@ import { createSlice } from '@reduxjs/toolkit';
 export const slice = createSlice({
     name: 'userInfo',
     initialState: {
-        tokenInfo:null,
-        user:{}
+        tokenInfo: null,
+        user: {},
+        regularNum: 0,
+        rulerNum: 0,
+        problemNum: 0,
+        lossNum: 0
     },
     reducers: {
-        add: (state,action) => {        //添加token
-            state.tokenInfo=action.payload;
+        add: (state, action) => {        //添加token
+            state.tokenInfo = action.payload;
         },
         remove: (state) => {        //删除token
-            state.tokenInfo=null;
+            state.tokenInfo = null;
         },
-        setSys:(state,action) => {        //选中的系统和医院id
-            const {sysId,sysName,hisId} = action.payload;
-            state.sysId=sysId;
-            state.sysName=sysName;
-            state.hisId=hisId;
+        setSys: (state, action) => {        //选中的系统和医院id
+            const { sysId, sysName, hisId } = action.payload;
+            state.sysId = sysId;
+            state.sysName = sysName;
+            state.hisId = hisId;
         },
-        setUser:(state,action) => {        //删除token
-            state.user=action.payload;
+        setUser: (state, action) => {        //删除token
+            state.user = action.payload;
+        },
+        setUnReadNum(state, action) {     //未读消息数量
+            state.unReadNum = action.payload;
+        },
+        setRegularNum(state, action) {
+            state.regularNum = action.payload;
+        },
+        setRulerNum(state, action) {
+            state.rulerNum = action.payload;
+        },
+        setProblemNum(state, action) {
+            state.problemNum = action.payload;
+        },
+        setLossNum(state, action) {
+            state.lossNum = action.payload;
         },
-        setUnReadNum(state,action){     //未读消息数量
-            state.unReadNum=action.payload;
-        }
     },
 });
 
-export const { remove, add, setSys, setUser,setUnReadNum } = slice.actions;
+export const { remove, add, setSys, setUser, setUnReadNum, setRegularNum, setRulerNum, setProblemNum, setLossNum } = slice.actions;
 
 export default slice.reducer;