Browse Source

待审批数角标显示

RaoMeng 6 years ago
parent
commit
60ae1777c4

+ 3 - 2
uas-office-web/wxuasapproval/src/components/approvalAdd/FormInput.jsx

@@ -75,6 +75,7 @@ export default class FormInput extends Component {
           okText: '确定',
           dismissText: '取消',
         }}
+        format={'YYYY/MM/DD HH:mm'}
         mode={type === 'DT' ? 'datetime' : 'date'}
         extra={(billModel.readOnly === 'T' ||
           billModel.editable === 'F') ? '' : type === 'DT' ? '选择时间' : '选择日期'}
@@ -169,7 +170,7 @@ export default class FormInput extends Component {
 
   onInputClick = e => {
     const { billModel } = this.state
-    if(this.isSelect(billModel)){
+    if (this.isSelect(billModel)) {
       if (!isObjEmpty(billModel.localDatas)) {
         this.setState({
           modalList: billModel.localDatas,
@@ -228,7 +229,7 @@ export default class FormInput extends Component {
       case 'SF':
       case 'DF':
         return false
-        // return true
+      // return true
     }
     return false
   }

+ 80 - 27
uas-office-web/wxuasapproval/src/pages/approval/Approval.jsx

@@ -452,6 +452,16 @@ class Approval extends Component {
               <div className={disagreeAble ? 'menuItem' : 'displayNone'}
                    onClick={this.approvalDisagree}>不同意
               </div>
+              {/*<div className={disagreeAble ? '' : 'displayNone'}
+                   style={{
+                     background: '#cccccc',
+                     width: '1px',
+                     height: '24px',
+                   }}></div>
+
+              <div className={approvalStatus === 0 ? 'menuItem' : 'displayNone'}
+                   onClick={this.loadNextProcess}>下一条
+              </div>*/}
             </div>
           </div>
         }
@@ -688,11 +698,7 @@ class Approval extends Component {
       '_noc': 1,
       // 'sessionId': mSessionId,
       // 'sessionUser': mEmcode,
-    }, {
-      // 'Cookie': 'JSESSIONID=' + mSessionId,
-      // "Content-Type": "application/json; charset=UTF-8"
     }).then((response) => {
-      console.log('response', response)
       try {
         let result = response
         let infoObject = result.info
@@ -819,7 +825,6 @@ class Approval extends Component {
         // 'Cookie': 'JSESSIONID=' + mSessionId
       }).then((response) => {
       let result = response
-      console.log('form', result)
       let datas = result.datas
       if (!isObjNull(datas)) {
 
@@ -1852,6 +1857,7 @@ class Approval extends Component {
           saveReceiveState({ listData })()
         }
       }
+      this.loadNextProcess()
     }).catch(error => {
       Toast.hide()
       if (typeof error === 'string') {
@@ -1961,6 +1967,7 @@ class Approval extends Component {
           saveReceiveState({ listData })()
         }
       }
+      this.loadNextProcess()
     }).catch(error => {
       Toast.hide()
       if (typeof error === 'string') {
@@ -1995,33 +2002,30 @@ class Approval extends Component {
         _center: 0,
         _noc: 1,
       }).then(response => {
+        Toast.hide()
         if (response.result == true) {
           let nextnode = response.nextnode
-          // if (!isObjEmpty(nextnode)) {
-          //   mNodeId = nextnode
-          //   message.success('处理人变更成功')
-          //   message.success('正在自动跳转下一条')
-          //   this.initPageState()
-          //   this.getCurrentNode()
-          // } else {
-          Toast.hide()
-          message.success('处理人变更成功')
-          this.setState({
-            approvalStatus: 4,
-          })
-          if (mType == 0) {
-            let { homeState: { receiveState: { tabIndex, itemIndex, listData } } } = this.props
-            if (tabIndex == 0 && !isObjEmpty(listData) && listData.length >
-              itemIndex) {
-              listData.splice(itemIndex, 1)
-              saveReceiveState({ listData })()
+          if (!isObjEmpty(nextnode)) {
+            mNodeId = nextnode
+            message.success('处理人变更成功')
+            this.toNextNode()
+          } else {
+            message.success('处理人变更成功')
+            this.setState({
+              approvalStatus: 4,
+            })
+            if (mType == 0) {
+              let { homeState: { receiveState: { tabIndex, itemIndex, listData } } } = this.props
+              if (tabIndex == 0 && !isObjEmpty(listData) && listData.length >
+                itemIndex) {
+                listData.splice(itemIndex, 1)
+                saveReceiveState({ listData })()
+              }
+              this.props.history.goBack()
             }
-            this.props.history.goBack()
+            message.warn('没有下一条待审批单据')
           }
-          // message.warn('没有下一条数据')
-          // }
         } else {
-          Toast.hide()
           message.error('变更处理人失败')
         }
       }).catch(error => {
@@ -2042,6 +2046,55 @@ class Approval extends Component {
     })
   }
 
+  /**
+   * 跳转下一条审批数据
+   */
+  toNextNode () {
+    message.loading('跳转下一条审批单据', 1)
+    this.props.history.replace('/approval/%7B%22' +
+      'master%22%3A%22' + mMaster
+      + '%22%2C%22nodeId%22%3A' + mNodeId
+      + (mType === undefined ? '' : ('%2C%22type%22%3A' + mType))
+      + '%2C%22baseUrl%22%3A%22' + encodeURIComponent(mBaseUrl)
+      + '%22%7D')
+    this.initPageState()
+    this.getCurrentNode()
+    saveReceiveState({
+      scrollTop: 0,
+      listData: [],
+      hasMore1: true,
+      pageIndex: 1,
+    })()
+  }
+
+  /**
+   * 获取下一条审批数据
+   */
+  loadNextProcess = () => {
+    Toast.loading('正在获取下一条审批数据', 0)
+    fetchPost(mBaseUrl + '/common/getNextProcess.action', {
+      taskId: mNodeId,
+      master: mMaster,
+      _noc: 1,
+    }).then(response => {
+      Toast.hide()
+      let nextNode = response.nodeId
+      if (!isObjEmpty(nextNode)) {
+        mNodeId = nextNode
+        this.toNextNode()
+      } else {
+        message.warn('没有下一条待审批单据')
+      }
+    }).catch(error => {
+      Toast.hide()
+      if (typeof error === 'string') {
+        message.error(error)
+      } else {
+        message.error('审批单据获取失败')
+      }
+    })
+  }
+
   inputAllInput = () => {
     const { mainList, detailList } = this.state
 

+ 2 - 2
uas-office-web/wxuasapproval/src/pages/approval/ApprovalAdd.jsx

@@ -55,8 +55,8 @@ let mShowBillModels, mFormBillModels, mUpdateBillModels, mAllBillModels
 
 let mBaseUrl = window.location.origin
   + (process.env.REACT_APP_ROUTER_BASE_NAME || '/ERP')
-// && 'http://erp.yitoa.com:8888/ERP'
-// && 'http://29226oq576.qicp.vip/erp'
+  // && 'http://yrkj.usoftchina.com:9443/uas'
+  // && 'http://29226oq576.qicp.vip/erp'
 
 export default class ApprovalAdd extends Component {
 

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

@@ -11,7 +11,7 @@ import './approval.css'
 import Swiper from 'swiper/js/swiper.min'
 import 'swiper/css/swiper.min.css'
 import RefreshLayout from '../../components/RefreshLayout'
-import { isObjEmpty, isObjNull } from '../../utils/common'
+import { getIntValue, isObjEmpty, isObjNull } from '../../utils/common'
 import { fetchGet } from '../../utils/fetchRequest'
 import { connect } from 'react-redux'
 import { LocalImgs } from '../../configs/Constants'
@@ -38,7 +38,7 @@ let mSendIndex = 0
 
 let mBaseUrl = window.location.origin
   + (process.env.REACT_APP_ROUTER_BASE_NAME || '/ERP')
-  // && 'http://erp.yitoa.com:8888/ERP'
+  // && 'http://yrkj.usoftchina.com:9443/uas'
   // && 'http://29226oq576.qicp.vip/erp'
 
 class ApprovalHome extends Component {
@@ -252,7 +252,8 @@ class ApprovalHome extends Component {
         icon={<CustomIcon type='icon-receive'/>}
         selectedIcon={<CustomIcon type="icon-receive-selected"/>}
         selected={this.props.homeState.selectedTab === 1}
-        // badge={''}
+        badge={this.props.homeState.receiveState
+          ? this.props.homeState.receiveState.todoCount : 0}
         onPress={this.onTab2Selected}
       >
         {this.renderReceiveTab()}
@@ -891,7 +892,6 @@ class ApprovalHome extends Component {
         isReceiveTodoLoading: false,
         isReceiveTodoRefresh: false,
       })
-      console.log('raomeng', response)
       if (response && !isObjEmpty(response.data)) {
         listData = listData.concat(response.data)
       } else {
@@ -904,6 +904,7 @@ class ApprovalHome extends Component {
           || response.data.length < mPageSize),
         listData,
         pageIndex: mTodoIndex,
+        todoCount: getIntValue(response, 'totalCount'),
       })()
     }).catch(error => {
       if (mTodoIndex > 1) {
@@ -954,7 +955,6 @@ class ApprovalHome extends Component {
         isReceiveDoneLoading: false,
         isReceiveDoneRefresh: false,
       })
-      console.log('raomeng', response)
       if (response && !isObjEmpty(response.data)) {
         listData2 = listData2.concat(response.data)
       } else {

+ 1 - 0
uas-office-web/wxuasapproval/src/redux/reducers/redHomeState.js

@@ -17,6 +17,7 @@ const initReceiveState = {
   tabIndex: 0,
   itemIndex: -1,
   searchKey: '',
+  todoCount: 0,
 
   scrollTop: 0,
   listData: [],