Browse Source

Merge remote-tracking branch 'origin/master'

wuyx 6 years ago
parent
commit
c1163ff91c

+ 6 - 8
uas-office-web/wxuasapproval/src/components/approvalAdd/FormInput.jsx

@@ -81,7 +81,7 @@ export default class FormInput extends Component {
         disabled={(billModel.readOnly === 'T' ||
           billModel.editable === 'F') ? true : false}
         value={!isObjEmpty(billModel.getValue())
-          ? new Date(billModel.getValue())
+          ? new Date(billModel.getValue().replace(/\-/g, '/'))
           : ''}
         onChange={this.onDateChange}
       >
@@ -169,9 +169,8 @@ export default class FormInput extends Component {
 
   onInputClick = e => {
     const { billModel } = this.state
-    if(this.isSelect(billModel)){
+    if (this.isSelect(billModel)) {
       if (!isObjEmpty(billModel.localDatas)) {
-        console.log('modaldata', billModel.localDatas)
         this.setState({
           modalList: billModel.localDatas,
           modalOpen: true,
@@ -198,18 +197,17 @@ export default class FormInput extends Component {
 
   onDateChange = date => {
     const { billModel } = this.state
-    let dateStr = moment(date).
+    let dateValue = moment(date).
       format((billModel.type === 'D' || billModel.type === 'T')
         ? 'YYYY-MM-DD 00:00:00'
         : 'YYYY-MM-DD HH:mm:ss')
-    console.log('date', dateStr)
-    billModel.value = dateStr
+    billModel.value = dateValue
     this.setState({
       billModel,
     }, () => {
       this.props.onTextChange &&
       this.props.onTextChange(this.props.groupIndex, this.props.childIndex,
-        dateStr)
+        dateValue)
     })
   }
 
@@ -229,7 +227,7 @@ export default class FormInput extends Component {
       case 'SF':
       case 'DF':
         return false
-        // return true
+      // return true
     }
     return false
   }

+ 116 - 114
uas-office-web/wxuasapproval/src/components/approvalItem/ApprovalItem.jsx

@@ -1,114 +1,116 @@
-/**
- * Created by RaoMeng on 2020/2/18
- * Desc: 审批列表item
- */
-
-import React, { Component } from 'react'
-import './approvalItem.css'
-import moment from 'moment'
-import { isObjEmpty } from '../../utils/common'
-
-export default class ApprovalItem extends Component {
-
-  constructor () {
-    super()
-
-    this.state = {}
-  }
-
-  componentDidMount () {
-
-  }
-
-  componentWillUnmount () {
-
-  }
-
-  render () {
-    const { approval, type } = this.props
-    let approvalStatus = '等待我审批'
-    let statusColor = '#33A3F4'
-    if (type === 2) {
-      approvalStatus = approval.JN_DEALRESULT
-      if (!isObjEmpty(approvalStatus)) {
-        if (approvalStatus.startWith('不同意') || approvalStatus.startWith('结束流程')
-          || approvalStatus.startWith('未通过')) {
-          approvalStatus = '未通过'
-          statusColor = '#db3a34'
-        } else if (approvalStatus.startWith('变更处理人')) {
-          statusColor = '#999999'
-          if (!isObjEmpty(approval.JN_OPERATEDDESCRIPTION)) {
-            approvalStatus = '变更处理人(' + approval.JN_OPERATEDDESCRIPTION + ')'
-          } else {
-            approvalStatus = '变更处理人'
-          }
-        } else {
-          approvalStatus = '已审批'
-          statusColor = '#999999'
-        }
-      }
-    } else if (type === 3) {
-      approvalStatus = approval.JP_STATUS
-      if (!isObjEmpty(approvalStatus)) {
-        if (approvalStatus === '待审批') {
-          statusColor = '#33A3F4'
-          approvalStatus = '等待' + approval.JP_NODEDEALMANNAME + '审批'
-        } else if (approvalStatus === '未通过') {
-          statusColor = '#db3a34'
-        } else {
-          statusColor = '#999999'
-        }
-      }
-    }
-
-    return (
-      <div style={{ padding: '0 10px' }} onClick={this.onItemClick}>
-        <div className='recharge-item-root'>
-          <div className='homework-item-title-layout'>
-            {approval.JP_LAUNCHERNAME +
-            '的' + approval.JP_NAME}
-          </div>
-          <div className='gray-line'
-               style={{ height: '1px', marginBottom: '4px' }}></div>
-          <div className='recharge-item-line'>
-            <div className='recharge-item-caption'>单号:</div>
-            <div className='recharge-item-value'>
-              {approval.JP_CODEVALUE}
-            </div>
-          </div>
-          <div className='recharge-item-line'>
-            <div className='recharge-item-caption'>{approval.JN_DEALTIME ===
-            undefined ? '发起时间:' : '处理时间:'}</div>
-            <div
-              className='recharge-item-value'>{!isObjEmpty(
-              approval.JP_LAUNCHTIME)
-              ? moment(approval.JP_LAUNCHTIME).format('YYYY-MM-DD HH:mm:ss')
-              : !isObjEmpty(approval.JN_DEALTIME) ? moment(
-                approval.JN_DEALTIME).format('YYYY-MM-DD HH:mm:ss') : ''
-            }</div>
-          </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'
-              style={{
-                background: statusColor,
-                borderRadius: '8px',
-                color: 'white',
-                padding: '1px 6px',
-                fontSize:'12px'
-              }}>{approvalStatus}</div>
-          </div>
-        </div>
-      </div>
-    )
-  }
-
-  onItemClick = () => {
-    if (this.props.onItemClick) {
-      this.props.onItemClick(this.props.index, this.props.approval)
-    }
-  }
-}
+/**
+ * Created by RaoMeng on 2020/2/18
+ * Desc: 审批列表item
+ */
+
+import React, { Component } from 'react'
+import './approvalItem.css'
+import moment from 'moment'
+import { isObjEmpty } from '../../utils/common'
+
+export default class ApprovalItem extends Component {
+
+  constructor () {
+    super()
+
+    this.state = {}
+  }
+
+  componentDidMount () {
+
+  }
+
+  componentWillUnmount () {
+
+  }
+
+  render () {
+    const { approval, type } = this.props
+    let approvalStatus = '等待我审批'
+    let statusColor = '#33A3F4'
+    if (type === 2) {
+      approvalStatus = approval.JN_DEALRESULT
+      if (!isObjEmpty(approvalStatus)) {
+        if (approvalStatus.startWith('不同意') || approvalStatus.startWith('结束流程')
+          || approvalStatus.startWith('未通过')) {
+          approvalStatus = '未通过'
+          statusColor = '#db3a34'
+        } else if (approvalStatus.startWith('变更处理人')) {
+          statusColor = '#999999'
+          if (!isObjEmpty(approval.JN_OPERATEDDESCRIPTION)) {
+            approvalStatus = '变更处理人(' + approval.JN_OPERATEDDESCRIPTION + ')'
+          } else {
+            approvalStatus = '变更处理人'
+          }
+        } else {
+          approvalStatus = '已审批'
+          statusColor = '#999999'
+        }
+      }
+    } else if (type === 3) {
+      approvalStatus = approval.JP_STATUS
+      if (!isObjEmpty(approvalStatus)) {
+        if (approvalStatus === '待审批') {
+          statusColor = '#33A3F4'
+          approvalStatus = '等待' + approval.JP_NODEDEALMANNAME + '审批'
+        } else if (approvalStatus === '未通过') {
+          statusColor = '#db3a34'
+        } else {
+          statusColor = '#999999'
+        }
+      }
+    }
+
+    return (
+      <div style={{ padding: '0 10px' }} onClick={this.onItemClick}>
+        <div className='recharge-item-root'>
+          <div className='homework-item-title-layout'>
+            {approval.JP_LAUNCHERNAME +
+            '的' + approval.JP_NAME}
+          </div>
+          <div className='gray-line'
+               style={{ height: '1px', marginBottom: '4px' }}></div>
+          <div className='recharge-item-line'>
+            <div className='recharge-item-caption'>单号:</div>
+            <div className='recharge-item-value'>
+              {approval.JP_CODEVALUE}
+            </div>
+          </div>
+          <div className='recharge-item-line'>
+            <div className='recharge-item-caption'>{approval.JN_DEALTIME ===
+            undefined ? '发起时间:' : '处理时间:'}</div>
+            <div
+              className='recharge-item-value'>{!isObjEmpty(
+              approval.JP_LAUNCHTIME)
+              ? moment(approval.JP_LAUNCHTIME).format('YYYY-MM-DD HH:mm:ss')
+              : !isObjEmpty(approval.JN_DEALTIME) ? moment(
+                approval.JN_DEALTIME).format('YYYY-MM-DD HH:mm:ss') : ''
+            }</div>
+          </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'
+              style={{
+                background: statusColor,
+                borderRadius: '8px',
+                color: 'white',
+                padding: '1px 6px',
+                fontSize: '12px',
+              }}>{approvalStatus}</div>
+          </div>
+        </div>
+      </div>
+    )
+  }
+
+  onItemClick = () => {
+    if (this.props.onItemClick) {
+      this.props.onItemClick(this.props.index, this.props.approval)
+    }
+  }
+}

+ 99 - 38
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>
         }
@@ -473,9 +483,6 @@ class Approval extends Component {
                       changeModalOpen: false,
                     })
                   }}
-                  style={{
-                    height: '80vh',
-                  }}
                   title={'变更处理人'}
                   popup
     >
@@ -529,9 +536,6 @@ class Approval extends Component {
       <ListView
         dataSource={this.state.changeDataSource}
         renderRow={(rowData, sectionID, rowID) => {
-          // console.log('raomeng', rowData)
-          // console.log('raomeng', sectionID)
-          // console.log('raomeng', rowID)
           return <List.Item
             key={rowID}
             wrap
@@ -541,10 +545,10 @@ class Approval extends Component {
           </List.Item>
         }}
         style={{
-          height: '80vh',
+          height: '72vh',
           overflow: 'auto',
         }}
-        pageSize={4}
+        pageSize={10}
         onScroll={() => {}}
         scrollRenderAheadDistance={500}
         onEndReachedThreshold={10}
@@ -694,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
@@ -709,7 +709,7 @@ class Approval extends Component {
           })
           return
         }
-        mEmcode = infoObject.dealmancode
+        mEmcode = infoObject.currentemcode//当前登录人
         mApprovalRecord.processInstanceId = infoObject.InstanceId
         mApprovalRecord.isForknode = (getIntValue(infoObject, 'forknode') ===
           0)
@@ -754,7 +754,9 @@ class Approval extends Component {
               })
             } else {
               this.setState({
-                approvalStatus: (mType === undefined || mType == 0) ? 0 : 4,
+                approvalStatus: ((mType === undefined || mType == 0)
+                  && (isObjEmpty(mApprovalRecord.currentNodeMan)
+                    || mEmcode == mApprovalRecord.currentNodeMan)) ? 0 : 4,
               })
             }
           }
@@ -823,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)) {
 
@@ -1849,13 +1850,17 @@ class Approval extends Component {
         approvalStatus: 2,
       })
       if (mType == 0) {
-        let { homeState: { receiveState: { tabIndex, itemIndex, listData } } } = this.props
+        let { homeState: { receiveState: { tabIndex, itemIndex, listData, todoCount } } } = this.props
         if (tabIndex == 0 && !isObjEmpty(listData) && listData.length >
           itemIndex) {
           listData.splice(itemIndex, 1)
-          saveReceiveState({ listData })()
+          saveReceiveState({
+            listData,
+            todoCount: todoCount > 0 ? todoCount - 1 : 0,
+          })()
         }
       }
+      this.loadNextProcess()
     }).catch(error => {
       Toast.hide()
       if (typeof error === 'string') {
@@ -1958,13 +1963,17 @@ class Approval extends Component {
         approvalStatus: 1,
       })
       if (mType == 0) {
-        let { homeState: { receiveState: { tabIndex, itemIndex, listData } } } = this.props
+        let { homeState: { receiveState: { tabIndex, itemIndex, listData, todoCount } } } = this.props
         if (tabIndex == 0 && !isObjEmpty(listData) && listData.length >
           itemIndex) {
           listData.splice(itemIndex, 1)
-          saveReceiveState({ listData })()
+          saveReceiveState({
+            listData,
+            todoCount: todoCount > 0 ? todoCount - 1 : 0,
+          })()
         }
       }
+      this.loadNextProcess()
     }).catch(error => {
       Toast.hide()
       if (typeof error === 'string') {
@@ -1999,30 +2008,33 @@ 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('处理人变更成功')
-          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, todoCount } } } = this.props
+              if (tabIndex == 0 && !isObjEmpty(listData) && listData.length >
+                itemIndex) {
+                listData.splice(itemIndex, 1)
+                saveReceiveState({
+                  listData,
+                  todoCount: todoCount > 0 ? todoCount - 1 : 0,
+                })()
+              }
+              this.props.history.goBack()
             }
+            message.warn('没有下一条待审批单据')
           }
-          // message.warn('没有下一条数据')
-          this.props.history.goBack()
-          // }
         } else {
-          Toast.hide()
           message.error('变更处理人失败')
         }
       }).catch(error => {
@@ -2043,6 +2055,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 = getIntValue(response, 'nodeId')
+      if (nextNode > 0) {
+        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
 

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

@@ -4,9 +4,22 @@
  */
 
 import React, { Component } from 'react'
-import { isObjEmpty, isObjNull } from '../../utils/common'
+import {
+  getParenthesesStr,
+  isObjEmpty,
+  isObjNull,
+  strContain,
+} from '../../utils/common'
 import { message } from 'antd'
-import { Toast, List, Button, Modal, Checkbox } from 'antd-mobile'
+import {
+  Toast,
+  List,
+  Button,
+  Modal,
+  Checkbox,
+  ListView,
+  SearchBar,
+} from 'antd-mobile'
 import { fetchGet, fetchPost } from '../../utils/fetchRequest'
 import BillModel, {
   TYPE_ADD,
@@ -19,10 +32,13 @@ import FormInput from '../../components/approvalAdd/FormInput'
 import FormTitle from '../../components/approvalAdd/FormTitle'
 import FormAdd from '../../components/approvalAdd/FormAdd'
 import FormImage from '../../components/approvalAdd/FormImage'
+import EmployeeItem from '../../components/employeeItem/EmployeeItem'
 
 const alert = Modal.alert
 const CheckboxItem = Checkbox.CheckboxItem
 
+const SELECT_APPROVAL = 'select_approval'
+
 let mCaller//当前单据的Caller
 let mId//当前单据拥有的id,新增默认为0  如果mid为-1,说明保存时候使用更新的接口
 let mMaster
@@ -33,12 +49,15 @@ let mStatusField//状态字段
 let mDetailMainKeyField//从表
 let mDefaultMap
 
+let mModalList = []
+
 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://erp.yitoa.com:8888/ERP'
+// && 'http://29226oq576.qicp.vip/erp'
 
 export default class ApprovalAdd extends Component {
 
@@ -48,7 +67,9 @@ export default class ApprovalAdd extends Component {
     this.state = {
       billGroupModelList: [],
       modalOpen: false,
-      modalList: [],
+      modalDataSource: new ListView.DataSource({
+        rowHasChanged: (row1, row2) => row1 !== row2,
+      }),
       selectModel: {},
     }
   }
@@ -75,8 +96,7 @@ export default class ApprovalAdd extends Component {
   }
 
   render () {
-    const { billGroupModelList, modalOpen, modalList, selectModel } = this.state
-    let selectType = selectModel.type
+    const { billGroupModelList } = this.state
     let formItems = []
     if (!isObjEmpty(billGroupModelList)) {
       //从表的起始Groupindex
@@ -118,11 +138,6 @@ export default class ApprovalAdd extends Component {
                                  childIndex={i}/>,
                     )
                     break
-                    // case 110:
-                    //   formItems.push(
-                    //     <FormAdd/>,
-                    //   )
-                    break
                   default:
                     break
                 }
@@ -156,51 +171,137 @@ export default class ApprovalAdd extends Component {
                 }}
                 onClick={this.onSubmitClick}>提交</Button>}
 
-        <Modal visible={modalOpen}
-               animationType={'slide-up'}
-               onClose={() => {
-                 this.setState({
-                   modalOpen: false,
-                 })
-               }}
-               title={selectModel.caption}
-               popup
-        >
-          <List className='form-common-modal-root'>
-            {modalList && (
-              modalList.map((modalObj, index) => (
-                (selectType === 'MF')
-                  ? (<CheckboxItem key={index}
-                                   checked={modalObj.isSelected == true}
-                                   onChange={e => {
-                                     let checked = e.target.checked
-                                     modalList[index].isSelected = checked
-                                     this.setState({
-                                       modalList,
-                                     })
-                                   }}>{modalObj.value}</CheckboxItem>)
-                  : (<List.Item key={index}
-                                wrap
-                                onClick={this.onDbfindSelect.bind(this,
-                                  selectModel,
-                                  index)}>{modalObj.value}</List.Item>)
-
-              ))
-            )}
-          </List>
-        </Modal>
+        {this.getDbfindModal()}
       </div>
     )
   }
 
+  /**
+   * 放大镜弹框
+   * @returns {*}
+   */
+  getDbfindModal () {
+    const { modalOpen, modalDataSource, selectModel } = this.state
+    let selectType = selectModel.type
+    return <Modal visible={modalOpen}
+                  animationType={'slide-up'}
+                  onClose={() => {
+                    this.setState({
+                      modalOpen: false,
+                    })
+                    if (selectModel.nodeId) {
+                      this.toApprovalDetail(selectModel.nodeId)
+                    }
+                  }}
+                  title={selectModel.caption}
+                  popup
+    >
+      <SearchBar
+        placeholder={'搜索'}
+        maxLength={16}
+        onChange={value => {
+          if (isObjEmpty(value)) {
+            this.setState({
+              modalDataSource: modalDataSource.cloneWithRows(
+                mModalList),
+            })
+          } else {
+            let searchList = []
+            if (!isObjEmpty(mModalList)) {
+              mModalList.forEach(item => {
+                if (!isObjNull(item)
+                  && (
+                    strContain(item.value, value)
+                    || strContain(item.display, value)
+                    || strContain(item.name, value)
+                  )) {
+                  searchList.push(item)
+                }
+              })
+            }
+            this.setState({
+              modalDataSource: modalDataSource.cloneWithRows(
+                searchList),
+            })
+          }
+        }}
+        onClear={value => {
+          this.setState({
+            modalDataSource: modalDataSource.cloneWithRows(
+              mModalList),
+          })
+        }}
+        onCancel={() => {
+          this.setState({
+            modalDataSource: modalDataSource.cloneWithRows(
+              mModalList),
+          })
+        }}
+      />
+      <ListView
+        dataSource={modalDataSource}
+        renderRow={(rowData, sectionID, rowID) => {
+          switch (selectType) {
+            case SELECT_APPROVAL:
+              return <List.Item
+                key={rowID}
+                wrap
+                onClick={this.onEmployeeSelect.bind(this,
+                  rowData)}>
+                <EmployeeItem employee={rowData}/>
+              </List.Item>
+            case 'MF':
+              return <CheckboxItem
+                key={rowID}
+                checked={rowData.isSelected == true}
+                onChange={e => {
+                  let checked = e.target.checked
+                  rowData.isSelected = checked
+                  this.setState({
+                    modalDataSource,
+                  })
+                }}>{rowData.value}</CheckboxItem>
+            default:
+              return <List.Item
+                key={rowID}
+                wrap
+                onClick={this.onDbfindSelect.bind(this,
+                  selectModel,
+                  rowData)}>{rowData.value}</List.Item>
+          }
+        }}
+        style={{
+          height: '72vh',
+          overflow: 'auto',
+        }}
+        pageSize={10}
+        onScroll={() => {}}
+        scrollRenderAheadDistance={500}
+      />
+    </Modal>
+  }
+
+  onEmployeeSelect = rowData => {
+    this.setState({
+      modalOpen: false,
+      modalDataSource: new ListView.DataSource({
+        rowHasChanged: (row1, row2) => row1 !== row2,
+      }),
+      selectModel: {},
+    })
+    let emcode = rowData.EM_CODE
+    let nodeId = rowData.nodeId
+    this.approvalTakeover(emcode, nodeId)
+  }
+
   /**
    * 放大镜选项选中
    */
-  onDbfindSelect = (selectModel, index) => {
-    const { billGroupModelList, modalList } = this.state
+  onDbfindSelect = (selectModel, rowData) => {
+    const { billGroupModelList } = this.state
     let groupIndex = selectModel.groupIndex
     let childIndex = selectModel.childIndex
-    let selectData = modalList[index]
+    let selectData = rowData
     if (selectModel.type === 'C') {
       if (!isObjEmpty(billGroupModelList) &&
         !isObjNull(billGroupModelList[groupIndex])) {
@@ -270,6 +371,30 @@ export default class ApprovalAdd extends Component {
     }
   }
 
+  //接管单据
+  approvalTakeover = (emcode, nodeId) => {
+    Toast.loading('正在指定审批人', 0)
+    fetchPost(mBaseUrl + '/common/takeOverTask.action', {
+      em_code: emcode,
+      nodeId: nodeId,
+      master: mMaster,
+      _noc: 1,
+    }, {
+      // 'Cookie': 'JSESSIONID=' + mSessionId
+    }).then(response => {
+      Toast.hide()
+      message.success('指定审批人成功')
+      this.toApprovalDetail(nodeId)
+    }).catch(error => {
+      Toast.hide()
+      if (typeof error === 'string') {
+        message.error(error)
+      } else {
+        message.error('指定审批人失败')
+      }
+    })
+  }
+
   /**
    * 添加明细组
    * @param groupIndex
@@ -506,12 +631,13 @@ export default class ApprovalAdd extends Component {
         localData.obj = jsonMap
         dbList.push(localData)
       })
-
+      mModalList = dbList
       if (dbList.length === 0) {
         message.error('选项数据为空')
       } else {
         this.setState({
-          modalList: dbList,
+          modalDataSource: this.state.modalDataSource.cloneWithRows(
+            mModalList),
           modalOpen: true,
         })
       }
@@ -564,11 +690,13 @@ export default class ApprovalAdd extends Component {
           }
           combList.push(comb)
         }
+        mModalList = combList
         if (combList.length === 0) {
           message.error('选项数据为空')
         } else {
           this.setState({
-            modalList: combList,
+            modalDataSource: this.state.modalDataSource.cloneWithRows(
+              mModalList),
             modalOpen: true,
           })
         }
@@ -651,31 +779,21 @@ export default class ApprovalAdd extends Component {
       }).then(response => {
         Toast.hide()
         if (response && response.success == true) {
+          let nodeid = response.nodeId
           if (mId <= 0) {
             mId = response[mKeyField] || response.keyvalue
             let formcode = response.formcode
             let isSave = response.isSave
             if (isSave == true || isSave == 'true') {
-
+              this.toApprovalDetail(nodeid)
             } else {
-
+              this.judgeApproval(nodeid, mId, formcode)
             }
             message.success('单据提交成功')
           } else {
+            this.judgeApproval(nodeid, mId, '')
             message.success('单据提交成功')
           }
-          let nodeid = response.nodeId
-          this.props.history.goBack()
-          if (!isObjEmpty(nodeid)) {
-            setTimeout(() => {
-              this.props.history.push('/approval/%7B%22' +
-                'master%22%3A%22' + mMaster
-                + '%22%2C%22nodeId%22%3A' + nodeid
-                + '%2C%22type%22%3A' + 1
-                + '%2C%22baseUrl%22%3A%22' + encodeURIComponent(mBaseUrl)
-                + '%22%7D')
-            }, 100)
-          }
         } else {
           message.error('单据提交失败')
         }
@@ -694,6 +812,67 @@ export default class ApprovalAdd extends Component {
     }
   }
 
+  toApprovalDetail (nodeid) {
+    if (!isObjEmpty(nodeid)) {
+      this.props.history.replace('/approval/%7B%22' +
+        'master%22%3A%22' + mMaster
+        + '%22%2C%22nodeId%22%3A' + nodeid
+        + '%2C%22type%22%3A' + 1
+        + '%2C%22baseUrl%22%3A%22' + encodeURIComponent(mBaseUrl)
+        + '%22%7D')
+    }
+  }
+
+  judgeApproval = (oldNodeId, keyvalue, formcode) => {
+    Toast.loading('正在触发审批流', 0)
+    fetchGet(mBaseUrl + '/uapproval/common/getMultiNodeAssigns.action', {
+      condition: '1=1',
+      caller: mCaller,
+      id: keyvalue,
+    }).then(response => {
+      Toast.hide()
+      if (!isObjEmpty(response.assigns)) {
+        let assignArray = response.assigns
+        let assignObj = assignArray[0]
+        let nodeid = assignObj ? (assignObj.JP_NODEID || '') : ''
+        let candidates = assignObj ? (assignObj.JP_CANDIDATES || []) : []
+        if (!isObjEmpty(nodeid) && !isObjEmpty(candidates)) {
+          let candidateList = []
+          candidates.forEach(item => {
+            let candidate = item
+            candidate.id = keyvalue
+            candidate.formcode = formcode
+            candidate.nodeId = nodeid
+
+            candidateList.push(candidate)
+          })
+          this.setState({
+            modalDataSource: this.state.modalDataSource.cloneWithRows(
+              candidateList),
+            selectModel: {
+              caption: '选择审批人',
+              type: SELECT_APPROVAL,
+              nodeId: nodeid,
+            },
+            modalOpen: true,
+          })
+        } else {
+          message.success('审批流触发成功')
+          this.toApprovalDetail(nodeid)
+        }
+      } else {
+        this.toApprovalDetail(oldNodeId)
+      }
+    }).catch(error => {
+      Toast.hide()
+      if (typeof error === 'string') {
+        message.error(error)
+      } else {
+        message.error('审批流触发失败')
+      }
+    })
+  }
+
   /**
    * 判断主表字段必填情况,拼接主表字段
    * @param formFields

+ 19 - 92
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,8 +38,9 @@ let mSendIndex = 0
 
 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://erp.yitoa.com:8888/ERP'
+// && 'http://29226oq576.qicp.vip/erp'
 
 class ApprovalHome extends Component {
 
@@ -54,8 +55,6 @@ class ApprovalHome extends Component {
       isReceiveDoneLoading: true,
       isReceiveTodoRefresh: false,
       isReceiveDoneRefresh: false,
-      // receiveHeight: document.documentElement.clientHeight,
-      // sendHeight: document.documentElement.clientHeight,
       isSendRefresh: false,
       isSendLoading: true,
       receiveKey: '',
@@ -64,29 +63,7 @@ class ApprovalHome extends Component {
   }
 
   componentDidMount () {
-    setTimeout(() => {
-      this.setState({
-        pageVisible: true,
-      })
-    }, 100)
-
     mMaster = this.props.match.params.master
-
-    // 用于刷新组建确认高度
-    /*if (ReactDOM.findDOMNode(this.contain)) {
-      const hei = this.state.receiveHeight -
-        ReactDOM.findDOMNode(this.contain).offsetTop - 56
-      this.setState({
-        receiveHeight: hei,
-      })
-    }
-    if (ReactDOM.findDOMNode(this.sendList)) {
-      const hei = this.state.sendHeight -
-        ReactDOM.findDOMNode(this.sendList).offsetTop - 56
-      this.setState({
-        sendHeight: hei,
-      })
-    }*/
     document.title = 'U审批'
 
     const { homeState } = this.props
@@ -226,7 +203,7 @@ class ApprovalHome extends Component {
 
   render () {
     return (
-      <div className={this.state.pageVisible ? 'home-root' : 'visibleHidden'}>
+      <div className={'home-root'}>
         <TabBar
           unselectedTintColor="#949494"
           tintColor="#33A3F4"
@@ -274,7 +251,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()}
@@ -488,7 +466,10 @@ class ApprovalHome extends Component {
                    })()
                    this.mySwiper.slideTo(0, 300, false)
                  }
-               }}>待审批
+               }}>待审批{this.props.homeState.receiveState ?
+            (this.props.homeState.receiveState.todoCount > 0
+              ? ('(' + this.props.homeState.receiveState.todoCount + ')')
+              : '') : ''}
           </div>
           <div className={tabIndex === 1 ?
             'identity-item-select' : 'identity-item-normal'}
@@ -557,25 +538,6 @@ class ApprovalHome extends Component {
 
     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}*/}
-        {/*                          type={3}*/}
-        {/*                          onItemClick={this.onSendItemClick.bind(this)}*/}
-        {/*                          index={index}/>*/}
-        {/*          )}/>*/}
-        {/*  </Skeleton>*/}
-        {/*</RefreshLayout>*/}
         <SearchBar
           value={this.state.sendKey}
           placeholder={'搜索'}
@@ -633,32 +595,13 @@ class ApprovalHome extends Component {
 
   renderReceiveTodoItems = () => (
     <div className='receive-content-root'>
-      {/*<RefreshLayout
-        ref={el => {
-          this.todoTab = el
-        }}
-        refreshing={this.state.isReceiveTodoRefresh}
-        onRefresh={this.loadTodoList}
-        height={this.state.receiveHeight}>
-        <Skeleton loading={this.state.isReceiveTodoLoading} active
-                  paragraph={{ rows: 4 }}>
-          <List split={false}
-                dataSource={this.props.homeState.receiveState.listData}
-                renderItem={(item, index) => (
-                  <ApprovalItem approval={item}
-                                type={1}
-                                onItemClick={this.onReceiveItemClick.bind(this)}
-                                index={index}/>
-                )}/>
-        </Skeleton>
-      </RefreshLayout>*/}
       <InfiniteScroll
         initialLoad={false}
         pageStart={0}
         ref={el => {
           this.todoTab = el
         }}
-        loadMore={this.loadTodoList}
+        loadMore={this.loadTodoList.bind(this,undefined)}
         hasMore={this.props.homeState.receiveState.hasMore1}
         loader={<LoadingMore/>}
         threshold={1}
@@ -680,32 +623,13 @@ class ApprovalHome extends Component {
 
   renderReceiveDoneItems = () => (
     <div className='receive-content-root'>
-      {/*<RefreshLayout
-        ref={el => {
-          this.doneTab = el
-        }}
-        refreshing={this.state.isReceiveDoneRefresh}
-        onRefresh={this.loadDoneList}
-        height={this.state.receiveHeight}>
-        <Skeleton loading={this.state.isReceiveDoneLoading} active
-                  paragraph={{ rows: 4 }}>
-          <List split={false}
-                dataSource={this.props.homeState.receiveState.listData2}
-                renderItem={(item, index) => (
-                  <ApprovalItem approval={item}
-                                type={2}
-                                onItemClick={this.onReceiveItemClick.bind(this)}
-                                index={index}/>
-                )}/>
-        </Skeleton>
-      </RefreshLayout>*/}
       <InfiniteScroll
         initialLoad={false}
         pageStart={0}
         ref={el => {
           this.doneTab = el
         }}
-        loadMore={this.loadDoneList}
+        loadMore={this.loadDoneList.bind(this,undefined)}
         hasMore={this.props.homeState.receiveState.hasMore2}
         loader={<LoadingMore/>}
         threshold={1}
@@ -812,10 +736,14 @@ class ApprovalHome extends Component {
     } else {
       currentmaster = mMaster
     }
+    let type = 0
+    if (this.props.homeState.receiveState.tabIndex === 1) {
+      type = 1
+    }
     this.props.history.push('/approval/%7B%22' +
       'master%22%3A%22' + currentmaster
       + '%22%2C%22nodeId%22%3A' + approval.JP_NODEID
-      + '%2C%22type%22%3A' + 0
+      + '%2C%22type%22%3A' + type
       + '%2C%22baseUrl%22%3A%22' + encodeURIComponent(mBaseUrl)
       + '%22%7D')
   }
@@ -909,7 +837,6 @@ class ApprovalHome extends Component {
         isReceiveTodoLoading: false,
         isReceiveTodoRefresh: false,
       })
-      console.log('raomeng', response)
       if (response && !isObjEmpty(response.data)) {
         listData = listData.concat(response.data)
       } else {
@@ -922,6 +849,7 @@ class ApprovalHome extends Component {
           || response.data.length < mPageSize),
         listData,
         pageIndex: mTodoIndex,
+        todoCount: getIntValue(response, 'totalCount'),
       })()
     }).catch(error => {
       if (mTodoIndex > 1) {
@@ -972,7 +900,6 @@ class ApprovalHome extends Component {
         isReceiveDoneLoading: false,
         isReceiveDoneRefresh: false,
       })
-      console.log('raomeng', response)
       if (response && !isObjEmpty(response.data)) {
         listData2 = listData2.concat(response.data)
       } else {

+ 17 - 3
uas-office-web/wxuasapproval/src/pages/useStatus/UseStatus.jsx

@@ -62,6 +62,12 @@ export default class Basic extends Component {
             // "Content-Type": "application/json; charset=UTF-8"
         }).then((response) => {
             if (response.success) {
+                if(response.data.length==0){
+                    message.error('获取数据失败');
+                    this.setState({
+                        loading: false,
+                    })
+                }
                 let dataSource = response.data[0];
                 DEPART = dataSource.DEPART;
                 USERCOUNT = dataSource.USERCOUNT;
@@ -91,9 +97,14 @@ export default class Basic extends Component {
         } else {
             return false;
         }
+    }
 
-
+    mToStr(m) {               //分钟转化小时
+        let h = Math.floor(m / 60);
+        m -= h * 60;
+        return (h ? h + '小时' : '') + (m ? m + '分' : '')
     }
+
     render() {
         const { loading } = this.state;
         const cols = {
@@ -176,10 +187,10 @@ export default class Basic extends Component {
                         </Chart>
                     </div>
                     <div className='columnCharts'>
-                        <div className='useTime'>成员使用时间(分钟)</div>
+                        <div className='useTime'>成员使用时间</div>
                         <Chart
                             onPlotClick={this.handleClick}
-                            padding={['auto', '12%', 'auto', '20%']}
+                            padding={['auto', '20%', 'auto', '20%']}
                             height={columnWidth}
                             data={dv}
                             forceFit
@@ -202,6 +213,9 @@ export default class Basic extends Component {
                                 <Label
                                     offset={5}
                                     content="DURATION"
+                                    formatter={(text, item, index) => {
+                                        return this.mToStr(text)
+                                    }}
                                     textStyle={{
                                         fill: '#000', // 文本的颜色
                                         fontSize: '14', // 文本大小

+ 15 - 4
uas-office-web/wxuasapproval/src/pages/workSummary/WorkSummary.jsx

@@ -31,6 +31,7 @@ export default class Basic extends Component {
         }
     }
     componentWillMount() {
+        document.title = '个人一周小结';
         let messobj = this.getUrlData();
         if (!isObjEmpty(messobj)) {
             try {
@@ -107,6 +108,12 @@ export default class Basic extends Component {
         })
     }
 
+    mToStr(m) {               //分钟转化小时
+        let h = Math.floor(m / 60);
+        m -= h * 60;
+        return (h ? h + '小时' : '') + (m ? m + '分' : '')
+    }
+
     render() {
         const { loading } = this.state;
         const ds = new DataSet();
@@ -136,16 +143,16 @@ export default class Basic extends Component {
                     <div className='workSummary'>
                         <p className='workTitle'>工作小结</p>
                         <List className="my-list">
-                            <Item extra={DURATION + ' 分钟'}>累计在线时长:</Item>
+                            <Item extra={this.mToStr(DURATION)}>累计在线时长:</Item>
                             <Item extra={ADDCOUNT + ' 项'}>累计新增单据:</Item>
                             <Item extra={COMMITCOUNT + ' 项'}>累计提交单据:</Item>
                             <Item extra={AUDITCOUNT + ' 项'}>累计处理审批:</Item>
                         </List>
                     </div>
                     <div className='columnCharts'>
-                        <div className='useTime'>各模块使用情况(分钟)</div>
+                        <div className='useTime'>各模块使用情况</div>
                         <Chart
-                            padding={['auto', '12%', 'auto', 'auto']} height={columnWidth} data={dv} forceFit>
+                            padding={['auto', '20%', 'auto', 'auto']} height={columnWidth} data={dv} forceFit>
                             <Coord transpose />
                             <Axis
                                 name="MODELNAME"
@@ -173,7 +180,11 @@ export default class Basic extends Component {
                                         fill: '#000',
                                         fontSize: '14'
                                     }
-                                }} offset={5} content="DURATION" />
+                                }}
+                                    formatter={(text, item, index) => {
+                                        return this.mToStr(text)
+                                    }}
+                                    offset={5} content="DURATION" />
                             </Geom>
                         </Chart>
                     </div>

+ 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: [],

+ 2 - 2
uas-office-web/wxuasapproval/src/utils/fetchRequest.js

@@ -133,13 +133,13 @@ function fetchResult (request) {
         return resultJson
       } else {
         if (result.exceptionInfo) {
-          if (result.exceptionInfo.length > 50) {
+          if (result.exceptionInfo.length > 80) {
             throw '接口请求异常'
           } else {
             throw result.exceptionInfo.replace(/<[\/\!]*[^<>]*>/ig, '')
           }
         } else if (result.message) {
-          if (result.message.length > 50) {
+          if (result.message.length > 80) {
             throw '接口请求异常'
           } else {
             throw result.message.replace(/<[\/\!]*[^<>]*>/ig, '')