Browse Source

uas手机版
应用单据详情

RaoMeng 5 years ago
parent
commit
47a64beddb

+ 2 - 2
uas-office-web/uas-mobile/src/components/common/currencyDetail/CurrencyDetail.jsx

@@ -32,9 +32,9 @@ class CurrencyDetail extends Component {
         <div className='currency-detail-content'>
           {formItems}
         </div>
-        <div className='currency-detail-operation'>
+        {/*<div className='currency-detail-operation'>*/}
 
-        </div>
+        {/*</div>*/}
       </div>
     )
   }

+ 6 - 2
uas-office-web/uas-mobile/src/components/common/currencyList/CurrencyList.jsx

@@ -54,7 +54,7 @@ class CurrencyList extends Component {
       }),
     })
 
-    const { requestList, requestTab, requestSearchConfig, listState: { tabList, listData, filterList } } = this.props
+    const { requestList, requestTab, requestSearchConfig, listState: { tabList, listData, filterList, scrollTop } } = this.props
 
     if (isObjEmpty(tabList) && !isObjNull(requestTab)) {
       requestTab()
@@ -76,6 +76,8 @@ class CurrencyList extends Component {
         this.forceUpdate()
       }, 0)
     }, this)
+
+    ReactDOM.findDOMNode(this.lv).scrollTop = this.props.listState.scrollTop
   }
 
   componentWillUnmount () {
@@ -176,7 +178,6 @@ class CurrencyList extends Component {
 
   getFilterLayout = () => {
     const { listState: { filterList } } = this.props
-    console.log(filterList)
     const formItems = getFormItems(filterList)
     return (
       <div
@@ -229,6 +230,9 @@ class CurrencyList extends Component {
   }
 
   onItemClick = (rowData) => {
+    saveListState({
+      scrollTop: ReactDOM.findDOMNode(this.lv).scrollTop,
+    })
     const { onItemClick } = this.props
     onItemClick && onItemClick(rowData)
   }

+ 13 - 12
uas-office-web/uas-mobile/src/components/common/formNew/FormInput.jsx

@@ -62,6 +62,7 @@ export default class FormInput extends Component {
           this.getDateCom(type, billModel)
         break
       case 'HTML':
+      case 'HOS':
         valueItem =
           this.getHtmlcom(billModel)
         break
@@ -129,7 +130,7 @@ export default class FormInput extends Component {
    * @returns {*}
    */
   renderTwoLines (billModel, valueItem) {
-    return <div className={'form-textarea-layout'}>
+    return <div className='form-textarea-layout'>
       <div className='form-common-layout'
            style={{ borderBottom: 'none' }}>
         <div style={{
@@ -153,11 +154,11 @@ export default class FormInput extends Component {
    */
   getTextCom (billModel) {
     return <TextareaItem className='form-input-value' autoHeight
-                         placeholder={this.isSelect(billModel)
-                           ? '请选择'
-                           : ((billModel.readOnly === 'T' ||
-                             billModel.editable === 'F')
-                             ? ''
+                         placeholder={(billModel.readOnly === 'T' ||
+                           billModel.editable === 'F')
+                           ? ''
+                           : (this.isSelect(billModel)
+                             ? '请选择'
                              : '请输入')}
                          clear={true}
                          editable={(billModel.readOnly === 'T' ||
@@ -205,7 +206,7 @@ export default class FormInput extends Component {
       }}
       mode={type === 'DT' ? 'datetime' : 'date'}
       extra={(billModel.readOnly === 'T' ||
-        billModel.editable === 'F') ? '' : type === 'DT' ? '选择时间' : '选择日期'}
+        billModel.editable === 'F') ? ' ' : type === 'DT' ? '选择时间' : '选择日期'}
       disabled={(billModel.readOnly === 'T' ||
         billModel.editable === 'F') ? true : false}
       value={!isObjEmpty(this.getValue(billModel))
@@ -230,11 +231,11 @@ export default class FormInput extends Component {
    */
   getNumCom (billModel) {
     return <InputItem className='form-input-value' clear
-                      placeholder={this.isSelect(billModel)
-                        ? '请选择'
-                        : ((billModel.readOnly === 'T' ||
-                          billModel.editable === 'F')
-                          ? ''
+                      placeholder={(billModel.readOnly === 'T' ||
+                        billModel.editable === 'F')
+                        ? ''
+                        : (this.isSelect(billModel)
+                          ? '请选择'
                           : '请输入')}
                       editable={(billModel.readOnly === 'T' ||
                         billModel.editable === 'F') ? false : (this.isSelect(

+ 2 - 0
uas-office-web/uas-mobile/src/components/common/formNew/formCommon.less

@@ -96,7 +96,9 @@
   max-height: 300px;
   padding-left: 4px;
   padding-right: 4px;
+  margin-bottom: 0px;
   overflow-y: scroll;
+  align-items: normal;
 }
 
 .form-textarea-layout .form-input-value.am-list-item.am-textarea-item::-webkit-scrollbar {

+ 3 - 0
uas-office-web/uas-mobile/src/configs/api.config.js

@@ -34,6 +34,9 @@ export const API = {
   //获取应用列表
   SETVICES_GETORDERLIST: _baseURL +
     '/mobile/appweb/services/getOrderList.action',
+  //获取应用详情
+  SETVICES_GETORDER: _baseURL +
+    '/mobile/appweb/services/getOrder.action',
 
   /*******************************报表*************************************/
   //获取报表菜单

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

@@ -133,7 +133,7 @@ class Routes extends React.Component {
           {/*应用数据列表*/}
           <Route path='/serviceList/:caller/:title?' component={ServiceList}/>
           {/*应用单据详情*/}
-          <Route path='/ServiceDetail'
+          <Route path='/ServiceDetail/:id/:caller/:title?'
                  component={ServiceDetail}/>
 
           {/*************************************切换账套*****************************************/}

+ 0 - 1
uas-office-web/uas-mobile/src/pages/private/homePage/DocRoot.jsx

@@ -49,7 +49,6 @@ class DocRoot extends Component {
     return (
       <RefreshLayout
         direction={'down'}
-        height={'100%'}
         refreshing={this.state.refreshing}
         onRefresh={this.refreshFunc}
         className='doc-root'>

+ 20 - 4
uas-office-web/uas-mobile/src/pages/private/service/ServiceDetail.jsx

@@ -11,6 +11,9 @@ import CurrencyDetail
   from '../../../components/common/currencyDetail/CurrencyDetail'
 import { GlobalEvent } from '../../../utils/common/eventbus/eventbus'
 import { CURRENCY_DETAIL_DATA_REFRESH } from '../../../utils/common/eventbus/events.types'
+import { fetchPostObj } from '../../../utils/common/fetchRequest'
+import { API } from '../../../configs/api.config'
+import { message } from 'antd'
 
 class ServiceDetail extends Component {
 
@@ -23,7 +26,10 @@ class ServiceDetail extends Component {
   }
 
   componentDidMount () {
-    document.title = ''
+    this.caller = this.props.match.params.caller
+    this.id = this.props.match.params.id
+    const title = this.props.match.params.title
+    document.title = title || '单据详情'
 
     this.requestFormData()
 
@@ -49,11 +55,21 @@ class ServiceDetail extends Component {
 
   requestFormData = () => {
     Toast.loading('单据获取中', 0)
-    setTimeout(() => {
+    fetchPostObj(API.SETVICES_GETORDER, {
+      id: this.id,
+      caller: this.caller,
+    }).then(response => {
       Toast.hide()
-      const billGroupList = analysisFormData()
+      const billGroupList = analysisFormData(response.data, true)
       this.setState({ billGroupList })
-    }, 1000)
+    }).catch(error => {
+      Toast.hide()
+      if (typeof error === 'string') {
+        message.error(error)
+      } else {
+        message.error('单据获取异常')
+      }
+    })
   }
 }
 

+ 3 - 2
uas-office-web/uas-mobile/src/pages/private/service/ServiceList.jsx

@@ -131,8 +131,9 @@ class ServiceList extends Component {
   /**
    * 列表点击事件
    */
-  onItemClick = () => {
-    this.props.history.push('/ServiceDetail')
+  onItemClick = (rowData) => {
+    this.props.history.push(
+      '/ServiceDetail/' + rowData.id + '/' + this.caller + '/' + this.title)
   }
 }
 

+ 71 - 147
uas-office-web/uas-mobile/src/utils/common/form.request.js

@@ -2,164 +2,88 @@
  * Created by RaoMeng on 2020/12/11
  * Desc: 通用表单接口数据处理
  */
-import { Toast } from 'antd-mobile'
 import { isObjEmpty } from './common.util'
 import BillGroupModel from '../../model/common/BillGroupModel'
 import BillModel from '../../model/common/BillModel'
 
-const testForm = [
-  {
-    'groupTitle': '基础信息',
-    'isForm': true,
-    'keyField': 'base',
-    'groupCaller': 'test',
-    'fieldList': [
-      {
-        'appwidth': 100,
-        'length': 100,
-        'isdefault': true,
-        'caption': '姓名',
-        'value': '饶猛',
-        'display': '饶猛',
-        'type': 'S',
-        'readOnly': true,
-        'field': 'name',
-        'defValue': '',
-        'allowBlank': true,
-        'localDatas': [],
-      },
-      {
-        'appwidth': 100,
-        'length': 100,
-        'isdefault': true,
-        'caption': '性别',
-        'value': '男',
-        'display': '饶猛',
-        'type': 'S',
-        'readOnly': true,
-        'field': 'name',
-        'defValue': '',
-        'allowBlank': true,
-        'localDatas': [],
-      },
-      {
-        'appwidth': 100,
-        'length': 100,
-        'isdefault': true,
-        'caption': '年龄',
-        'value': '25',
-        'display': '饶猛',
-        'type': 'S',
-        'readOnly': true,
-        'field': 'name',
-        'defValue': '',
-        'allowBlank': true,
-        'localDatas': [],
-      },
-      {
-        'appwidth': 100,
-        'length': 100,
-        'isdefault': true,
-        'caption': '籍贯',
-        'value': '江西',
-        'display': '饶猛',
-        'type': 'S',
-        'readOnly': true,
-        'field': 'name',
-        'defValue': '',
-        'allowBlank': true,
-        'localDatas': [],
-      },
-      {
-        'appwidth': 100,
-        'length': 100,
-        'isdefault': true,
-        'caption': '公司',
-        'value': '深圳市优软科技有限公司',
-        'display': '饶猛',
-        'type': 'S',
-        'readOnly': true,
-        'field': 'name',
-        'defValue': '',
-        'allowBlank': true,
-        'localDatas': [],
-      },
-      {
-        'appwidth': 100,
-        'length': 100,
-        'isdefault': true,
-        'caption': '学校',
-        'value': '南昌大学',
-        'display': '饶猛',
-        'type': 'S',
-        'readOnly': true,
-        'field': 'name',
-        'defValue': '',
-        'allowBlank': true,
-        'localDatas': [],
-      },
-      {
-        'appwidth': 100,
-        'length': 100,
-        'isdefault': true,
-        'caption': '高中',
-        'value': '金溪一中',
-        'display': '饶猛',
-        'type': 'S',
-        'readOnly': true,
-        'field': 'name',
-        'defValue': '',
-        'allowBlank': true,
-        'localDatas': [],
-      },
-    ],
-  },
-]
-
-export function analysisFormData () {
+export function analysisFormData (formData, isDetail) {
   let billGroupList = []
-  if (!isObjEmpty(testForm)) {
-    testForm.forEach((groupItem, groupIndex) => {
-      let billGroup = new BillGroupModel()
-      billGroup.group = groupItem.groupTitle
-      billGroup.isForm = groupItem.isForm
-      billGroup.keyField = groupItem.keyField
-      billGroup.billCaller = groupItem.groupCaller
-      billGroup.groupIndex = groupIndex
+  if (!isObjEmpty(formData)) {
+    const formList = formData.formList
+    const gridList = formData.gridList
 
-      let showBillFields = [], hideBillFields = []
-      if (!isObjEmpty(groupItem.fieldList)) {
-        groupItem.fieldList.forEach((fieldItem, filedIndex) => {
-          let billModel = new BillModel()
+    /**
+     * 主表数据
+     */
+    if (!isObjEmpty(formList)) {
+      formList.forEach((formGroup, formIndex) => {
+        const billGroup = getBillGroup(formGroup, billGroupList.length,
+          isDetail)
+        billGroupList.push(billGroup)
+      })
+    }
 
-          billModel.groupIndex = groupIndex
-          billModel.appwidth = fieldItem.appwidth
-          billModel.length = fieldItem.length
-          billModel.isdefault = fieldItem.isdefault
-          billModel.caption = fieldItem.caption
-          billModel.type = fieldItem.type
-          billModel.readOnly = fieldItem.readOnly ? 'T' : 'F'
-          billModel.field = fieldItem.field
-          billModel.value = fieldItem.value
-          billModel.display = fieldItem.display
-          billModel.defValue = fieldItem.defValue
-          billModel.logicType = fieldItem.logicType
-          billModel.allowBlank = fieldItem.allowBlank ? 'T' : 'F'
+    /**
+     * 从表数据
+     */
+    if (!isObjEmpty(gridList)) {
+      gridList.forEach((gridGroup, gridIndex) => {
+        //单个从表的明细列表
+        const gridDetailList = gridGroup.fieldList
+        if (!isObjEmpty(gridDetailList)) {
+          gridDetailList.forEach((gridDetail, gridDetailIndex) => {
+            const billGroup = getBillGroup({
+              ...gridGroup,
+              fieldList: gridDetail,
+            }, billGroupList.length, isDetail)
+            billGroupList.push(billGroup)
+          })
+        }
+      })
+    }
+  }
 
-          if (billModel.isdefault) {
-            showBillFields.push(billModel)
-          } else {
-            hideBillFields.push(billModel)
-          }
-        })
-      }
+  return billGroupList
+}
 
-      billGroup.showBillFields = showBillFields
-      billGroup.hideBillFields = hideBillFields
+export function getBillGroup (groupItem, groupIndex, isDetail) {
+  let billGroup = new BillGroupModel()
+  billGroup.group = groupItem.groupTitle
+  billGroup.isForm = groupItem.isForm
+  billGroup.keyField = groupItem.keyField
+  billGroup.billCaller = groupItem.groupCaller
+  billGroup.groupIndex = groupIndex
 
-      billGroupList.push(billGroup)
+  let showBillFields = [], hideBillFields = []
+  if (!isObjEmpty(groupItem.fieldList)) {
+    groupItem.fieldList.forEach((fieldItem, filedIndex) => {
+      let billModel = new BillModel()
+
+      billModel.groupIndex = groupIndex
+      billModel.appwidth = fieldItem.appwidth
+      billModel.length = fieldItem.length
+      billModel.isdefault = fieldItem.isdefault
+      billModel.caption = fieldItem.caption
+      billModel.type = fieldItem.type
+      billModel.readOnly = (fieldItem.readOnly || isDetail) ? 'T' : 'F'
+      billModel.field = fieldItem.field
+      billModel.value = fieldItem.value
+      billModel.display = fieldItem.display
+      billModel.defValue = fieldItem.defValue
+      billModel.logicType = fieldItem.logicType
+      billModel.allowBlank = (fieldItem.allowBlank || isDetail) ? 'T' : 'F'
+      billModel.localDatas = fieldItem.localDatas
+
+      if (billModel.isdefault) {
+        showBillFields.push(billModel)
+      } else {
+        hideBillFields.push(billModel)
+      }
     })
   }
 
-  return billGroupList
+  billGroup.showBillFields = showBillFields
+  billGroup.hideBillFields = hideBillFields
+
+  return billGroup
 }

+ 5 - 2
uas-office-web/uas-mobile/src/utils/common/form.util.js

@@ -202,8 +202,11 @@ function addGroupTitle (
   }
   if (!isObjEmpty(titleBillModel.caption)) {
     formItems.push(
-      <FormTitle billModel={titleBillModel} groupIndex={g}
-                 onDeleteClick={onDeleteClick.bind(this, billGroupModelList)}
+      <FormTitle
+        billModel={titleBillModel}
+        groupIndex={g}
+        onDeleteClick={onDeleteClick.bind(this, billGroupModelList)}
+        key={'formTitle' + g}
       />,
     )
   }