소스 검색

U审批首页列表展示初步完成

RaoMeng 5 년 전
부모
커밋
f744c76969

+ 9 - 8
uas-office-web/wxuasapproval/src/components/approvalItem/ApprovalItem.jsx

@@ -30,13 +30,12 @@ export default class ApprovalItem extends Component {
     return (
       <div style={{ padding: '0 10px' }} onClick={this.onItemClick}>
         <div className='recharge-item-root'>
-          <div className='common-flex-row homework-item-title-layout'>
-            <div style={{ width: '85%' }}
-                 className='homework-item-title'>{approval.JP_LAUNCHERNAME +
-            '的' + approval.JP_NAME}</div>
+          <div className='homework-item-title-layout'>
+            {approval.JP_LAUNCHERNAME +
+            '的' + approval.JP_NAME}
           </div>
           <div className='gray-line'
-               style={{ height: '1px', marginBottom: '10px' }}></div>
+               style={{ height: '1px', marginBottom: '4px' }}></div>
           <div className='recharge-item-line'>
             <div className='recharge-item-caption'>单号:</div>
             <div className='recharge-item-value'>
@@ -54,8 +53,10 @@ export default class ApprovalItem extends Component {
                 approval.JN_DEALTIME).format('YYYY-MM-DD HH:mm:ss') : ''
             }</div>
           </div>
-          <div className='recharge-item-line' style={{ paddingBottom: '20px' }}>
-            <div className='recharge-item-caption'>单据状态:</div>
+          <div className='recharge-item-line' style={{ paddingBottom: '6px' }}>
+            <div className='recharge-item-caption'>{approval.JP_STATUS
+              ? '单据状态:'
+              : approval.JN_DEALRESULT ? '审批结果:' : '状态'}</div>
             <div className='recharge-item-value'>{approval.JP_STATUS ||
             approval.JN_DEALRESULT}</div>
           </div>
@@ -66,7 +67,7 @@ export default class ApprovalItem extends Component {
 
   onItemClick = () => {
     if (this.props.onItemClick) {
-      this.props.onItemClick(this.props.index)
+      this.props.onItemClick(this.props.index, this.props.approval)
     }
   }
 }

+ 5 - 8
uas-office-web/wxuasapproval/src/components/approvalItem/approvalItem.css

@@ -1,17 +1,17 @@
 .recharge-item-root {
     width: 100%;
     background: white;
-    border-radius: 6px;
+    border-radius: 5px;
     display: flex;
     flex-direction: column;
     box-sizing: border-box;
-    margin: 20px 0;
+    margin: 10px 0;
 }
 
 .recharge-item-line {
     width: 100%;
     display: flex;
-    padding: 5px 0 5px 20px;
+    padding: 2px 2px 2px 10px;
     font-family: PingFangSC-Regular;
     font-size: 13px;
     letter-spacing: 0;
@@ -49,12 +49,9 @@
 }
 
 .homework-item-title-layout {
-    padding: 12px 20px 6px;
-}
-
-.homework-item-title {
+    padding: 8px 10px 4px;
     font-family: PingFangSC-Regular;
-    font-size: 16px;
+    font-size: 14px;
     color: #000;
     letter-spacing: 0;
     flex: 1;

+ 9 - 1
uas-office-web/wxuasapproval/src/index.css

@@ -30,7 +30,7 @@ code {
     background: #dedede;
 }
 
-.displayNone{
+.displayNone {
     display: none;
 }
 
@@ -60,3 +60,11 @@ code {
     align-items: center;
 }
 
+.am-tabs-pane-wrap.am-tabs-pane-wrap-active::-webkit-scrollbar {
+    display: none;
+}
+
+.am-pull-to-refresh.am-pull-to-refresh-up::-webkit-scrollbar {
+    display: none;
+}
+

+ 242 - 56
uas-office-web/wxuasapproval/src/pages/approval/ApprovalHome.jsx

@@ -15,16 +15,27 @@ import { isObjEmpty } from '../../utils/common'
 import { fetchGet } from '../../utils/fetchRequest'
 import { connect } from 'react-redux'
 import {
-  saveNewListState,
-  saveReceiveListState,
+  clearHomeState,
+  clearNewState,
+  clearReceiveState,
+  clearSendState,
+  freshHomeState,
+  saveNewState,
+  saveReceiveState,
+  saveSendState,
 } from '../../redux/actions/homeState'
 import ApprovalItem from '../../components/approvalItem/ApprovalItem'
 
-let mBaseUrl = 'https://218.17.253.75:9443/uas_dev'
-// let mBaseUrl = 'http://erp.yitoa.com:8888/ERP'
+let mBaseUrl = 'http://29226oq576.qicp.vip/uas/'
+// let mBaseUrl = 'https://218.17.253.75:9443/uas_dev/'
+// let mBaseUrl = 'http://erp.yitoa.com:8888/ERP/'
+
+let mMaster = 'UAS_DEV'
+
 const mPageSize = 20
 let mTodoIndex = 0
 let mDoneIndex = 0
+let mSendIndex = 0
 
 class ApprovalHome extends Component {
 
@@ -32,14 +43,16 @@ class ApprovalHome extends Component {
     super()
 
     this.state = {
-      selectedTab: 0,
       tabHidden: false,
       isNewMenuLoading: true,
       isReceiveTodoLoading: true,
       isReceiveDoneLoading: true,
-      isReceiveTodoRefresh: true,
-      isReceiveDoneRefresh: true,
+      isReceiveTodoRefresh: false,
+      isReceiveDoneRefresh: false,
       receiveHeight: document.documentElement.clientHeight,
+      sendHeight: document.documentElement.clientHeight,
+      isSendRefresh: false,
+      isSendLoading: true,
     }
   }
 
@@ -47,30 +60,25 @@ class ApprovalHome extends Component {
     // 用于刷新组建确认高度
     if (ReactDOM.findDOMNode(this.contain)) {
       const hei = this.state.receiveHeight -
-        ReactDOM.findDOMNode(this.contain).offsetTop
+        ReactDOM.findDOMNode(this.contain).offsetTop - 50
       this.setState({
         receiveHeight: hei,
       })
     }
+    if (ReactDOM.findDOMNode(this.sendList)) {
+      const hei = this.state.sendHeight -
+        ReactDOM.findDOMNode(this.sendList).offsetTop - 50
+      this.setState({
+        sendHeight: hei,
+      })
+    }
     document.title = '审批'
 
     const { homeState } = this.props
-    const { newState, receiveState, sendState } = homeState
-    this.mySwiper = new Swiper('.swiper-container', {
-      autoplay: false,
-      loop: false,
-      noSwiping: false,
-      initialSlide: receiveState.tabIndex,
-      on: {
-        slideChangeTransitionEnd: function () {
-          saveReceiveListState({
-            tabIndex: this.activeIndex,
-          })()
-        },
-      },
-    })
+    const { newState, receiveState, sendState, selectedTab } = homeState
+
+    this.initSwiper(receiveState)
 
-    const { selectedTab } = this.state
     switch (selectedTab) {
       case 0: {
         this.initNew(newState)
@@ -81,6 +89,7 @@ class ApprovalHome extends Component {
         break
       }
       case 2: {
+        this.initSend(sendState)
         break
       }
       default:
@@ -88,6 +97,22 @@ class ApprovalHome extends Component {
     }
   }
 
+  initSwiper (receiveState) {
+    this.mySwiper = new Swiper('.swiper-container', {
+      autoplay: false,
+      loop: false,
+      noSwiping: false,
+      initialSlide: receiveState.tabIndex,
+      on: {
+        slideChangeTransitionEnd: function () {
+          saveReceiveState({
+            tabIndex: this.activeIndex,
+          })()
+        },
+      },
+    })
+  }
+
   initNew (newState) {
     if (!isObjEmpty(newState.newMenuList)) {
       this.setState({
@@ -133,8 +158,21 @@ class ApprovalHome extends Component {
     }
   }
 
-  componentWillUnmount () {
+  initSend (sendState) {
+    if (!isObjEmpty(sendState.sendList)) {
+      this.setState({
+        isSendLoading: false,
+      }, () => {
+        ReactDOM.findDOMNode(this.sendList).scrollTop =
+          sendState.scrollTop
+      })
+    } else {
+      this.loadSendList()
+    }
+  }
 
+  componentWillUnmount () {
+    // clearHomeState()()
   }
 
   render () {
@@ -168,7 +206,7 @@ class ApprovalHome extends Component {
                     style={{ color: '#949494' }}/>}
         selectedIcon={<Icon type="file-add" theme={'filled'}
                             style={{ color: '#33A3F4' }}/>}
-        selected={this.state.selectedTab === 0}
+        selected={this.props.homeState.selectedTab === 0}
         // badge={''}
         onPress={this.onTab1Selected}
       >
@@ -190,7 +228,7 @@ class ApprovalHome extends Component {
                     style={{ color: '#949494' }}/>}
         selectedIcon={<Icon type="file-add" theme={'filled'}
                             style={{ color: '#33A3F4' }}/>}
-        selected={this.state.selectedTab === 1}
+        selected={this.props.homeState.selectedTab === 1}
         // badge={''}
         onPress={this.onTab2Selected}
       >
@@ -212,7 +250,7 @@ class ApprovalHome extends Component {
                     style={{ color: '#949494' }}/>}
         selectedIcon={<Icon type="file-add" theme={'filled'}
                             style={{ color: '#33A3F4' }}/>}
-        selected={this.state.selectedTab === 2}
+        selected={this.props.homeState.selectedTab === 2}
         // badge={''}
         onPress={this.onTab3Selected}
       >
@@ -222,28 +260,44 @@ class ApprovalHome extends Component {
   }
 
   onTab1Selected = () => {
-    const { selectedTab, isNewMenuLoading } = this.state
-    const { homeState: { newState } } = this.props
+    const { isNewMenuLoading } = this.state
+    const { homeState: { newState, selectedTab } } = this.props
     if (selectedTab === 0) {
       // 刷新页面
       if (!isNewMenuLoading) {
+        this.setState({
+          isNewMenuLoading: true,
+        })
+        clearNewState()()
         this.getNewMenuData()
       }
     } else {
       if (isObjEmpty(newState.newMenuList)) {
+        this.setState({
+          isNewMenuLoading: true,
+        })
         this.getNewMenuData()
+      } else {
+        this.setState({
+          isNewMenuLoading: false,
+        }, () => {
+          ReactDOM.findDOMNode(this.newList).scrollTop =
+            newState.scrollTop
+        })
       }
     }
-    this.setState({
+    freshHomeState({
       selectedTab: 0,
-    })
+    })()
   }
 
   onTab2Selected = () => {
-    const { selectedTab, isReceiveTodoLoading, isReceiveDoneLoading } = this.state
-    const { homeState: { receiveState } } = this.props
+    const { isReceiveTodoLoading, isReceiveDoneLoading } = this.state
+    const { homeState: { receiveState, selectedTab } } = this.props
     if (selectedTab === 1) {
       // 刷新页面
+      clearReceiveState()()
+      this.mySwiper.slideTo(0, 0, false)
       if (!isReceiveTodoLoading) {
         this.setState({
           isReceiveTodoLoading: true,
@@ -290,21 +344,41 @@ class ApprovalHome extends Component {
         mDoneIndex = receiveState.pageIndex2
       }
     }
-    this.setState({
+    freshHomeState({
       selectedTab: 1,
-    })
+    })()
   }
 
   onTab3Selected = () => {
-    const { selectedTab } = this.state
+    const { isSendLoading } = this.state
+    const { homeState: { sendState, selectedTab } } = this.props
     if (selectedTab === 2) {
       // 刷新页面
-      console.log('raomeng', 'tab3')
+      clearSendState()()
+      if (!isSendLoading) {
+        this.setState({
+          isSendLoading: true,
+        })
+        this.loadSendList()
+      }
     } else {
+      if (isObjEmpty(sendState.sendList)) {
+        this.setState({
+          isSendLoading: true,
+        })
+        this.loadSendList()
+      } else {
+        this.setState({
+          isSendLoading: false,
+        }, () => {
+          ReactDOM.findDOMNode(this.sendList).scrollTop =
+            sendState.scrollTop
+        })
+      }
     }
-    this.setState({
+    freshHomeState({
       selectedTab: 2,
-    })
+    })()
   }
 
   renderNewTab = () => {
@@ -343,7 +417,7 @@ class ApprovalHome extends Component {
                      this.loadTodoList()
                    }
                  } else {
-                   saveReceiveListState({
+                   saveReceiveState({
                      tabIndex: 0,
                    })()
                    this.mySwiper.slideTo(0, 300, false)
@@ -362,7 +436,7 @@ class ApprovalHome extends Component {
                      this.loadDoneList()
                    }
                  } else {
-                   saveReceiveListState({
+                   saveReceiveState({
                      tabIndex: 1,
                    })()
                    this.mySwiper.slideTo(1, 300, false)
@@ -386,6 +460,31 @@ class ApprovalHome extends Component {
       </div>
     )
   }
+  renderSendTab = () => {
+    return (
+      <div className='receive-content-root'>
+        <RefreshLayout
+          ref={el => {
+            this.sendList = el
+          }}
+          refreshing={this.state.isSendRefresh}
+          onRefresh={this.loadSendList}
+          height={this.state.sendHeight}>
+          <Skeleton loading={this.state.isSendLoading} active
+                    paragraph={{ rows: 4 }}>
+            <List split={false}
+                  dataSource={this.props.homeState.sendState.sendList}
+                  renderItem={(item, index) => (
+                    <ApprovalItem approval={item}
+                                  onItemClick={this.onSendItemClick.bind(this)}
+                                  index={index}/>
+                  )}/>
+          </Skeleton>
+        </RefreshLayout>
+      </div>
+    )
+  }
+
   renderReceiveTodoItems = () => (
     <div className='receive-content-root'>
       <RefreshLayout
@@ -432,12 +531,6 @@ class ApprovalHome extends Component {
     </div>
   )
 
-  renderSendTab = () => {
-    return (
-      <div>我发起的</div>
-    )
-  }
-
   getNewMenu = () => {
     const { homeState } = this.props
     let newMenu = []
@@ -463,11 +556,49 @@ class ApprovalHome extends Component {
   }
 
   onFuncClick = (obj) => {
+    saveNewState({
+      scrollTop: ReactDOM.findDOMNode(this.newList).scrollTop,
+    })()
+  }
 
+  onReceiveItemClick = (index, approval) => {
+    saveReceiveState({
+      scrollTop: ReactDOM.findDOMNode(this.todoTab).scrollTop,
+      scrollTop2: ReactDOM.findDOMNode(this.doneTab).scrollTop,
+      itemIndex: index,
+    })()
+    let jp_form = approval.JP_FORM
+    let currentmaster = approval.CURRENTMASTER
+    if (!isObjEmpty(jp_form) && !isObjEmpty(currentmaster) &&
+      (jp_form.indexOf(currentmaster) != -1)) {
+
+    } else {
+      currentmaster = mMaster
+    }
+    this.props.history.push('/approval/%7B%22' +
+      'master%22%3A%22' + currentmaster
+      + '%22%2C%22nodeId%22%3A' + approval.JP_NODEID
+      + '%2C%22baseUrl%22%3A%22' + encodeURIComponent(mBaseUrl)
+      + '%22%7D')
   }
 
-  onReceiveItemClick = () => {
+  onSendItemClick = (index, approval) => {
+    saveSendState({
+      scrollTop: ReactDOM.findDOMNode(this.sendList).scrollTop,
+    })()
+    let jp_form = approval.JP_FORM
+    let currentmaster = approval.CURRENTMASTER
+    if (!isObjEmpty(jp_form) && !isObjEmpty(currentmaster) &&
+      (jp_form.indexOf(currentmaster) != -1)) {
 
+    } else {
+      currentmaster = mMaster
+    }
+    this.props.history.push('/approval/%7B%22' +
+      'master%22%3A%22' + currentmaster
+      + '%22%2C%22nodeId%22%3A' + approval.JP_NODEID
+      + '%2C%22baseUrl%22%3A%22' + encodeURIComponent(mBaseUrl)
+      + '%22%7D')
   }
 
   getNewMenuData = () => {
@@ -475,7 +606,7 @@ class ApprovalHome extends Component {
       isNewMenuLoading: true,
     })
 
-    fetchGet(mBaseUrl + '/api/serve/mainPage/getServices.action', {
+    fetchGet(mBaseUrl + 'api/serve/mainPage/getServices.action', {
       kind: 'app',
     }).then(response => {
       this.setState({
@@ -486,7 +617,7 @@ class ApprovalHome extends Component {
       if (isObjEmpty(configs)) {
         message.warn('菜单数据为空')
       } else {
-        saveNewListState({
+        saveNewState({
           newMenuList: configs,
         })()
       }
@@ -515,7 +646,7 @@ class ApprovalHome extends Component {
       listData.length = 0
     }
 
-    fetchGet(mBaseUrl + '/common/desktop/process/toDo.action', {
+    fetchGet(mBaseUrl + 'common/desktop/process/toDo.action', {
       count: mPageSize,
       page: mTodoIndex,
     }).then(response => {
@@ -531,7 +662,7 @@ class ApprovalHome extends Component {
           mTodoIndex--
         }
       }
-      saveReceiveListState({
+      saveReceiveState({
         listData,
         pageIndex: mTodoIndex,
       })()
@@ -539,7 +670,7 @@ class ApprovalHome extends Component {
       if (mTodoIndex > 1) {
         mTodoIndex--
       }
-      saveReceiveListState({
+      saveReceiveState({
         listData,
         pageIndex: mTodoIndex,
       })()
@@ -568,7 +699,7 @@ class ApprovalHome extends Component {
       listData2.length = 0
     }
 
-    fetchGet(mBaseUrl + '/common/desktop/process/alreadyDo.action', {
+    fetchGet(mBaseUrl + 'common/desktop/process/alreadyDo.action', {
       count: mPageSize,
       page: mDoneIndex,
       isMobile: 1,
@@ -586,7 +717,7 @@ class ApprovalHome extends Component {
           mDoneIndex--
         }
       }
-      saveReceiveListState({
+      saveReceiveState({
         listData2,
         pageIndex: mDoneIndex,
       })()
@@ -594,7 +725,7 @@ class ApprovalHome extends Component {
       if (mDoneIndex > 1) {
         mDoneIndex--
       }
-      saveReceiveListState({
+      saveReceiveState({
         listData2,
         pageIndex: mDoneIndex,
       })()
@@ -609,6 +740,61 @@ class ApprovalHome extends Component {
       }
     })
   }
+
+  loadSendList = () => {
+    mSendIndex++
+    if (!this.state.isSendLoading) {
+      this.setState({
+        isSendRefresh: true,
+      })
+    }
+
+    let { homeState: { sendState: { sendList } } } = this.props
+    if (mSendIndex === 1) {
+      sendList.length = 0
+    }
+
+    fetchGet(mBaseUrl + 'common/desktop/process/alreadyLaunch.action', {
+      count: mPageSize,
+      page: mSendIndex,
+      isMobile: 1,
+      _do: 1,
+    }).then(response => {
+      this.setState({
+        isSendLoading: false,
+        isSendRefresh: false,
+      })
+      console.log('raomeng', response)
+      if (response && !isObjEmpty(response.data)) {
+        sendList = sendList.concat(response.data)
+      } else {
+        if (mSendIndex > 1) {
+          mSendIndex--
+        }
+      }
+      saveSendState({
+        sendList,
+        pageIndex: mSendIndex,
+      })()
+    }).catch(error => {
+      if (mSendIndex > 1) {
+        mSendIndex--
+      }
+      saveSendState({
+        sendList,
+        pageIndex: mSendIndex,
+      })()
+      this.setState({
+        isSendLoading: false,
+        isSendRefresh: false,
+      })
+      if (typeof error === 'string') {
+        message.error(error)
+      } else {
+        message.error('列表请求异常')
+      }
+    })
+  }
 }
 
 class MenuGroup extends Component {

+ 7 - 4
uas-office-web/wxuasapproval/src/pages/approval/approval.css

@@ -159,7 +159,7 @@
 }
 
 .newMenu-group-layout {
-    padding: 15px 10px 8px;
+    padding: 10px 8px 6px;
     display: flex;
     flex-direction: row;
     align-items: center;
@@ -182,7 +182,7 @@
 .newMenu-func-root {
     width: 25%;
     display: inline-block;
-    padding: 10px;
+    padding: 8px;
 }
 
 .newMenu-func-layout {
@@ -193,8 +193,8 @@
 }
 
 .newMenu-func-icon {
-    width: 42px;
-    height: 42px;
+    width: 36px;
+    height: 36px;
 }
 
 .newMenu-func-text {
@@ -228,6 +228,9 @@
     overflow: scroll;
 }
 
+.receive-content-root::-webkit-scrollbar {
+    display: none;
+}
 
 .identity-select {
     display: flex;

+ 46 - 5
uas-office-web/wxuasapproval/src/redux/actions/homeState.js

@@ -5,8 +5,13 @@
 
 import {
   CLEAR_HOME_STATE,
+  CLEAR_NEW_STATE,
+  CLEAR_RECEIVE_STATE,
+  CLEAR_SEND_STATE,
+  FRESH_HOME_STATE,
   NEW_TAB_STATE,
-  RECEIVE_TAB_STATE, SEND_TAB_STATE,
+  RECEIVE_TAB_STATE,
+  SEND_TAB_STATE,
 } from '../constants/actionTypes'
 import store from '../store/store'
 
@@ -15,7 +20,7 @@ import store from '../store/store'
  * @param data
  * @returns {Function}
  */
-export const saveNewListState = (data) => {
+export const saveNewState = (data) => {
   return () => {
     store.dispatch({
       type: NEW_TAB_STATE,
@@ -29,7 +34,7 @@ export const saveNewListState = (data) => {
  * @param data
  * @returns {Function}
  */
-export const saveReceiveListState = (data) => {
+export const saveReceiveState = (data) => {
   return () => {
     store.dispatch({
       type: RECEIVE_TAB_STATE,
@@ -43,7 +48,7 @@ export const saveReceiveListState = (data) => {
  * @param data
  * @returns {Function}
  */
-export const saveSendListState = (data) => {
+export const saveSendState = (data) => {
   return () => {
     store.dispatch({
       type: SEND_TAB_STATE,
@@ -52,11 +57,47 @@ export const saveSendListState = (data) => {
   }
 }
 
+export const clearNewState = (data) => {
+  return () => {
+    store.dispatch({
+      type: CLEAR_NEW_STATE,
+      ...data,
+    })
+  }
+}
+
+export const clearReceiveState = (data) => {
+  return () => {
+    store.dispatch({
+      type: CLEAR_RECEIVE_STATE,
+      ...data,
+    })
+  }
+}
+
+export const clearSendState = (data) => {
+  return () => {
+    store.dispatch({
+      type: CLEAR_SEND_STATE,
+      ...data,
+    })
+  }
+}
+
+export const freshHomeState = (data) => {
+  return () => {
+    store.dispatch({
+      type: FRESH_HOME_STATE,
+      ...data,
+    })
+  }
+}
+
 /**
  * 清除列表状态
  * @returns {Function}
  */
-export const clearListState = () => {
+export const clearHomeState = () => {
   return () => {
     store.dispatch({
       type: CLEAR_HOME_STATE,

+ 4 - 0
uas-office-web/wxuasapproval/src/redux/constants/actionTypes.js

@@ -1,5 +1,9 @@
 export const USER_LOGIN = 'USER_LOGIN'
+export const FRESH_HOME_STATE = 'FRESH_HOME_STATE'
 export const NEW_TAB_STATE = 'NEW_TAB_STATE'
 export const RECEIVE_TAB_STATE = 'RECEIVE_TAB_STATE'
 export const SEND_TAB_STATE = 'SEND_TAB_STATE'
+export const CLEAR_NEW_STATE = 'CLEAR_NEW_STATE'
+export const CLEAR_RECEIVE_STATE = 'CLEAR_RECEIVE_STATE'
+export const CLEAR_SEND_STATE = 'CLEAR_SEND_STATE'
 export const CLEAR_HOME_STATE = 'CLEAR_HOME_STATE'

+ 55 - 21
uas-office-web/wxuasapproval/src/redux/reducers/redHomeState.js

@@ -1,31 +1,41 @@
 import {
   CLEAR_HOME_STATE,
+  CLEAR_NEW_STATE,
+  CLEAR_RECEIVE_STATE,
+  CLEAR_SEND_STATE,
+  FRESH_HOME_STATE,
   NEW_TAB_STATE,
-  RECEIVE_TAB_STATE, SEND_TAB_STATE,
+  RECEIVE_TAB_STATE,
+  SEND_TAB_STATE,
 } from '../constants/actionTypes'
 
-const initListState = {
-  newState: {
-    newMenuList: [],
-    scrollTop: 0,
-  },
-  receiveState: {
-    tabIndex: 0,
+const initNewState = {
+  newMenuList: [],
+  scrollTop: 0,
+}
+const initReceiveState = {
+  tabIndex: 0,
+  itemIndex: -1,
+
+  scrollTop: 0,
+  listData: [],
+  pageIndex: 1,
+
+  scrollTop2: 0,
+  listData2: [],
+  pageIndex2: 1,
+}
 
-    scrollTop: 0,
-    listData: [],
-    pageIndex: 1,
-    itemIndex: -1,
+const initSendState = {
+  sendList: [],
+  scrollTop: 0,
+}
 
-    scrollTop2: 0,
-    listData2: [],
-    pageIndex2: 1,
-    itemIndex2: -1,
-  },
-  sendState: {
-    sendList: [],
-    scrollTop: 0,
-  },
+const initListState = {
+  selectedTab: 0,
+  newState: initNewState,
+  receiveState: initReceiveState,
+  sendState: initSendState,
 }
 
 const redHomeState = (state = initListState, action) => {
@@ -61,6 +71,30 @@ const redHomeState = (state = initListState, action) => {
           ...action,
         },
       }
+    case CLEAR_NEW_STATE:
+      //清除新建菜单数据
+      return {
+        ...state,
+        newState: initNewState,
+      }
+    case CLEAR_RECEIVE_STATE:
+      //清除[我审批的]数据
+      return {
+        ...state,
+        receiveState: initReceiveState,
+      }
+    case CLEAR_SEND_STATE:
+      //清除[我发起的]数据
+      return {
+        ...state,
+        sendState: initSendState,
+      }
+    case FRESH_HOME_STATE:
+      //更新首页数据
+      return {
+        ...state,
+        ...action,
+      }
     case CLEAR_HOME_STATE:
       //清空首页数据
       return initListState