From 5acddbdb6b6d48a08b52602fd232993fd5c3715d Mon Sep 17 00:00:00 2001
From: Mr Ke <kelq@hugeinfo.com.cn>
Date: Mon, 27 Apr 2020 15:51:27 +0800
Subject: [PATCH] 增加接收情况tabs列表

---
 src/components/page/AnnouncementPage/index.jsx            |   19 +++++
 debug.log                                                 |   11 +++
 src/components/common/FindAlreadyReadOrNotView/index.jsx  |   91 ++++++++++++++++++++++++++++++
 src/components/page/index/rulesList/index.jsx             |   31 ++++------
 src/components/common/HotListTableView/index.scss         |    2 
 src/api/httpurl.js                                        |    4 
 src/components/common/FindAlreadyReadOrNotView/index.scss |   21 +++++++
 7 files changed, 155 insertions(+), 24 deletions(-)

diff --git a/debug.log b/debug.log
new file mode 100644
index 0000000..5b4c059
--- /dev/null
+++ b/debug.log
@@ -0,0 +1,11 @@
+[0427/114532.165:ERROR:process_reader_win.cc(151)] SuspendThread: �ܾ����ʡ� (0x5)
+[0427/114532.172:ERROR:exception_snapshot_win.cc(98)] thread ID 29668 not found in process
+[0427/114532.172:ERROR:scoped_process_suspend.cc(40)] NtResumeProcess: �ѳ��Է��������˳��Ĺ��̡� (0xc000010a)
+[0427/114701.055:ERROR:process_reader_win.cc(151)] SuspendThread: �ܾ����ʡ� (0x5)
+[0427/114701.055:ERROR:exception_snapshot_win.cc(98)] thread ID 18704 not found in process
+[0427/114754.720:ERROR:process_reader_win.cc(151)] SuspendThread: �ܾ����ʡ� (0x5)
+[0427/114754.721:ERROR:exception_snapshot_win.cc(98)] thread ID 20684 not found in process
+[0427/114754.721:ERROR:scoped_process_suspend.cc(40)] NtResumeProcess: �ѳ��Է��������˳��Ĺ��̡� (0xc000010a)
+[0427/114955.253:ERROR:process_reader_win.cc(151)] SuspendThread: �ܾ����ʡ� (0x5)
+[0427/114955.253:ERROR:exception_snapshot_win.cc(98)] thread ID 704 not found in process
+[0427/114955.253:ERROR:scoped_process_suspend.cc(40)] NtResumeProcess: �ѳ��Է��������˳��Ĺ��̡� (0xc000010a)
diff --git a/src/api/httpurl.js b/src/api/httpurl.js
index 245504a..67afc99 100644
--- a/src/api/httpurl.js
+++ b/src/api/httpurl.js
@@ -1,6 +1,6 @@
 //内网测试地址
-// let StagingUrl = 'http://192.168.0.114:9072';
-let StagingUrl = "http://120.79.193.119:9072";
+let StagingUrl = 'http://192.168.0.105:9072';
+// let StagingUrl = "http://120.79.193.119:9072";
 
 
 //mock地址
diff --git a/src/components/common/FindAlreadyReadOrNotView/index.jsx b/src/components/common/FindAlreadyReadOrNotView/index.jsx
new file mode 100644
index 0000000..50a371d
--- /dev/null
+++ b/src/components/common/FindAlreadyReadOrNotView/index.jsx
@@ -0,0 +1,91 @@
+/* eslint-disable */
+/**liuwh
+ * 4/27/2020, 3:00:42 PM
+ * doc comment for the file goes here
+ */
+
+/** Happy Coding */
+import React, { ReactNode, ReactEventHandler, Component, useEffect, useState } from 'react';
+// import { Link } from 'react-router-dom';
+import { Icon, Tabs, Avatar, Spin } from 'antd';
+import './index.scss';
+const { TabPane } = Tabs;
+import fetch from '../../../api/request';
+import moment from 'moment';
+
+export default function FindAlreadyReadOrNotView({ documentId }) {
+  useEffect(() => {
+    console.log('documentId', documentId);
+    Promise.all([initDataByType('1', setLoading1, setData1), initDataByType('2', setLoading2, setData2)]).then(res => {
+      console.log(res);
+    })
+  }, []);
+
+  function initDataByType(type, setLoading, setData) {
+
+    setLoading(true);
+    let p = new Promise((resolve, reject) => {
+      fetch({
+        url: `api/document/noticeRecord/findAlreadyReadOrNot`,
+        params: {
+          documentId,
+          alreadyRead: type
+        }
+      }).then(res => {
+        console.log('res'.res);
+        setLoading(false);
+        if (res) {
+          setData(res);
+          resolve(true);
+        }
+      })
+    });
+    return p;
+  }
+
+  const [activeKey, setActiveKey] = useState('1');
+  const [loading1, setLoading1] = useState(false);
+  const [loading2, setLoading2] = useState(false);
+
+  const [data1, setData1] = useState([]);
+  const [data2, setData2] = useState([]);
+
+  function onchange(key) {
+    console.log(key);
+  }
+
+  return (
+    <div className="find-already-read-or-not-view-main">
+      <Tabs defaultActiveKey="1" onChange={onchange}>
+        <TabPane tab={`未读(${data1.length})`} key="1">
+          <Spin spinning={loading1} style={{ height: 100 }}>
+            <div className="modal-list">
+              {
+                data1.map((a) => (
+                  <div className="flex-box-row align-center space-between modal-list-item" key={a.id}>
+                    <span className="modal-label">{a.noticeUserName || '无'}</span>
+                    <span className="modal-time">{a.createTime ? moment(a.createTime).format("YYYY-MM-DD HH:mm") : '无'}</span>
+                  </div>
+                ))
+              }
+            </div>
+          </Spin>
+        </TabPane>
+        <TabPane tab={`已读(${data2.length})`} key="2">
+          <Spin spinning={loading2} style={{ height: 100 }}>
+            <div className="modal-list" >
+              {
+                data2.map((a) => (
+                  <div className="flex-box-row align-center space-between modal-list-item" key={a.id}>
+                    <span className="modal-label">{a.noticeUserName || '无'}</span>
+                    <span className="modal-time">{a.createTime ? moment(a.createTime).format("YYYY-MM-DD HH:mm") : '无'}</span>
+                  </div>
+                ))
+              }
+            </div>
+          </Spin>
+        </TabPane>
+      </Tabs>
+    </div>
+  )
+}
diff --git a/src/components/common/FindAlreadyReadOrNotView/index.scss b/src/components/common/FindAlreadyReadOrNotView/index.scss
new file mode 100644
index 0000000..28a178c
--- /dev/null
+++ b/src/components/common/FindAlreadyReadOrNotView/index.scss
@@ -0,0 +1,21 @@
+/* eslint-disable */
+/**liuwh
+ * 4/27/2020, 3:00:42 PM
+ * doc comment for the file goes here
+ */
+
+/** Happy Coding */
+.find-already-read-or-not-view {
+  &-main {
+    & .modal-list .modal-list-item:last-child {
+      border-bottom: none;
+    }
+    & .modal-list-item {
+      border-bottom: 1px solid #ccc;
+      padding: 5px 5px 5px 20px;
+      & > span {
+        margin-right: 100px;
+      }
+    }
+  }
+}
diff --git a/src/components/common/HotListTableView/index.scss b/src/components/common/HotListTableView/index.scss
index 8c52632..5ae29c9 100644
--- a/src/components/common/HotListTableView/index.scss
+++ b/src/components/common/HotListTableView/index.scss
@@ -22,7 +22,7 @@
       margin-bottom: 0 !important;
     }
     & a:visited {
-      color: #559de6;
+      color: #559de6 !important;
     }
   }
 }
diff --git a/src/components/page/AnnouncementPage/index.jsx b/src/components/page/AnnouncementPage/index.jsx
index 45c903f..72802a0 100644
--- a/src/components/page/AnnouncementPage/index.jsx
+++ b/src/components/page/AnnouncementPage/index.jsx
@@ -9,6 +9,8 @@
 import TableView from '../../common/TableView';
 import SearchFormView from '../../common/SearchFormView';
 import moment from 'moment';
+import { Modal } from 'antd';
+import FindAlreadyReadOrNotView from '../../common/FindAlreadyReadOrNotView';
 
 import './index.scss';
 
@@ -26,6 +28,7 @@
         page: 1,
         size: 10,
       },
+      visible: false//modal的可视化状态
     };
   }
 
@@ -50,7 +53,7 @@
           return this.emoveTAG(cur)
         }
       },
-      { title: '接受情况', dataIndex: 'groupType', render: (cur, item) => <span>{item.readNumber || 0}/{item.noticeNumber || 0}</span> },
+      { title: '接受情况', dataIndex: 'groupType', render: (cur, item) => <a onClick={() => { this.setState({ visible: true, documentId: item.id }) }}><span>{item.readNumber || 0}/{item.noticeNumber || 0}</span></a> },
       { title: '通知时间', dataIndex: 'createTime', render: (cur, item) => cur !== "" && cur != null ? moment(cur).format("YYYY-MM-DD HH:mm") : "" },
       { title: '操作', render: (text, record) => <a onClick={() => this.link(record.id)}>查看</a> }
     ];
@@ -64,7 +67,7 @@
   }
 
   render() {
-    const { formData } = this.state;
+    const { formData, documentId, visible } = this.state;
 
     let tableParams = {
       url: `api/document/getNotice`,
@@ -78,6 +81,18 @@
     }
     return (
       <div className="rules-list-main">
+        <Modal
+          visible={visible}
+          onCancel={() => this.setState({ visible: false })}
+          footer={null}
+          title="接收情况"
+        >
+          {
+            documentId &&
+            <FindAlreadyReadOrNotView key={documentId} documentId={documentId} />
+          }
+
+        </Modal>
         <SearchFormView
           formData={formData}
           setFormData={this.setFormData}
diff --git a/src/components/page/index/rulesList/index.jsx b/src/components/page/index/rulesList/index.jsx
index c57276e..9802320 100644
--- a/src/components/page/index/rulesList/index.jsx
+++ b/src/components/page/index/rulesList/index.jsx
@@ -10,6 +10,7 @@
 import TableView from '../../../common/TableView';
 import SearchFormView from '../../../common/SearchFormView';
 import moment from 'moment';
+import FindAlreadyReadOrNotView from '../../../common/FindAlreadyReadOrNotView';
 
 import './index.scss';
 const { TabPane } = Tabs;
@@ -52,7 +53,7 @@
           return cur ? this.emoveTAG(cur) : '无'
         }
       },
-      { title: '接受情况', dataIndex: 'groupType', render: (cur, item) => <a onClick={() => { this.setState({ visible: true }) }}> <span>{item.readNumber || 0}/{item.noticeNumber || 0}</span></a> },
+      { title: '接受情况', dataIndex: 'groupType', render: (cur, item) => <a onClick={() => { this.setState({ visible: true, documentId: item.id }) }}> <span>{item.readNumber || 0}/{item.noticeNumber || 0}</span></a> },
       { title: '发布时间', dataIndex: 'createTime', render: (cur, item) => cur !== "" && cur != null ? moment(cur).format("YYYY-MM-DD HH:mm") : "" },
       { title: '操作', render: (text, record) => <a onClick={() => this.link(record.id)}>查看</a> }
     ];
@@ -65,8 +66,13 @@
     });
   }
 
+  onTabsChange = (key) => {
+    console.log(key);
+  }
+
+
   render() {
-    const { formData, visible } = this.state;
+    const { formData, visible, documentId } = this.state;
 
     let tableParams = {
       url: `api/document/getNotice`,
@@ -86,23 +92,10 @@
           footer={null}
           title="接收情况"
         >
-          <Tabs defaultActiveKey="1" >
-            <TabPane tab="未读" key="1">
-              <div className="modal-list">
-                {
-                  [1,2,3].map((a)=>(
-                    <div className="flex-box-row align-center modal-list-item" >
-                      <Avatar src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" />
-                      <span className="modal-label">柯礼钦</span>
-                      <span className="modal-time">2010-10-10 24:00</span>
-                    </div>
-                  ))
-                }
-              </div>
-            </TabPane>
-            <TabPane tab="已读" key="2">
-            </TabPane>
-          </Tabs>
+          {
+            documentId &&
+            <FindAlreadyReadOrNotView key={documentId} documentId={documentId}/>
+          }
 
         </Modal>
         <SearchFormView

--
Gitblit v1.8.0