Browse Source

uas手机版
通用表单基础封装

RaoMeng 5 years ago
parent
commit
283a9abc83

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

@@ -7,8 +7,6 @@ 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 {
 
@@ -19,7 +17,6 @@ class CurrencyDetail extends Component {
   }
 
   componentDidMount () {
-    this.requestFormData()
   }
 
   componentWillUnmount () {
@@ -42,12 +39,6 @@ class CurrencyDetail extends Component {
     )
   }
 
-  requestFormData = () => {
-    Toast.loading('单据获取中', 0)
-    setTimeout(() => {
-      analysisFormData()
-    }, 1000)
-  }
 }
 
 let mapStateToProps = (state) => ({})

+ 1 - 1
uas-office-web/uas-mobile/src/components/common/func/FuncGroup.jsx

@@ -78,7 +78,7 @@ export default class FuncGroup extends Component {
       <div
         className={card ? 'func-group-card' : 'func-group-normal'}>
         <FuncTitle funcTitle={funcGroup}
-                   card
+                   card={card}
                    rightIcon={rightIcon || funcGroup.rightIcon}
                    onRightClick={onRightClick}/>
         <div

+ 10 - 1
uas-office-web/uas-mobile/src/components/private/report/ReportSearchItem.jsx

@@ -5,6 +5,7 @@
 
 import React, { Component } from 'react'
 import './comp-report.less'
+import { Icon } from 'antd-mobile'
 
 export default class ReportSearchItem extends Component {
 
@@ -28,7 +29,15 @@ export default class ReportSearchItem extends Component {
       <div
         className='report-search-item-root'
         onClick={this.onSubItemClick}>
-        <img src={reportObj.img} className='report-search-item-img'/>
+        {
+          reportObj.img ?
+            <img src={reportObj.img}
+                 className='report-search-item-img'/> :
+            <Icon
+              className='report-search-item-img'
+              type={reportObj.icon || 'uas-func-default'}/>
+        }
+
         <span className='report-search-item-name'>{reportObj.name}</span>
       </div>
     )

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

@@ -4,9 +4,9 @@
  */
 
 export const _host = window.location.origin
-  && 'http://10.1.7.104:8090/ERP'//吴炳
-  && 'http://10.1.7.44:8081/erp'//吴雨骁
-  && 'http://usoft.f3322.net:10007/uas'
+  // && 'http://10.1.7.104:8090/ERP'//吴炳
+  // && 'http://10.1.7.44:8081/erp'//吴雨骁
+  // && 'http://usoft.f3322.net:10007/uas'
 
 export const _baseURL = _host + (process.env.REACT_APP_ROUTER_BASE_NAME || '')
 

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

@@ -51,6 +51,8 @@ const OftenFuncManage = PageLoadable(
   import(/* webpackChunkName:'subscribe' */'@/pages/private/oftenFunc/OftenFuncManage'))
 const ServiceList = PageLoadable(
   import(/* webpackChunkName:'subscribe' */'@/pages/private/service/ServiceList'))
+const ServiceDetail = PageLoadable(
+  import(/* webpackChunkName:'subscribe' */'@/pages/private/service/ServiceDetail'))
 
 /**
  * 自定义页面返回事件拦截框
@@ -110,14 +112,17 @@ class Routes extends React.Component {
           {/***************************************报表******************************************/}
           {/*报表搜索*/}
           <Route path='/reportSearch' component={ReportSearch}/>
-          {/*报表列表*/}
+          {/*报表数据列表*/}
           <Route path='/reportList/:caller/:title?' component={ReportList}/>
 
           {/***************************************应用*******************************************/}
           {/*常用应用管理*/}
           <Route path='/oftenFuncManage' component={OftenFuncManage}/>
-          {/*应用列表*/}
+          {/*应用数据列表*/}
           <Route path='/serviceList/:caller/:title?' component={ServiceList}/>
+          {/*应用单据详情*/}
+          <Route path='/ServiceDetail'
+                 component={ServiceDetail}/>
 
           {/*所有错误路由跳转页面*/}
           <Route render={() => (

+ 54 - 0
uas-office-web/uas-mobile/src/pages/private/service/ServiceDetail.jsx

@@ -0,0 +1,54 @@
+/**
+ * Created by RaoMeng on 2020/12/11
+ * Desc: 应用详情
+ */
+
+import React, { Component } from 'react'
+import { connect } from 'react-redux'
+import { Toast } from 'antd-mobile'
+import { analysisFormData } from '../../../utils/common/form.request'
+import CurrencyDetail
+  from '../../../components/common/currencyDetail/CurrencyDetail'
+
+class ServiceDetail extends Component {
+
+  constructor () {
+    super()
+
+    this.state = {
+      billGroupList: [],
+    }
+  }
+
+  componentDidMount () {
+    document.title = ''
+
+    this.requestFormData()
+  }
+
+  componentWillUnmount () {
+
+  }
+
+  render () {
+    const { billGroupList } = this.state
+    return (
+      <div>
+        <CurrencyDetail formGroups={billGroupList}/>
+      </div>
+    )
+  }
+
+  requestFormData = () => {
+    Toast.loading('单据获取中', 0)
+    setTimeout(() => {
+      Toast.hide()
+      const billGroupList = analysisFormData()
+      this.setState({ billGroupList })
+    }, 1000)
+  }
+}
+
+let mapStateToProps = (state) => ({})
+
+export default connect(mapStateToProps)(ServiceDetail)

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

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

+ 62 - 25
uas-office-web/uas-mobile/src/utils/common/form.request.js

@@ -5,6 +5,7 @@
 import { Toast } from 'antd-mobile'
 import { isObjEmpty } from './common.util'
 import BillGroupModel from '../../model/common/BillGroupModel'
+import BillModel from '../../model/common/BillModel'
 
 const testForm = [
   {
@@ -14,10 +15,11 @@ const testForm = [
     'groupCaller': 'test',
     'fieldList': [
       {
-        'appwidth': '字符宽度',
+        'appwidth': 100,
+        'length': 100,
         'isdefault': true,
         'caption': '姓名',
-        'value': 'raomeng',
+        'value': '饶猛',
         'display': '饶猛',
         'type': 'S',
         'readOnly': true,
@@ -27,10 +29,11 @@ const testForm = [
         'localDatas': [],
       },
       {
-        'appwidth': '字符宽度',
+        'appwidth': 100,
+        'length': 100,
         'isdefault': true,
-        'caption': '姓名',
-        'value': 'raomeng',
+        'caption': '性别',
+        'value': '',
         'display': '饶猛',
         'type': 'S',
         'readOnly': true,
@@ -40,10 +43,11 @@ const testForm = [
         'localDatas': [],
       },
       {
-        'appwidth': '字符宽度',
+        'appwidth': 100,
+        'length': 100,
         'isdefault': true,
-        'caption': '姓名',
-        'value': 'raomeng',
+        'caption': '年龄',
+        'value': '25',
         'display': '饶猛',
         'type': 'S',
         'readOnly': true,
@@ -53,10 +57,11 @@ const testForm = [
         'localDatas': [],
       },
       {
-        'appwidth': '字符宽度',
+        'appwidth': 100,
+        'length': 100,
         'isdefault': true,
-        'caption': '姓名',
-        'value': 'raomeng',
+        'caption': '籍贯',
+        'value': '江西',
         'display': '饶猛',
         'type': 'S',
         'readOnly': true,
@@ -66,10 +71,11 @@ const testForm = [
         'localDatas': [],
       },
       {
-        'appwidth': '字符宽度',
+        'appwidth': 100,
+        'length': 100,
         'isdefault': true,
-        'caption': '姓名',
-        'value': 'raomeng',
+        'caption': '公司',
+        'value': '深圳市优软科技有限公司',
         'display': '饶猛',
         'type': 'S',
         'readOnly': true,
@@ -79,10 +85,11 @@ const testForm = [
         'localDatas': [],
       },
       {
-        'appwidth': '字符宽度',
+        'appwidth': 100,
+        'length': 100,
         'isdefault': true,
-        'caption': '姓名',
-        'value': 'raomeng',
+        'caption': '学校',
+        'value': '南昌大学',
         'display': '饶猛',
         'type': 'S',
         'readOnly': true,
@@ -92,10 +99,11 @@ const testForm = [
         'localDatas': [],
       },
       {
-        'appwidth': '字符宽度',
+        'appwidth': 100,
+        'length': 100,
         'isdefault': true,
-        'caption': '姓名',
-        'value': 'raomeng',
+        'caption': '高中',
+        'value': '金溪一中',
         'display': '饶猛',
         'type': 'S',
         'readOnly': true,
@@ -109,19 +117,48 @@ const testForm = [
 ]
 
 export function analysisFormData () {
+  let billGroupList = []
   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.isForm = groupItem.isForm
+      billGroup.keyField = groupItem.keyField
+      billGroup.billCaller = groupItem.groupCaller
       billGroup.groupIndex = groupIndex
 
+      let showBillFields = [], hideBillFields = []
       if (!isObjEmpty(groupItem.fieldList)) {
-        groupItem.fieldList.forEach(() => {})
+        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 ? 'T' : 'F'
+          billModel.field = fieldItem.field
+          billModel.value = fieldItem.value
+          billModel.display = fieldItem.display
+          billModel.defValue = fieldItem.defValue
+          billModel.allowBlank = fieldItem.allowBlank
+
+          if (billModel.isdefault) {
+            showBillFields.push(billModel)
+          } else {
+            hideBillFields.push(billModel)
+          }
+        })
       }
+
+      billGroup.showBillFields = showBillFields
+      billGroup.hideBillFields = hideBillFields
+
+      billGroupList.push(billGroup)
     })
   }
+
+  return billGroupList
 }