Browse Source

新建页面简易提交逻辑完成

RaoMeng 6 years ago
parent
commit
e852d18cd2

+ 31 - 0
uas-office-web/wxuasapproval/src/components/approvalAdd/FormAdd.jsx

@@ -0,0 +1,31 @@
+/**
+ * Created by RaoMeng on 2020/2/19
+ * Desc: 通用表单添加明细
+ */
+
+import React, { Component } from 'react'
+import './formCommon.css'
+
+export default class FormAdd extends Component {
+
+  constructor () {
+    super()
+
+    this.state = {}
+  }
+
+  componentDidMount () {
+  }
+
+  componentWillUnmount () {
+
+  }
+
+  render () {
+    return (
+      <div className='form-add-text'>
+        + 添加明细
+      </div>
+    )
+  }
+}

+ 31 - 0
uas-office-web/wxuasapproval/src/components/approvalAdd/FormImage.jsx

@@ -0,0 +1,31 @@
+/**
+ * Created by RaoMeng on 2020/2/19
+ * Desc: 通用表单附件类型
+ */
+
+import React, { Component } from 'react'
+import './formCommon.css'
+
+export default class FormImage extends Component {
+
+  constructor () {
+    super()
+
+    this.state = {}
+  }
+
+  componentDidMount () {
+  }
+
+  componentWillUnmount () {
+
+  }
+
+  render () {
+    return (
+      <div>
+
+      </div>
+    )
+  }
+}

+ 201 - 0
uas-office-web/wxuasapproval/src/components/approvalAdd/FormInput.jsx

@@ -0,0 +1,201 @@
+/**
+ * Created by RaoMeng on 2020/2/19
+ * Desc: 通用表单输入框类型
+ */
+
+import React, { Component } from 'react'
+import './formCommon.css'
+import ApprovalBean from '../../model/ApprovalBean'
+import BillModel from '../../model/BillModel'
+import { TextareaItem, InputItem, DatePicker, List } from 'antd-mobile'
+import { isObjEmpty } from '../../utils/common'
+import moment from 'moment'
+
+export default class FormInput extends Component {
+
+  constructor () {
+    super()
+
+    this.state = {
+      modalOpen: false,
+      selectList: [],
+      inputValue: '',
+      radioValue: 1,
+      billModel: new BillModel(),
+    }
+  }
+
+  componentDidMount () {
+    let { billModel } = this.props
+
+    this.setState({
+      billModel: billModel,
+    })
+  }
+
+  componentWillReceiveProps () {
+    this.componentDidMount()
+  }
+
+  componentWillUnmount () {
+
+  }
+
+  render () {
+    const { billModel } = this.state
+    let valueItem
+
+    let type = billModel.type
+    if (type === 'N') {
+      valueItem =
+        <InputItem className='form-input-value' clear
+                   placeholder={this.isSelect(type)
+                     ? '请选择'
+                     : ((billModel.readOnly === 'T' ||
+                       billModel.editable === 'F')
+                       ? ''
+                       : '请输入')}
+                   editable={(billModel.readOnly === 'T' ||
+                     billModel.editable === 'F') ? false : (this.isSelect(type)
+                     ? false
+                     : true)}
+          // extra={(billModel.readOnly === 'T' &&
+          //   billModel.editable === 'F' && this.isSelect(type))
+          //   ? '>'
+          //   : ''}
+                   onChange={this.onTextChange}
+                   onClick={this.onInputClick}
+                   type={'number'}
+                   value={billModel.getValue()}
+        />
+    } else if (type === 'DT' || type === 'D' || type === 'T') {
+      valueItem = <DatePicker
+        style={{ width: '100%' }}
+        locale={{
+          okText: '确定',
+          dismissText: '取消',
+        }}
+        mode={type === 'DT' ? 'datetime' : 'date'}
+        extra={(billModel.readOnly === 'T' ||
+          billModel.editable === 'F') ? '' : type === 'DT' ? '选择时间' : '选择日期'}
+        disabled={(billModel.readOnly === 'T' ||
+          billModel.editable === 'F') ? true : false}
+        value={!isObjEmpty(billModel.getValue())
+          ? new Date(billModel.getValue())
+          : ''}
+        onChange={this.onDateChange}
+      >
+        <DatePickerCustom>
+          <div className='form-input-caption'>{billModel.caption}</div>
+          <div className={billModel.allowBlank == 'F'
+            ? 'form-input-fill'
+            : 'visibleHidden'}>*
+          </div>
+          <div style={{ flex: 1 }}></div>
+        </DatePickerCustom>
+      </DatePicker>
+    } else {
+      valueItem = <TextareaItem className='form-input-value' autoHeight
+                                placeholder={this.isSelect(type)
+                                  ? '请选择'
+                                  : ((billModel.readOnly === 'T' ||
+                                    billModel.editable === 'F')
+                                    ? ''
+                                    : '请输入')}
+                                clear={true}
+                                editable={(billModel.readOnly === 'T' ||
+                                  billModel.editable === 'F')
+                                  ? false
+                                  : (this.isSelect(type)
+                                    ? false
+                                    : true)}
+                                disabled={false}
+        // extra={(billModel.readOnly === 'T' &&
+        //   billModel.editable === 'F' && this.isSelect(type))
+        //   ? '>'
+        //   : ''}
+                                onChange={this.onTextChange}
+                                value={billModel.getValue()}
+      />
+    }
+    return (
+      (type === 'DT' || type === 'D' || type === 'T') ? <div>
+        {valueItem}
+      </div> : <div className='form-common-layout'
+                    style={{ minHeight: '32px' }}>
+        <div className='form-input-caption'>{billModel.caption}</div>
+        <div className={billModel.allowBlank == 'F'
+          ? 'form-input-fill'
+          : 'visibleHidden'}>*
+        </div>
+        {valueItem}
+      </div>
+    )
+  }
+
+  onTextChange = value => {
+    const { billModel } = this.state
+    billModel.value = value
+    this.setState({
+      billModel,
+    }, () => {
+      this.props.onTextChange &&
+      this.props.onTextChange(this.props.groupIndex, this.props.childIndex,
+        value)
+    })
+  }
+
+  onInputClick = e => {
+
+  }
+
+  onDateChange = date => {
+    const { billModel } = this.state
+    let dateStr = 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
+    this.setState({
+      billModel,
+    }, () => {
+      this.props.onTextChange &&
+      this.props.onTextChange(this.props.groupIndex, this.props.childIndex,
+        dateStr)
+    })
+  }
+
+  isSelect = dfType => {
+    if (isObjEmpty(dfType)) {
+      return false
+    }
+    switch (dfType) {
+      case 'D':
+      case 'DT':
+      case 'C':
+      case 'MF':
+      case 'SF':
+      case 'DF':
+        return false
+      // return true
+    }
+    return false
+  }
+}
+
+const DatePickerCustom = ({ extra, onClick, children }) => (
+  <div
+    onClick={onClick}
+    className='form-common-layout'
+  >
+    {children}
+    <span style={{
+      float: 'right',
+      color: '#888',
+      height: '32px',
+      lineHeight: '32px',
+      paddingRight: '12px',
+    }}>{extra}</span>
+  </div>
+)

+ 41 - 0
uas-office-web/wxuasapproval/src/components/approvalAdd/FormTitle.jsx

@@ -0,0 +1,41 @@
+/**
+ * Created by RaoMeng on 2020/2/19
+ * Desc: 通用表单标题类型
+ */
+
+import React, { Component } from 'react'
+import './formCommon.css'
+import { isObjEmpty, isObjNull } from '../../utils/common'
+
+export default class FormTitle extends Component {
+
+  constructor () {
+    super()
+
+    this.state = {}
+  }
+
+  componentDidMount () {
+  }
+
+  componentWillUnmount () {
+
+  }
+
+  render () {
+    const { billModel } = this.props
+    return (
+      <div
+        className={isObjNull(billModel)
+          ? 'displayNone'
+          : 'form-common-layout'}
+        style={{ background: '#efefef' }}>
+        <div className='form-title-text'>{billModel.caption}</div>
+        <div className={billModel.allowBlank == 'F'
+          ? 'displayNone'
+          : 'form-title-delete'}>删除
+        </div>
+      </div>
+    )
+  }
+}

+ 107 - 0
uas-office-web/wxuasapproval/src/components/approvalAdd/formCommon.css

@@ -0,0 +1,107 @@
+.form-common-layout {
+    width: 100%;
+    display: flex;
+    flex-direction: row;
+    padding: 6px;
+    background: white;
+    border-bottom: 1px solid #cccccc;
+    align-items: center;
+}
+
+.form-common-layout .form-input-value.am-list-item.am-textarea-item {
+    min-height: 32px;
+    padding-left: 4px;
+    padding-right: 4px;
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+}
+
+.form-common-layout .am-list .am-list-item.am-textarea-item {
+    min-height: 32px;
+}
+
+.form-common-layout .am-list-item.am-input-item {
+    min-height: 32px;
+    height: 32px;
+}
+
+.form-common-layout .am-textarea-control {
+    padding: 4px;
+}
+
+.form-common-layout .am-textarea-control textarea {
+    font-size: 14px;
+    text-align: right;
+    padding-right: 4px;
+}
+
+.form-common-layout .am-textarea-clear {
+    margin-top: 0;
+}
+
+.form-common-layout .am-list-item {
+    min-height: 32px;
+}
+
+.form-common-layout .am-list-item .am-list-line {
+    padding-right: 8px;
+}
+
+.form-common-layout .am-list .am-list-item.am-textarea-item {
+    height: 100%;
+    padding-left: 8px;
+    align-items: center;
+}
+
+.form-common-layout .am-list-item .am-input-control {
+    font-size: 14px;
+}
+
+.form-common-layout .am-list-item .am-input-control input {
+    font-size: 14px;
+    text-align: right;
+    padding-right: 4px;
+}
+
+.form-title-text {
+    font-size: 14px;
+    color: #2F95DD;
+    flex: 1;
+    font-weight: bold;
+}
+
+.form-title-delete {
+    font-size: 14px;
+    color: red;
+    padding-left: 10px;
+}
+
+.form-input-caption {
+    font-size: 14px;
+    color: #333333;
+    width: 80px;
+}
+
+.form-input-fill {
+    font-size: 14px;
+    color: red;
+    padding: 4px;
+}
+
+.form-input-value {
+    flex: 1;
+    font-size: 14px;
+    color: #333333;
+    text-align: right;
+}
+
+.form-add-text {
+    width: 100%;
+    height: 36px;
+    text-align: center;
+    line-height: 36px;
+    font-size: 14px;
+    color: #2F95DD;
+    font-weight: bold;
+}

+ 6 - 1
uas-office-web/wxuasapproval/src/configs/router.config.js

@@ -11,6 +11,8 @@ import Approval from '../pages/approval/Approval'
 import BindResult from '../pages/bindPhone/BindResult'
 import RedirectPage from '../pages/RedirectPage'
 import ApprovalHome from '../pages/approval/ApprovalHome'
+import ApprovalAdd from '../pages/approval/ApprovalAdd'
+import UasApproval from '../pages/approval/UasApproval'
 
 export class Routes extends React.Component {
 
@@ -24,8 +26,11 @@ export class Routes extends React.Component {
       <div style={{ width: '100%', height: '100%' }}>
         <Switch>
           {/*<Route exact path='/bindPhone' component={BindPhone}/>*/}
+          <Route path='/uasApproval' component={UasApproval}/>
           <Route path='/approvalHome' component={ApprovalHome}/>
           <Route path='/approval/:paramsStr?' component={Approval}/>
+          <Route path='/approvalAdd/:caller/:master/:id?'
+                 component={ApprovalAdd}/>
           <Route path='/redirect/:paramsStr?' component={RedirectPage}/>
           <Route path='/bindPhone/:openId?' component={BindPhone}/>
           <Route path='/bindResult/:result' component={BindResult}/>
@@ -34,7 +39,7 @@ export class Routes extends React.Component {
           {/*404页面*/}
           <Route render={() => (
             // <Redirect to={'/redirect'}/>
-            <Redirect to={'/approvalHome'}/>
+            <Redirect to={'/uasApproval'}/>
           )}/>
         </Switch>
       </div>

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

@@ -34,6 +34,10 @@ code {
     display: none;
 }
 
+.visibleHidden {
+    visibility: hidden;
+}
+
 .common-flex-row {
     display: flex;
     flex-direction: row;
@@ -68,3 +72,8 @@ code {
     display: none;
 }
 
+input {
+    outline: none;
+    border: none;
+}
+

+ 63 - 0
uas-office-web/wxuasapproval/src/model/BillGroupModel.js

@@ -0,0 +1,63 @@
+/**
+ * 单据分组Model
+ * @constructor
+ */
+import { isObjEmpty, isObjNull } from '../utils/common'
+
+export default function BillGroupModel () {
+  this.isDeleteAble = false//是否可以删除
+  this.isForm = false//是否是主表
+  this.lastInType = false//是否当前单据明细的最后一个
+  this.groupIndex = 0//当前组所在的整个显示集合里面的索引
+  this.gridIndex = 0//当前组在明细表内的索引
+  this.minDetno = 10000000//最小的序号
+  this.group = ''//组名
+  this.keyField = ''//提交时候主表或明细表id字段名称
+  this.mTagMap = {}//附带信息
+  this.billCaller = ''//表caller
+
+  this.hideBillFields = []//当前组隐藏的字段列表
+  this.showBillFields = []//当前组显示的字段列表
+  this.updateBillFields = []//当前组可更新的字段列表
+  this.dex = 0//当前组所在的整个显示集合里面的索引
+
+  this.updateTagMap = function (key, value) {
+    if (isObjEmpty(key)) {
+      return
+    }
+    if (isObjNull(this.mTagMap)) {
+      this.mTagMap = {}
+    }
+    this.mTagMap.key = value
+  }
+
+  this.addHide = function (billModel) {
+    if (isObjNull(billModel)) {
+      return
+    }
+    if (isObjNull(this.hideBillFields)) {
+      this.hideBillFields = []
+    }
+    this.hideBillFields.push(billModel)
+  }
+
+  this.addShow = function (billModel) {
+    if (isObjNull(billModel)) {
+      return
+    }
+    if (isObjNull(this.showBillFields)) {
+      this.showBillFields = []
+    }
+    this.showBillFields.push(billModel)
+  }
+
+  this.addUpdate = function (billModel) {
+    if (isObjNull(billModel)) {
+      return
+    }
+    if (isObjNull(this.updateBillFields)) {
+      this.updateBillFields = []
+    }
+    this.updateBillFields.push(billModel)
+  }
+}

+ 79 - 0
uas-office-web/wxuasapproval/src/model/BillModel.js

@@ -0,0 +1,79 @@
+import { isObjEmpty } from '../utils/common'
+
+export default function BillModel () {
+  this.id = 0//id
+  this.groupIndex = 0//所在组索引
+  this.detno = 1000000//序号
+  this.length = 0//字符长度
+  this.appwidth = 0//宽度
+  this.isdefault = 0//是否显示
+  this.dbfind = ''//是否是dbfind字段判定
+  this.caption = ''//字段名称
+  this.type = ''//类型(标题类型为Constants.TYPE_TITLE,不触发点击事件等 )
+  this.logicType = ''//logic类型
+  this.readOnly = ''//字段是否只读  T/F
+  this.field = ''//字段
+  this.value = ''//值
+  this.display = ''//上传值
+  this.defValue = ''//默认值
+  this.findFunctionName = ''//默认值
+  this.allowBlank = ''//是否允许为空(注:当作为标题的时候T:表示可以删除 F:表示不可删除)
+  this.renderer = ''
+  this.enclusureId = ''
+  this.localDatas = []//获取到的本地选择数据
+  this.mBillJump = ''//判断是否需要要跳转字段
+  this.mTabList = []//是否
+  this.updatable = ''//是否可更新
+  this.editable = ''//是否可编辑(临时属性,对某些字段的特殊处理,和字段本身属性无关,在添加明细时,要重置这个值)
+
+  this.BillModel = function (billModel) {
+    this.id = billModel.id
+    this.groupIndex = billModel.groupIndex + 1
+    this.length = billModel.length
+    this.detno = billModel.detno
+    this.appwidth = billModel.appwidth
+    this.isdefault = billModel.isdefault
+    this.dbfind = billModel.dbfind
+    this.caption = billModel.caption
+    this.type = billModel.type
+    this.logicType = billModel.logicType
+    this.readOnly = billModel.readOnly
+    this.field = billModel.field
+    this.defValue = billModel.defValue
+    this.renderer = billModel.renderer
+    this.enclusureId = billModel.enclusureId
+    this.allowBlank = billModel.allowBlank
+    this.findFunctionName = billModel.findFunctionName
+    this.mBillJump = billModel.mBillJump
+    this.localDatas = billModel.localDatas
+    this.mTabList = billModel.mTabList
+    this.updatable = billModel.updatable
+    this.editable = ''//复制字段时要重置
+    if (!this.isShow(billModel)
+      && !isObjEmpty(billModel.renderer)
+      && billModel.defaultValue.indexOf('defaultValue') != -1) {
+      //隐藏字段,renderer里包含defaultValue,则复制value
+      this.value = billModel.value
+      this.display = billModel.display
+    } else {
+      this.value = ''
+      this.display = ''
+    }
+  }
+
+  this.getValue = () => (
+    this.value || this.defValue || ''
+  )
+
+  this.getDisplay = () => (
+    this.display || this.getValue()
+  )
+
+  this.isShow = function (billModel) {
+    return billModel.isdefault === -1 && billModel.type === 'H'
+  }
+}
+
+export const TYPE_TITLE = 'LOCAL_TITLE'
+export const TYPE_ADD = 'LOCAL_ADD'
+export const TYPE_TAB = 'LOCAL_TAB'

+ 4 - 0
uas-office-web/wxuasapproval/src/model/LocalData.js

@@ -0,0 +1,4 @@
+export default function LocalData () {
+  this.value = ''//显示的值  ||附件时候表示 路径,文件名
+  this.display = ''//上传的值 ||附件时候表示上传的附件id
+}

+ 6 - 3
uas-office-web/wxuasapproval/src/pages/approval/Approval.jsx

@@ -21,7 +21,7 @@ import {
 import EnclosureItem from '../../components/enclosureItem/EnclosureItem'
 
 //==============================================================================================
-let mMaster, mSessionId, mEmcode, mNodeId, mCachePoints
+let mMaster, mSessionId, mEmcode, mNodeId, mType, mCachePoints
 let mApprovalRecord = new ApprovalRecordBean()
 let mTitleApproval = new ApprovalBean()
 let mParams = []
@@ -95,6 +95,10 @@ export default class Approval extends Component {
         mBaseUrl = decodeURIComponent(paramsJson.baseUrl)
         mMaster = paramsJson.master
         mNodeId = paramsJson.nodeId
+        mType = paramsJson.type
+        this.setState({
+          approvalStatus: (mType === undefined || mType === 0) ? 0 : 3,
+        })
 
         // mSessionId = window.sessionId
         // mEmcode = window.emcode
@@ -613,7 +617,7 @@ export default class Approval extends Component {
               })
             } else {
               this.setState({
-                approvalStatus: 0,
+                approvalStatus: (mType === undefined || mType === 0) ? 0 : 3,
               })
             }
           }
@@ -1918,7 +1922,6 @@ export default class Approval extends Component {
   }
 
   approvalEdit = (e) => {
-    console.log(e.target.value)
     this.setState({
       approvalContent: e.target.value,
     })

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

@@ -0,0 +1,772 @@
+/**
+ * Created by RaoMeng on 2020/2/19
+ * Desc: 审批新增页面
+ */
+
+import React, { Component } from 'react'
+import { isObjEmpty, isObjNull } from '../../utils/common'
+import { message } from 'antd'
+import { Toast, List, Button } from 'antd-mobile'
+import { fetchGet, fetchPost } from '../../utils/fetchRequest'
+import BillModel, {
+  TYPE_ADD,
+  TYPE_TAB,
+  TYPE_TITLE,
+} from '../../model/BillModel'
+import LocalData from '../../model/LocalData'
+import BillGroupModel from '../../model/BillGroupModel'
+import FormInput from '../../components/approvalAdd/FormInput'
+import FormTitle from '../../components/approvalAdd/FormTitle'
+import FormAdd from '../../components/approvalAdd/FormAdd'
+import FormImage from '../../components/approvalAdd/FormImage'
+
+let mBaseUrl = 'http://29226oq576.qicp.vip/uas/'
+
+let mCaller//当前单据的Caller
+let mId//当前单据拥有的id,新增默认为0  如果mid为-1,说明保存时候使用更新的接口
+let mMaster
+let mDetailKeyField//从表id字段
+let mKeyField//主表id字段
+let mStatusCodeField//状态码字段
+let mStatusField//状态字段
+let mDetailMainKeyField//从表
+let mDefaultMap
+
+let mShowBillModels, mFormBillModels, mUpdateBillModels, mAllBillModels
+
+export default class ApprovalAdd extends Component {
+
+  constructor () {
+    super()
+
+    this.state = {
+      billGroupModelList: [],
+    }
+  }
+
+  componentDidMount () {
+    document.title = ''
+    mCaller = this.props.match.params.caller
+    mMaster = this.props.match.params.master
+    mId = this.props.match.params.id
+    if (isObjEmpty(mId)) {
+      mId = 0
+    }
+    if (isObjEmpty(mCaller)) {
+      message.error('单据caller为空,单据获取失败')
+    } else {
+      Toast.loading('正在获取单据', 0)
+      this.loadFormandGridDetail()
+    }
+  }
+
+  componentWillUnmount () {
+    Toast.hide()
+  }
+
+  render () {
+    const { billGroupModelList } = this.state
+    let formItems = []
+    if (!isObjEmpty(billGroupModelList)) {
+      //从表的起始Groupindex
+      let gridStartIndex = -1
+      for (let g = 0; g < billGroupModelList.length; g++) {
+        let billGroup = billGroupModelList[g]
+        if (!isObjNull(billGroup)) {
+          let showBillFields = billGroup.showBillFields
+          if (!isObjNull(showBillFields) &&
+            showBillFields.length > 0) {
+            //添加组标题
+            this.addGroupTitle(g, billGroup, gridStartIndex, formItems)
+            //添加显示字段
+            for (let i = 0; i < showBillFields.length; i++) {
+              let billModel = showBillFields[i]
+              if (!isObjNull(billModel)) {
+                let itemViewType = this.getItemViewType(billModel.type)
+                if (billModel.renderer == 'detailAttach') {
+                  itemViewType = 2
+                }
+                switch (itemViewType) {
+                  // case 0:
+                  //   formItems.push(
+                  //     <FormTitle billModel={billModel}/>,
+                  //   )
+                  //   break
+                  case 1:
+                    formItems.push(
+                      <FormInput billModel={billModel} groupIndex={g}
+                                 childIndex={i}
+                                 onTextChange={this.onTextChange.bind(this)}/>,
+                    )
+                    break
+                  case 2:
+                    formItems.push(
+                      <FormImage billModel={billModel} groupIndex={g}
+                                 childIndex={i}/>,
+                    )
+                    break
+                    // case 110:
+                    //   formItems.push(
+                    //     <FormAdd/>,
+                    //   )
+                    break
+                  default:
+                    break
+                }
+              }
+            }
+            /*if (billGroup.isForm == false && billGroup.lastInType == true) {
+              //如果是最后一个从表,则添加【新增】按钮
+              formItems.push(
+                <FormAdd billModel={this.getAddModel(g)} groupIndex={g}/>,
+              )
+            }*/
+          }
+        }
+      }
+    }
+    return (
+      <div className='approval-add-root'>
+        <List>
+          {formItems}
+          {formItems.length > 0 &&
+          <Button type={'primary'}
+                  style={{
+                    margin: '42px 26px 24px',
+                    height: '36px',
+                    lineHeight: '36px',
+                    fontSize: '16px',
+                  }}
+                  onClick={this.onSubmitClick}>提交</Button>}
+        </List>
+      </div>
+    )
+  }
+
+  /**
+   * 添加分组头部
+   * @param g
+   * @param billGroup
+   * @param gridStartIndex
+   * @param formItems
+   */
+  addGroupTitle (g, billGroup, gridStartIndex, formItems) {
+    let titleBillModel = new BillModel()
+    titleBillModel.groupIndex = g
+    titleBillModel.type = TYPE_TITLE
+    if (billGroup.isForm == true) {
+      titleBillModel.caption = billGroup.group
+      titleBillModel.allowBlank = 'F'
+
+    } else {
+      if (gridStartIndex === -1) {
+        gridStartIndex = g
+      }
+      titleBillModel.caption = `明细${g - gridStartIndex + 1}`
+      titleBillModel.allowBlank = billGroup.isDeleteAble == true
+        ? 'T'
+        : 'F'
+    }
+    if (!isObjEmpty(titleBillModel.caption)) {
+      formItems.push(
+        <FormTitle billModel={titleBillModel}/>,
+      )
+    }
+  }
+
+  onTextChange = (groupIndex, childIndex, value) => {
+    const { billGroupModelList } = this.state
+    if (!isObjNull(billGroupModelList) &&
+      !isObjNull(billGroupModelList[groupIndex])) {
+      let billGroup = billGroupModelList[groupIndex]
+      if (!isObjNull(billGroup.showBillFields) &&
+        !isObjNull(billGroup.showBillFields[childIndex])) {
+        billGroup.showBillFields[childIndex].value = value
+      }
+    }
+    this.setState({
+      billGroupModelList,
+    })
+  }
+
+  onSubmitClick = () => {
+    const { billGroupModelList } = this.state
+    if (!isObjEmpty(billGroupModelList)) {
+      let formFields = [], gridGroupFields = []
+      for (let i = 0; i < billGroupModelList.length; i++) {
+        let billGroup = billGroupModelList[i]
+        if (isObjNull(billGroup)) {
+          continue
+        }
+        if (billGroup.isForm) {
+          if (!isObjEmpty(billGroup.showBillFields)) {
+            formFields = formFields.concat(billGroup.showBillFields)
+          }
+          if (!isObjEmpty(billGroup.hideBillFields)) {
+            formFields = formFields.concat(billGroup.hideBillFields)
+          }
+        } else {
+          let gridFields = []
+          if (!isObjEmpty(billGroup.showBillFields)) {
+            gridFields = gridFields.concat(billGroup.showBillFields)
+          }
+          if (!isObjEmpty(billGroup.hideBillFields)) {
+            gridFields = gridFields.concat(billGroup.hideBillFields)
+          }
+          gridGroupFields.push(gridFields)
+        }
+      }
+      let formStore = this.analysisForm(formFields)
+      if (isObjNull(formStore)) {
+        return
+      }
+      let gridStoreList = this.analysisGrid(gridGroupFields)
+      if (isObjNull(gridStoreList)) {
+        return
+      }
+
+      console.log('formdata', JSON.stringify(formStore))
+      console.log('formdata', JSON.stringify(gridStoreList))
+      Toast.loading('单据提交中', 0)
+      fetchPost(mBaseUrl + (mId <= 0
+        ? 'mobile/oa/commonSaveAndSubmit.action'
+        : 'mobile/commonUpdate.action'), {
+        caller: mCaller,
+        keyid: mId,
+        id: mId,
+        formStore: JSON.stringify(formStore),
+        gridStore: JSON.stringify(gridStoreList),
+      }).then(response => {
+        Toast.hide()
+        if (response && response.success == true) {
+          if (mId <= 0) {
+            let keyValue = response[mKeyField] || response.keyvalue
+            let formcode = response.formcode
+            let isSave = response.isSave
+            if (isSave == true || isSave == 'true') {
+              message.success('单据提交成功')
+              this.props.history.goBack()
+              setTimeout(() => {
+                this.props.history.push('/approval/%7B%22' +
+                  'master%22%3A%22' + mMaster
+                  + '%22%2C%22nodeId%22%3A' + keyValue
+                  + '%2C%22type%22%3A' + 1
+                  + '%2C%22baseUrl%22%3A%22' + encodeURIComponent(mBaseUrl)
+                  + '%22%7D')
+              }, 100)
+            } else {
+
+            }
+          } else {
+            message.success('单据提交成功')
+            this.props.history.goBack()
+            setTimeout(() => {
+              this.props.history.push('/approval')
+            }, 100)
+          }
+        } else {
+          message.error('单据提交失败')
+        }
+        let exceptionInfo = response.exceptionInfo
+        if (!isObjEmpty(exceptionInfo)) {
+          message.error(exceptionInfo)
+        }
+      }).catch(error => {
+        Toast.hide()
+        if (typeof error === 'string') {
+          message.error(error)
+        } else {
+          message.error('单据提交失败')
+        }
+      })
+    }
+  }
+
+  /**
+   * 判断主表字段必填情况,拼接主表字段
+   * @param formFields
+   * @returns {null}
+   */
+  analysisForm = (formFields) => {
+    if (!isObjNull(formFields)) {
+      let formStore = {}
+      for (let i = 0; i < formFields.length; i++) {
+        let billModel = formFields[i]
+        if (isObjNull(billModel)) {
+          continue
+        }
+        if (isObjEmpty(billModel.getValue()) && billModel.isdefault === -1 &&
+          (billModel.allowBlank === 'necessaryField'
+            || billModel.allowBlank === 'F')) {
+          message.error(`${billModel.caption}为必填项`)
+          return null
+        }
+        //Todo 附件上传
+
+        formStore[billModel.field] = billModel.getDisplay()
+      }
+      return formStore
+    } else {
+      return null
+    }
+  }
+
+  analysisGrid = (gridBillMap) => {
+    let gridStoreList = []
+    if (!isObjNull(gridBillMap)) {
+      for (let i = 0; i < gridBillMap.length; i++) {
+        let gridFields = gridBillMap[i]
+        if (!isObjEmpty(gridFields)) {
+          let gridStore = {}
+          for (let j = 0; j < gridFields.length; j++) {
+            let billModel = gridFields[j]
+            if (isObjEmpty(billModel.getValue())
+              && billModel.isdefault === -1
+              && (billModel.allowBlank === 'necessaryField'
+                || billModel.allowBlank === 'F')) {
+              message.error(`${billModel.caption}为必填项`)
+              return null
+            }
+            //Todo 附件上传
+
+            gridStore[billModel.field] = billModel.getDisplay()
+          }
+          gridStoreList.push(gridStore)
+        }
+      }
+    }
+    return gridStoreList
+  }
+
+  /**
+   * 获取主从表数据
+   */
+  loadFormandGridDetail () {
+    fetchPost(mBaseUrl + (mId <= 0
+      ? 'mobile/common/getformandgriddetail.action'
+      : 'mobile/getformandgriddetail.action'), {
+      condition: '1=1',
+      caller: mCaller,
+      id: mId,
+    }).then(response => {
+      Toast.hide()
+      let billGroupModels = this.handlerBill(response)
+      // this.changeBillModel(billGroupModels)
+      console.log('raomeng', billGroupModels)
+      this.setState({
+        billGroupModelList: billGroupModels,
+      })
+    }).catch(error => {
+      Toast.hide()
+      if (typeof error === 'string') {
+        message.error(error)
+      } else {
+        message.error('单据获取失败')
+      }
+    })
+  }
+
+  /**
+   * 解析主从表数据
+   * @param response
+   */
+  handlerBill = (response) => {
+    let showBillGroupModels = []
+    let config = response.config
+    if (isObjEmpty(config)) {
+      message.error('单据配置异常')
+      return
+    } else {
+      mDetailKeyField = config.fo_detailkeyfield
+      mKeyField = config.fo_keyfield
+      mStatusCodeField = config.fo_statuscodefield
+      mStatusField = config.fo_statusfield
+      mDetailMainKeyField = config.fo_detailmainkeyfield
+    }
+    let data = response.data
+    if (isObjEmpty(data)) {
+      message.error('单据数据异常')
+      return
+    } else {
+      let formdetail = data.formdetail
+      let formdeMap = this.handlerFormdetail(formdetail)
+      let formBillGroupModels = []//主表显示字段
+
+      if (!isObjEmpty(formdeMap)) {
+        for (let key in formdeMap) {
+          let entryValue = formdeMap[key]
+          if (!isObjNull(entryValue)) {
+            //主表caller为单据caller
+            entryValue.billCaller = mCaller
+
+            formBillGroupModels.push(entryValue)
+          }
+        }
+        if (!isObjEmpty(formBillGroupModels)) {
+          formBillGroupModels.sort((pre, next) => {
+            return pre.minDetno - next.minDetno
+          })
+        }
+      }
+      showBillGroupModels = showBillGroupModels.concat(formBillGroupModels)
+
+      let gridetail = data.gridetail
+      let gridGroupModelMap = this.handlerGridetail(
+        showBillGroupModels.length,
+        gridetail)
+      if (!isObjEmpty(gridGroupModelMap)) {
+        for (let key in gridGroupModelMap) {
+          let entryValue = gridGroupModelMap[key]
+          if (!isObjNull(entryValue)) {
+            //单从表的情况下,从表caller和主表一样
+            entryValue.billCaller = mCaller
+            showBillGroupModels.push(entryValue)
+          }
+        }
+      }
+    }
+    return showBillGroupModels
+  }
+
+  /**
+   * 获取主表数据包含分组
+   * @param formdetail
+   */
+  handlerFormdetail = formdetail => {
+    if (!isObjEmpty(formdetail)) {
+      let object
+      let modelMap = {}
+      for (let i = 0; i < formdetail.length; i++) {
+        object = formdetail[i]
+        let billModel = this.getBillModelByObject(object)
+        let group = object.fd_group
+        //判断组别
+        if (group in modelMap) {
+          let mapBillGroupModel = modelMap[group]
+          if (isObjNull(mapBillGroupModel)) {
+            let mapBillGroupModel = new BillGroupModel()
+            mapBillGroupModel.isForm = true
+            mapBillGroupModel.group = group
+            mapBillGroupModel.groupIndex = Object.keys(modelMap).length
+            modelMap[group] = mapBillGroupModel
+          }
+          billModel.groupIndex = mapBillGroupModel.groupIndex
+          let minDetno = mapBillGroupModel.minDetno
+          if (minDetno > billModel.detno) {
+            minDetno = billModel.detno
+          }
+          mapBillGroupModel.minDetno = minDetno
+          if (this.isShow(billModel)) {
+            mapBillGroupModel.addShow(billModel)
+          } else {
+            mapBillGroupModel.addHide(billModel)
+          }
+        } else {
+          let mapBillGroupModel = new BillGroupModel()
+          mapBillGroupModel.group = group
+          mapBillGroupModel.isForm = true
+          mapBillGroupModel.groupIndex = Object.keys(modelMap).length
+          modelMap[group] = mapBillGroupModel
+
+          billModel.groupIndex = mapBillGroupModel.groupIndex
+          if (this.isShow(billModel)) {
+            mapBillGroupModel.addShow(billModel)
+          } else {
+            mapBillGroupModel.addHide(billModel)
+          }
+        }
+      }
+      return modelMap
+    } else {
+      return null
+    }
+  }
+
+  handlerGridetail = (index, formdetail) => {
+    if (!isObjEmpty(formdetail)) {
+      let modelMap = {}
+      if (mId <= 0) {
+        //id等于0,是新增单据,则默认添加一组从表
+        let billGroupModel = new BillGroupModel()
+        billGroupModel.groupIndex = index
+        billGroupModel.gridIndex = 1
+        billGroupModel.group = '明细1'
+        billGroupModel.lastInType = true
+        billGroupModel.isForm = false
+
+        let hideBillFields = []
+        let showBillFields = []
+        for (let i = 0; i < formdetail.length; i++) {
+          if (isObjNull(formdetail[i])) {
+            continue
+          }
+          let billModel = this.getBillModelByObject(formdetail[i])
+          if (!isObjNull(billModel)) {
+            billModel.groupIndex = index
+            if (this.isShow(billModel)) {
+              showBillFields.push(billModel)
+            } else {
+              hideBillFields.push(billModel)
+            }
+          }
+        }
+        billGroupModel.hideBillFields = hideBillFields
+        billGroupModel.showBillFields = showBillFields
+
+        modelMap['明细1'] = billGroupModel
+      } else {
+        //id大于0 ,说明是在录入单据,则将在录入数据先添加进从表
+        let object, oldGroup
+        for (let i = 0; i < formdetail.length; i++) {
+          object = formdetail[i]
+          if (isObjNull(object)) {
+            continue
+          }
+          let billModel = this.getBillModelByObject(object)
+          let dg_group = object.dg_group
+          let group = isObjEmpty(dg_group) ? '0' : dg_group//dg_group为0代表是新增的单据明细
+
+          if (`明细${group}` in modelMap) {
+            let billGroupModel = modelMap[`明细${group}`]
+            if (isObjNull(billGroupModel)) {
+              billGroupModel = new BillGroupModel()
+              billGroupModel.groupIndex = index +
+                Object.keys(modelMap).length -
+                1
+              billGroupModel.gridIndex = Object.keys(modelMap).length + 1
+              billGroupModel.group = `明细${Object.keys(modelMap).length + 1}`
+              billGroupModel.lastInType = true
+              billGroupModel.form = false
+
+              if (!isObjEmpty(oldGroup)) {
+                modelMap[oldGroup].lastInType = false
+              }
+              oldGroup = `明细${group}`
+              modelMap[`明细${group}`] = billGroupModel
+            }
+
+            billModel.groupIndex = billGroupModel.groupIndex
+            if (this.isShow(billModel)) {
+              billGroupModel.addShow(billModel)
+            } else {
+              billGroupModel.addHide(billModel)
+            }
+          } else {
+            let billGroupModel = new BillGroupModel()
+            billGroupModel.groupIndex = index + modelMap.keys.length
+            billGroupModel.gridIndex = modelMap.keys.length + 1
+            billGroupModel.group = `明细${modelMap.keys.length + 1}`
+            billGroupModel.lastInType = true
+            billGroupModel.form = false
+
+            modelMap[`明细${group}`] = billGroupModel
+
+            billModel.groupIndex = billGroupModel.groupIndex
+            if (this.isShow(billModel)) {
+              billGroupModel.addShow(billModel)
+            } else {
+              billGroupModel.addHide(billModel)
+            }
+
+            if (!isObjEmpty(oldGroup)) {
+              modelMap[oldGroup].lastInType = false
+            }
+            oldGroup = `明细${group}`
+          }
+        }
+      }
+      return modelMap
+    } else {
+      return null
+    }
+  }
+
+  getBillModelByObject = object => {
+    let billModel = new BillModel()
+
+    let caption = object.fd_caption || object.dg_caption//字段名称
+    let value = object.fd_value || object.dg_value//字段值
+    let fd_detno = object.fd_detno//序号
+    let id = object.fd_id || object.gd_id//id
+    let length = object.fd_maxlength || object.dg_maxlength//字符长度
+    let appwidth = object.fd_appwidth || object.dg_appwidth//宽度
+    let isdefault = object.mfd_isdefault || object.mdg_isdefault//是否显示
+    let dbfind = object.fd_dbfind //是否是dbfind字段判定
+    let type = object.fd_type || object.dg_type//类型(标题类型为Constants.TYPE_TITLE,不触发点击事件等 )
+    let logicType = object.fd_logictype || object.dg_logictype//logic类型
+    let readOnly = object.fd_readonly || object.dg_editable//是否只读
+    let field = object.fd_field || object.dg_field//字段
+    let defValue = object.fd_defaultvalue //默认值
+    let allowBlank = object.fd_allowblank//是否允许为空(注:当作为标题的时候T:表示可以删除 F:表示不可删除)
+    let findFunctionName = object.dg_findfunctionname
+    let updatable = object.fd_modify || object.dg_modify
+    let renderer = object.dg_renderer
+
+    if (isObjEmpty(defValue) && !isObjEmpty(mDefaultMap) &&
+      !isObjNull(mDefaultMap[field])) {
+      defValue = mDefaultMap[field]
+    }
+
+    if (logicType === 'necessaryField') {
+      allowBlank = 'F'
+    }
+
+    let display = ''
+    let combostore = object.COMBOSTORE
+    if (!isObjEmpty(combostore)) {
+      let localDatas = []
+      for (let i = 0; i < combostore.length; i++) {
+        let combosModel = combostore[i]
+        let dlc_display = combosModel.DLC_DISPLAY
+        let dlc_value = combosModel.DLC_VALUE
+
+        let localData = new LocalData()
+        localData.display = dlc_display
+        localData.value = dlc_value
+
+        if (type === 'C'
+          && !isObjEmpty(value)
+          && (value == dlc_display || value == dlc_value)) {
+          value = dlc_value
+          display = dlc_display
+        }
+        localDatas.push(localData)
+      }
+      billModel.localDatas = localDatas
+    }
+
+    billModel.findFunctionName = findFunctionName
+    billModel.detno = fd_detno
+    billModel.caption = caption
+    billModel.id = id
+    billModel.value = value
+    billModel.display = display
+    billModel.length = length
+    billModel.appwidth = appwidth
+    billModel.isdefault = isdefault
+    billModel.dbfind = dbfind
+    billModel.type = type
+    billModel.logicType = logicType
+    billModel.readOnly = readOnly
+    billModel.field = field
+    billModel.defValue = defValue
+    billModel.allowBlank = allowBlank
+    billModel.updatable = (updatable === 'T')
+    billModel.renderer = renderer
+
+    return billModel
+  }
+
+  changeBillModel = billGroupModels => {
+    if (isObjNull(mShowBillModels)) {
+      mShowBillModels = []
+    } else {
+      mShowBillModels.length = 0
+    }
+    if (isObjNull(mFormBillModels)) {
+      mFormBillModels = []
+    } else {
+      mFormBillModels.length = 0
+    }
+    if (isObjNull(mUpdateBillModels)) {
+      mUpdateBillModels = []
+    } else {
+      mUpdateBillModels.length = 0
+    }
+    if (isObjNull(mAllBillModels)) {
+      mAllBillModels = []
+    } else {
+      mAllBillModels.length = 0
+    }
+    //从表的起始Groupindex
+    let gridStartIndex = -1
+    for (let i = 0; i < billGroupModels.length; i++) {
+      let groupModel = billGroupModels[i]
+      if (!isObjNull(groupModel)) {
+        if (!isObjEmpty(groupModel.showBillFields)) {
+          if (!isObjEmpty(groupModel.group)) {
+            let titleBillModel = new BillModel()
+            titleBillModel.groupIndex = i
+            titleBillModel.type = TYPE_TITLE
+            if (groupModel.isForm == true) {
+              titleBillModel.caption = groupModel.group
+            } else {
+              if (gridStartIndex === -1) {
+                gridStartIndex = i
+              }
+              titleBillModel.caption = `明细${i - gridStartIndex + 1}`
+              titleBillModel.allowBlank = groupModel.isDeleteAble == true
+                ? 'T'
+                : 'F'
+              mShowBillModels.push(titleBillModel)
+            }
+          }
+          mShowBillModels = mShowBillModels.concat(groupModel.showBillFields)
+
+          if (groupModel.isForm == false && groupModel.lastInType == true) {
+            mShowBillModels.push(this.getAddModel(i))
+          }
+        }
+
+        ////////////////////////////////////////////////
+        if (!isObjEmpty(groupModel.updateBillFields)) {
+          mUpdateBillModels = mUpdateBillModels.concat(
+            groupModel.updateBillFields)
+        }
+
+        if (groupModel.isForm == true) {
+          if (!isObjEmpty(groupModel.showBillFields)) {
+            mFormBillModels = mFormBillModels.concat(
+              groupModel.showBillFields)
+          }
+          if (!isObjEmpty(groupModel.hideBillFields)) {
+            mFormBillModels = mFormBillModels.concat(
+              groupModel.hideBillFields)
+          }
+        }
+
+        if (!isObjEmpty(groupModel.showBillFields)) {
+          mAllBillModels = mAllBillModels.concat(groupModel.showBillFields)
+        }
+        if (!isObjEmpty(groupModel.hideBillFields)) {
+          mAllBillModels = mAllBillModels.concat(groupModel.hideBillFields)
+        }
+      }
+    }
+  }
+
+  isShow = (billModel) => (billModel.isdefault === -1 && billModel.type !==
+    'H')
+
+  getAddModel = index => {
+    let addBillModel = new BillModel()
+    addBillModel.groupIndex = index
+    addBillModel.type = TYPE_ADD
+    addBillModel.caption = '添加单据'
+    return addBillModel
+  }
+
+  getItemViewType = dfType => {
+    if (isObjEmpty(dfType)) {
+      return -1
+    }
+    switch (dfType.toUpperCase()) {
+      case TYPE_TITLE:
+        return 0
+      case TYPE_ADD:
+        return 110
+      case TYPE_TAB:
+        return 111
+      case 'C':
+      case 'SF':
+      case 'DF':
+      case 'S':
+      case 'SS':
+        return 1
+      case 'FF':
+        return 2
+      default:
+        return 1
+    }
+  }
+}

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

@@ -43,6 +43,7 @@ class ApprovalHome extends Component {
     super()
 
     this.state = {
+      pageVisible: false,
       tabHidden: false,
       isNewMenuLoading: true,
       isReceiveTodoLoading: true,
@@ -57,6 +58,11 @@ class ApprovalHome extends Component {
   }
 
   componentDidMount () {
+    setTimeout(() => {
+      this.setState({
+        pageVisible: true,
+      })
+    }, 100)
     // 用于刷新组建确认高度
     if (ReactDOM.findDOMNode(this.contain)) {
       const hei = this.state.receiveHeight -
@@ -177,7 +183,7 @@ class ApprovalHome extends Component {
 
   render () {
     return (
-      <div className='home-root'>
+      <div className={this.state.pageVisible ? 'home-root' : 'visibleHidden'}>
         <TabBar
           unselectedTintColor="#949494"
           tintColor="#33A3F4"
@@ -281,8 +287,8 @@ class ApprovalHome extends Component {
         this.setState({
           isNewMenuLoading: false,
         }, () => {
-          ReactDOM.findDOMNode(this.newList).scrollTop =
-            newState.scrollTop
+          // ReactDOM.findDOMNode(this.newList).scrollTop =
+          //   newState.scrollTop
         })
       }
     }
@@ -323,8 +329,8 @@ class ApprovalHome extends Component {
         this.setState({
           isReceiveTodoLoading: false,
         }, () => {
-          ReactDOM.findDOMNode(this.todoTab).scrollTop =
-            receiveState.scrollTop
+          // ReactDOM.findDOMNode(this.todoTab).scrollTop =
+          //   receiveState.scrollTop
         })
         mTodoIndex = receiveState.pageIndex
       }
@@ -338,8 +344,8 @@ class ApprovalHome extends Component {
         this.setState({
           isReceiveDoneLoading: false,
         }, () => {
-          ReactDOM.findDOMNode(this.doneTab).scrollTop =
-            receiveState.scrollTop2
+          // ReactDOM.findDOMNode(this.doneTab).scrollTop =
+          //   receiveState.scrollTop2
         })
         mDoneIndex = receiveState.pageIndex2
       }
@@ -371,8 +377,8 @@ class ApprovalHome extends Component {
         this.setState({
           isSendLoading: false,
         }, () => {
-          ReactDOM.findDOMNode(this.sendList).scrollTop =
-            sendState.scrollTop
+          // ReactDOM.findDOMNode(this.sendList).scrollTop =
+          //   sendState.scrollTop
         })
       }
     }
@@ -413,6 +419,9 @@ class ApprovalHome extends Component {
                      this.setState({
                        isReceiveTodoLoading: true,
                      })
+                     saveReceiveState({
+                       scrollTop: 0,
+                     })()
                      mTodoIndex = 0
                      this.loadTodoList()
                    }
@@ -432,6 +441,9 @@ class ApprovalHome extends Component {
                      this.setState({
                        isReceiveDoneLoading: true,
                      })
+                     saveReceiveState({
+                       scrollTop2: 0,
+                     })()
                      mDoneIndex = 0
                      this.loadDoneList()
                    }
@@ -460,6 +472,7 @@ class ApprovalHome extends Component {
       </div>
     )
   }
+
   renderSendTab = () => {
     return (
       <div className='receive-content-root'>
@@ -556,15 +569,13 @@ class ApprovalHome extends Component {
   }
 
   onFuncClick = (obj) => {
-    saveNewState({
-      scrollTop: ReactDOM.findDOMNode(this.newList).scrollTop,
-    })()
+    this.cacheScrollState()
+    this.props.history.push('/approvalAdd/' + obj.sv_caller+'/'+mMaster)
   }
 
   onReceiveItemClick = (index, approval) => {
+    this.cacheScrollState()
     saveReceiveState({
-      scrollTop: ReactDOM.findDOMNode(this.todoTab).scrollTop,
-      scrollTop2: ReactDOM.findDOMNode(this.doneTab).scrollTop,
       itemIndex: index,
     })()
     let jp_form = approval.JP_FORM
@@ -578,14 +589,13 @@ class ApprovalHome extends Component {
     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%22baseUrl%22%3A%22' + encodeURIComponent(mBaseUrl)
       + '%22%7D')
   }
 
   onSendItemClick = (index, approval) => {
-    saveSendState({
-      scrollTop: ReactDOM.findDOMNode(this.sendList).scrollTop,
-    })()
+    this.cacheScrollState()
     let jp_form = approval.JP_FORM
     let currentmaster = approval.CURRENTMASTER
     if (!isObjEmpty(jp_form) && !isObjEmpty(currentmaster) &&
@@ -597,10 +607,28 @@ class ApprovalHome extends Component {
     this.props.history.push('/approval/%7B%22' +
       'master%22%3A%22' + currentmaster
       + '%22%2C%22nodeId%22%3A' + approval.JP_NODEID
+      + '%2C%22type%22%3A' + 1
       + '%2C%22baseUrl%22%3A%22' + encodeURIComponent(mBaseUrl)
       + '%22%7D')
   }
 
+  cacheScrollState () {
+    console.log('raomeng', ReactDOM.findDOMNode(this.newList).scrollTop)
+    console.log('raomeng', ReactDOM.findDOMNode(this.todoTab).scrollTop)
+    console.log('raomeng', ReactDOM.findDOMNode(this.doneTab).scrollTop)
+    console.log('raomeng', ReactDOM.findDOMNode(this.sendList).scrollTop)
+    saveNewState({
+      scrollTop: ReactDOM.findDOMNode(this.newList).scrollTop,
+    })()
+    saveReceiveState({
+      scrollTop: ReactDOM.findDOMNode(this.todoTab).scrollTop,
+      scrollTop2: ReactDOM.findDOMNode(this.doneTab).scrollTop,
+    })()
+    saveSendState({
+      scrollTop: ReactDOM.findDOMNode(this.sendList).scrollTop,
+    })()
+  }
+
   getNewMenuData = () => {
     this.setState({
       isNewMenuLoading: true,

+ 35 - 0
uas-office-web/wxuasapproval/src/pages/approval/UasApproval.jsx

@@ -0,0 +1,35 @@
+/**
+ * Created by RaoMeng on 2020/2/20
+ * Desc: U审批过渡页
+ */
+
+import React, { Component } from 'react'
+import { clearHomeState } from '../../redux/actions/homeState'
+
+export default class UasApproval extends Component {
+
+  constructor () {
+    super()
+
+    this.state = {}
+  }
+
+  componentDidMount () {
+    document.title = 'U审批'
+    clearHomeState()()
+
+    this.props.history.push('/approvalHome')
+  }
+
+  componentWillUnmount () {
+
+  }
+
+  render () {
+    return (
+      <div>
+
+      </div>
+    )
+  }
+}

+ 14 - 1
uas-office-web/wxuasapproval/src/pages/approval/approval.css

@@ -208,7 +208,7 @@
 .line {
     width: 100%;
     background: #F2F2F2;
-    height: 10px;
+    height: 6px;
 }
 
 .receive-root {
@@ -277,6 +277,19 @@
     -webkit-overflow-scrolling: touch;
 }
 
+.approval-add-root {
+    width: 100%;
+    height: 100%;
+    overflow-y: scroll;
+    display: flex;
+    flex-direction: column;
+    background: white;
+}
+
+.approval-add-root::-webkit-scrollbar {
+    display: none;
+}
+
 
 /************************************************************************/