Browse Source

uas手机版
通用表单详情组件

RaoMeng 5 years ago
parent
commit
d0785f2d6c

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

@@ -7,6 +7,8 @@ import React, { Component } from 'react'
 import { connect } from 'react-redux'
 import './currency-detail.less'
 import { getFormItems } from '../../../utils/common/form.util'
+import { Toast } from 'antd-mobile'
+import { analysisFormData } from '../../../utils/common/form.request'
 
 class CurrencyDetail extends Component {
 
@@ -17,7 +19,7 @@ class CurrencyDetail extends Component {
   }
 
   componentDidMount () {
-
+    this.requestFormData()
   }
 
   componentWillUnmount () {
@@ -39,6 +41,13 @@ class CurrencyDetail extends Component {
       </div>
     )
   }
+
+  requestFormData = () => {
+    Toast.loading('单据获取中', 0)
+    setTimeout(() => {
+      analysisFormData()
+    }, 1000)
+  }
 }
 
 let mapStateToProps = (state) => ({})

+ 10 - 4
uas-office-web/uas-mobile/src/components/common/currencyList/CurrencyList.jsx

@@ -154,7 +154,7 @@ class CurrencyList extends Component {
         })
         saveListState({
           pageIndex: 0,
-          // listData: [],
+          listData: [],
         })
         this.loadDataList()
       }}
@@ -188,15 +188,21 @@ class CurrencyList extends Component {
 
   onTabSelect = (tabIndex) => {
     saveListState({
-      tabSelect: tabIndex,
       pageIndex: 0,
+      tabSelect: tabIndex,
+      listData: [],
     })
-    this.loadDataList()
+    //Todo 解决redux修改数据不同步问题
+    setTimeout(() => {
+      this.loadDataList()
+    }, 100)
   }
 
   loadDataList = () => {
     const { requestList, listState: { tabList, tabSelect } } = this.props
-    requestList && requestList(tabList ? tabList[tabSelect].CALLER : '')
+    console.log(tabList)
+    console.log(tabSelect)
+    requestList && requestList(tabList ? tabList[tabSelect].CODE : '')
       .then(() => {
         this.setState({
           refreshing: false,

+ 127 - 0
uas-office-web/uas-mobile/src/utils/common/form.request.js

@@ -0,0 +1,127 @@
+/**
+ * Created by RaoMeng on 2020/12/11
+ * Desc: 通用表单接口数据处理
+ */
+import { Toast } from 'antd-mobile'
+import { isObjEmpty } from './common.util'
+import BillGroupModel from '../../model/common/BillGroupModel'
+
+const testForm = [
+  {
+    'groupTitle': '基础信息',
+    'isForm': true,
+    'keyField': 'base',
+    'groupCaller': 'test',
+    'fieldList': [
+      {
+        'appwidth': '字符宽度',
+        'isdefault': true,
+        'caption': '姓名',
+        'value': 'raomeng',
+        'display': '饶猛',
+        'type': 'S',
+        'readOnly': true,
+        'field': 'name',
+        'defValue': '',
+        'allowBlank': true,
+        'localDatas': [],
+      },
+      {
+        'appwidth': '字符宽度',
+        'isdefault': true,
+        'caption': '姓名',
+        'value': 'raomeng',
+        'display': '饶猛',
+        'type': 'S',
+        'readOnly': true,
+        'field': 'name',
+        'defValue': '',
+        'allowBlank': true,
+        'localDatas': [],
+      },
+      {
+        'appwidth': '字符宽度',
+        'isdefault': true,
+        'caption': '姓名',
+        'value': 'raomeng',
+        'display': '饶猛',
+        'type': 'S',
+        'readOnly': true,
+        'field': 'name',
+        'defValue': '',
+        'allowBlank': true,
+        'localDatas': [],
+      },
+      {
+        'appwidth': '字符宽度',
+        'isdefault': true,
+        'caption': '姓名',
+        'value': 'raomeng',
+        'display': '饶猛',
+        'type': 'S',
+        'readOnly': true,
+        'field': 'name',
+        'defValue': '',
+        'allowBlank': true,
+        'localDatas': [],
+      },
+      {
+        'appwidth': '字符宽度',
+        'isdefault': true,
+        'caption': '姓名',
+        'value': 'raomeng',
+        'display': '饶猛',
+        'type': 'S',
+        'readOnly': true,
+        'field': 'name',
+        'defValue': '',
+        'allowBlank': true,
+        'localDatas': [],
+      },
+      {
+        'appwidth': '字符宽度',
+        'isdefault': true,
+        'caption': '姓名',
+        'value': 'raomeng',
+        'display': '饶猛',
+        'type': 'S',
+        'readOnly': true,
+        'field': 'name',
+        'defValue': '',
+        'allowBlank': true,
+        'localDatas': [],
+      },
+      {
+        'appwidth': '字符宽度',
+        'isdefault': true,
+        'caption': '姓名',
+        'value': 'raomeng',
+        'display': '饶猛',
+        'type': 'S',
+        'readOnly': true,
+        'field': 'name',
+        'defValue': '',
+        'allowBlank': true,
+        'localDatas': [],
+      },
+    ],
+  },
+]
+
+export function analysisFormData () {
+  if (!isObjEmpty(testForm)) {
+    let billGroupList = []
+    testForm.forEach((groupItem, groupIndex) => {
+      let billGroup = new BillGroupModel()
+      billGroup.group = groupItem.groupTitle
+      billGroup.isForm = groupIndex.isForm
+      billGroup.keyField = groupIndex.keyField
+      billGroup.billCaller = groupIndex.groupCaller
+      billGroup.groupIndex = groupIndex
+
+      if (!isObjEmpty(groupItem.fieldList)) {
+        groupItem.fieldList.forEach(() => {})
+      }
+    })
+  }
+}