소스 검색

Merge branch 'dev' of ssh://10.10.100.21/source/uas-office-integration into dev

samhoo 5 년 전
부모
커밋
3e7b1db321

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

@@ -26,6 +26,12 @@ import {
   fetchPostObj,
 } from '../../../utils/common/fetchRequest'
 import BillModel, {
+  billGetDisplay,
+  billGetValue,
+  billIsCombo,
+  billIsMultiDbfind,
+  billIsShow,
+  billIsSingleDbfind, getItemViewType,
   TYPE_ADD,
   TYPE_TAB,
   TYPE_TITLE,
@@ -56,7 +62,7 @@ let mStatusField//状态字段
 let mDetailMainKeyField//从表
 let mDefaultMap
 
-let mModalList = []
+let mModalList, mSearchList = []
 
 let mShowBillModels, mFormBillModels, mUpdateBillModels, mAllBillModels
 
@@ -139,7 +145,7 @@ class CurrencyDetail extends Component {
           || <Button
             type={'primary'}
             style={{
-              margin: '18px 26px',
+              margin: '14px 24px',
               height: '36px',
               lineHeight: '36px',
               fontSize: '16px',
@@ -169,7 +175,7 @@ class CurrencyDetail extends Component {
             for (let i = 0; i < showBillFields.length; i++) {
               let billModel = showBillFields[i]
               if (!isObjNull(billModel)) {
-                let itemViewType = this.getItemViewType(billModel.type)
+                let itemViewType = getItemViewType(billModel.type)
                 if (billModel.renderer == 'detailAttach') {
                   itemViewType = 2
                 }
@@ -270,12 +276,9 @@ class CurrencyDetail extends Component {
         maxLength={16}
         onChange={value => {
           if (isObjEmpty(value)) {
-            this.setState({
-              modalDataSource: modalDataSource.cloneWithRows(
-                mModalList),
-            })
+            mSearchList = mModalList
           } else {
-            let searchList = []
+            mSearchList = []
             if (!isObjEmpty(mModalList)) {
               mModalList.forEach(item => {
                 if (!isObjNull(item)
@@ -288,20 +291,21 @@ class CurrencyDetail extends Component {
                     || strContain(item.EM_POSITION, value)
                     || strContain(item.EM_DEFAULTORNAME, value)
                   )) {
-                  searchList.push(item)
+                  mSearchList.push(item)
                 }
               })
             }
-            this.setState({
-              modalDataSource: modalDataSource.cloneWithRows(
-                searchList),
-            })
           }
+          this.setState({
+            modalDataSource: modalDataSource.cloneWithRows(
+              mSearchList),
+          })
         }}
         onClear={value => {
+          mSearchList = mModalList
           this.setState({
             modalDataSource: modalDataSource.cloneWithRows(
-              mModalList),
+              mSearchList),
           })
         }}
         /*onCancel={() => {
@@ -315,33 +319,34 @@ class CurrencyDetail extends Component {
         dataSource={modalDataSource}
         initialListSize={30}
         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>
+          if (selectType === SELECT_APPROVAL) {
+            return <List.Item
+              key={rowID}
+              wrap
+              onClick={this.onEmployeeSelect.bind(this,
+                rowData)}>
+              <EmployeeItem employee={rowData}/>
+            </List.Item>
+          } else if (billIsMultiDbfind(selectModel)) {
+            return <CheckboxItem
+              key={rowID}
+              checked={rowData.isSelected}
+              onChange={e => {
+                let checked = e.target.checked
+                rowData.isSelected = checked
+                mModalList[rowData.index].isSelected = checked
+                mSearchList = JSON.parse(JSON.stringify(mSearchList))
+                this.setState({
+                  modalDataSource: modalDataSource.cloneWithRows(mSearchList),
+                })
+              }}>{rowData.value}</CheckboxItem>
+          } else {
+            return <List.Item
+              key={rowID}
+              wrap
+              onClick={this.onDbfindSelect.bind(this,
+                selectModel,
+                rowData)}>{rowData.value}</List.Item>
           }
         }}
         style={{
@@ -352,6 +357,16 @@ class CurrencyDetail extends Component {
         // onScroll={() => {}}
         // scrollRenderAheadDistance={800}
       />
+      {billIsMultiDbfind(selectModel) && <Button
+        type={'primary'}
+        style={{
+          margin: '14px 24px',
+          height: '36px',
+          lineHeight: '36px',
+          fontSize: '16px',
+        }}
+        onClick={this.onDbfindSubmit.bind(this, selectModel)}>确定</Button>}
+
     </Modal>
   }
 
@@ -368,6 +383,26 @@ class CurrencyDetail extends Component {
     this.approvalTakeover(emcode, nodeId)
   }
 
+  /**
+   * 多选放大镜确认
+   */
+  onDbfindSubmit = (selectModel) => {
+    let selectMap = {}
+    mModalList.forEach(item => {
+      if (item.isSelected) {
+        const selectObj = item.obj
+        for (let key in selectObj) {
+          if (key in selectMap) {
+            selectMap[key] = selectMap[key] + '#' + selectObj[key]
+          } else {
+            selectMap[key] = selectObj[key]
+          }
+        }
+      }
+    })
+    this.dbfindRefresh(selectModel, selectMap)
+  }
+
   /**
    * 放大镜选项选中
    */
@@ -376,7 +411,7 @@ class CurrencyDetail extends Component {
     let groupIndex = selectModel.groupIndex
     let childIndex = selectModel.childIndex
     let selectData = rowData
-    if (selectModel.type === 'C') {
+    if (billIsCombo(selectModel)) {
       if (!isObjEmpty(billGroupList) &&
         !isObjNull(billGroupList[groupIndex])) {
         let billGroup = billGroupList[groupIndex]
@@ -390,33 +425,24 @@ class CurrencyDetail extends Component {
       })
     } else {
       let dataObj = selectData.obj
-      let isForm = selectModel.isForm
-      if (!isObjEmpty(billGroupList) &&
-        !isObjNull(billGroupList[groupIndex])) {
-        if (isForm == true) {
-          billGroupList.forEach((billGroup, index) => {
-            if (!isObjNull(billGroup) && billGroup.isForm) {
-              let showBillFields = billGroup.showBillFields
-              let hideBillFields = billGroup.hideBillFields
-              if (!isObjEmpty(showBillFields)) {
-                showBillFields.forEach((showModel, index) => {
-                  if (showModel.field in dataObj) {
-                    showModel.value = dataObj[showModel.field]
-                  }
-                })
-              }
-              if (!isObjEmpty(hideBillFields)) {
-                hideBillFields.forEach((showModel, index) => {
-                  if (showModel.field in dataObj) {
-                    showModel.value = dataObj[showModel.field]
-                  }
-                })
-              }
-            }
-          })
-        } else {
-          let billGroup = billGroupList[groupIndex]
-          if (!isObjNull(billGroup)) {
+      this.dbfindRefresh(selectModel, dataObj)
+    }
+  }
+
+  /**
+   * dbfind字段选中后刷新页面数据
+   * @param selectModel
+   * @param dataObj
+   */
+  dbfindRefresh (selectModel, dataObj) {
+    const { billGroupList } = this.state
+    let groupIndex = selectModel.groupIndex
+    let isForm = selectModel.isForm
+    if (!isObjEmpty(billGroupList) &&
+      !isObjNull(billGroupList[groupIndex])) {
+      if (isForm == true) {
+        billGroupList.forEach((billGroup, index) => {
+          if (!isObjNull(billGroup) && billGroup.isForm) {
             let showBillFields = billGroup.showBillFields
             let hideBillFields = billGroup.hideBillFields
             if (!isObjEmpty(showBillFields)) {
@@ -434,18 +460,37 @@ class CurrencyDetail extends Component {
               })
             }
           }
+        })
+      } else {
+        let billGroup = billGroupList[groupIndex]
+        if (!isObjNull(billGroup)) {
+          let showBillFields = billGroup.showBillFields
+          let hideBillFields = billGroup.hideBillFields
+          if (!isObjEmpty(showBillFields)) {
+            showBillFields.forEach((showModel, index) => {
+              if (showModel.field in dataObj) {
+                showModel.value = dataObj[showModel.field]
+              }
+            })
+          }
+          if (!isObjEmpty(hideBillFields)) {
+            hideBillFields.forEach((showModel, index) => {
+              if (showModel.field in dataObj) {
+                showModel.value = dataObj[showModel.field]
+              }
+            })
+          }
         }
       }
-      // console.log(billGroupList)
-      this.setState({
-        billGroupList,
-        modalOpen: false,
-        selectModel: {},
-      })
     }
+    this.setState({
+      billGroupList,
+      modalOpen: false,
+      selectModel: {},
+    })
   }
 
-  //接管单据
+//接管单据
   approvalTakeover = (emcode, nodeId) => {
     Toast.loading('正在指定审批人', 0)
     fetchPostForm(_baseURL + '/common/takeOverTask.action', {
@@ -614,15 +659,15 @@ class CurrencyDetail extends Component {
         })
         Toast.loading('数据请求中', 0)
         let type = billModel.type
-        if (type === 'C') {
+        if (billIsCombo(billModel)) {
           //单项选择
           this.getComboValue(billModel)
-        } else if (type === 'SF' || type === 'DF') {
+        } else if (billIsSingleDbfind(billModel)) {
           //DBFind选择
           this.getDbfindList(billModel, billGroup)
-        } else if (type === 'MF') {
+        } else if (billIsMultiDbfind(billModel)) {
           //多项选择
-
+          this.getDbfindList(billModel, billGroup)
         }
       }
     }
@@ -634,6 +679,7 @@ class CurrencyDetail extends Component {
    * @param billGroup
    */
   getDbfindList (billModel, billGroup) {
+    console.log(billModel)
     let fieldKey = billModel.field
     let isForm = billGroup.isForm
     let gridCaller = ''
@@ -704,15 +750,26 @@ class CurrencyDetail extends Component {
         }
         localData.value = this.getShowValue(showJson)
         localData.obj = jsonMap
+        localData.index = index
+        localData.isSelected = false
+        if (billIsMultiDbfind(billModel) && !isObjEmpty(billModel.value)) {
+          const billValue = billModel.value
+          let valueArray = billValue.split('#')
+          if (valueArray.indexOf(localData.name) > -1) {
+            localData.isSelected = true
+          }
+        }
         dbList.push(localData)
       })
       mModalList = dbList
       if (dbList.length === 0) {
         message.error('选项数据为空')
       } else {
+        mSearchList = mModalList
+        console.log(mSearchList)
         this.setState({
           modalDataSource: this.state.modalDataSource.cloneWithRows(
-            mModalList),
+            mSearchList),
           modalOpen: true,
         })
       }
@@ -763,15 +820,18 @@ class CurrencyDetail extends Component {
             comb.value = combObj.DISPLAY
             comb.display = combObj.DISPLAY
           }
+          comb.index = i
+          comb.isSelected = false
           combList.push(comb)
         }
         mModalList = combList
         if (combList.length === 0) {
           message.error('选项数据为空')
         } else {
+          mSearchList = mModalList
           this.setState({
             modalDataSource: this.state.modalDataSource.cloneWithRows(
-              mModalList),
+              mSearchList),
             modalOpen: true,
           })
         }
@@ -914,18 +974,21 @@ class CurrencyDetail extends Component {
         let candidates = assignObj ? (assignObj.JP_CANDIDATES || []) : []
         if (!isObjEmpty(nodeid) && !isObjEmpty(candidates)) {
           let candidateList = []
-          candidates.forEach(item => {
+          candidates.forEach((item, index) => {
             let candidate = item
             candidate.id = keyvalue
             candidate.formcode = formcode
             candidate.nodeId = nodeid
+            candidate.index = index
+            candidate.isSelected = false
 
             candidateList.push(candidate)
           })
           mModalList = candidateList
+          mSearchList = mModalList
           this.setState({
             modalDataSource: this.state.modalDataSource.cloneWithRows(
-              candidateList),
+              mSearchList),
             selectModel: {
               caption: '选择审批人',
               type: SELECT_APPROVAL,
@@ -963,14 +1026,14 @@ class CurrencyDetail extends Component {
         if (isObjNull(billModel)) {
           continue
         }
-        if (isObjEmpty(this.getValue(billModel)) &&
+        if (isObjEmpty(billGetValue(billModel)) &&
           billModel.isdefault && !billModel.allowBlank) {
           message.error(`${billModel.caption}为必填项`)
           return null
         }
         //Todo 附件上传
 
-        formStore[billModel.field] = this.getDisplay(billModel)
+        formStore[billModel.field] = billGetDisplay(billModel)
       }
       return formStore
     } else {
@@ -987,14 +1050,14 @@ class CurrencyDetail extends Component {
           let gridStore = {}
           for (let j = 0; j < gridFields.length; j++) {
             let billModel = gridFields[j]
-            if (isObjEmpty(this.getValue(billModel))
+            if (isObjEmpty(billGetValue(billModel))
               && billModel.isdefault && !billModel.allowBlank) {
               message.error(`${billModel.caption}为必填项`)
               return null
             }
             //Todo 附件上传
 
-            gridStore[billModel.field] = this.getDisplay(billModel)
+            gridStore[billModel.field] = billGetDisplay(billModel)
           }
           gridStoreList.push(gridStore)
         }
@@ -1126,7 +1189,7 @@ class CurrencyDetail extends Component {
             minDetno = billModel.detno
           }
           mapBillGroupModel.minDetno = minDetno
-          if (this.isShow(billModel)) {
+          if (billIsShow(billModel)) {
             mapBillGroupModel.addShow(billModel)
           } else {
             mapBillGroupModel.addHide(billModel)
@@ -1139,7 +1202,7 @@ class CurrencyDetail extends Component {
           modelMap[group] = mapBillGroupModel
 
           billModel.groupIndex = mapBillGroupModel.groupIndex
-          if (this.isShow(billModel)) {
+          if (billIsShow(billModel)) {
             mapBillGroupModel.addShow(billModel)
           } else {
             mapBillGroupModel.addHide(billModel)
@@ -1173,7 +1236,7 @@ class CurrencyDetail extends Component {
           let billModel = this.getBillModelByObject(formdetail[i])
           if (!isObjNull(billModel)) {
             billModel.groupIndex = index
-            if (this.isShow(billModel)) {
+            if (billIsShow(billModel)) {
               showBillFields.push(billModel)
             } else {
               hideBillFields.push(billModel)
@@ -1216,7 +1279,7 @@ class CurrencyDetail extends Component {
             }
 
             billModel.groupIndex = billGroupModel.groupIndex
-            if (this.isShow(billModel)) {
+            if (billIsShow(billModel)) {
               billGroupModel.addShow(billModel)
             } else {
               billGroupModel.addHide(billModel)
@@ -1232,7 +1295,7 @@ class CurrencyDetail extends Component {
             modelMap[`明细${group}`] = billGroupModel
 
             billModel.groupIndex = billGroupModel.groupIndex
-            if (this.isShow(billModel)) {
+            if (billIsShow(billModel)) {
               billGroupModel.addShow(billModel)
             } else {
               billGroupModel.addHide(billModel)
@@ -1281,6 +1344,23 @@ class CurrencyDetail extends Component {
       allowBlank = 'F'
     }
 
+    billModel.findFunctionName = findFunctionName
+    billModel.detno = fd_detno
+    billModel.caption = caption
+    billModel.id = id
+    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
+
     let display = ''
     let combostore = object.COMBOSTORE
     if (!isObjEmpty(combostore)) {
@@ -1294,7 +1374,7 @@ class CurrencyDetail extends Component {
         localData.display = dlc_display
         localData.value = dlc_value
 
-        if (type === 'C'
+        if (billIsCombo(billModel)
           && !isObjEmpty(value)
           && (value == dlc_display || value == dlc_value)) {
           value = dlc_value
@@ -1305,24 +1385,8 @@ class CurrencyDetail extends Component {
       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
   }
@@ -1403,10 +1467,6 @@ class CurrencyDetail extends Component {
     }
   }
 
-  isShow = (billModel) => (
-    billModel.isdefault && billModel.type !== 'H'
-  )
-
   getAddModel = index => {
     let addBillModel = new BillModel()
     addBillModel.groupIndex = index
@@ -1414,38 +1474,6 @@ class CurrencyDetail extends Component {
     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
-    }
-  }
-
-  getValue = (billModel) => (
-    billModel.value || billModel.defValue || ''
-  )
-
-  getDisplay = (billModel) => {
-    return billModel.display || this.getValue(billModel)
-  }
 }
 
 let mapStateToProps = (state) => ({

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

@@ -317,7 +317,7 @@ class CurrencyList extends Component {
         })
       } else {
         pageIndex--
-        Toast.show('数据为空', 2)
+        Toast.show('数据为空', 2, false)
         this.setState({
           hasNextPage: false,
         })

+ 31 - 62
uas-office-web/uas-mobile/src/components/common/formNew/FormInput.jsx

@@ -15,7 +15,10 @@ import {
 } from 'antd-mobile'
 import { isObjEmpty, isObjNull } from '../../../utils/common/common.util'
 import moment from 'moment'
-import BillModel from '../../../model/common/BillModel'
+import BillModel, {
+  billGetValue, billIsDate, billIsHtml, billIsMultiLine, billIsNum,
+  billIsSelect,
+} from '../../../model/common/BillModel'
 
 export default class FormInput extends Component {
 
@@ -50,32 +53,24 @@ export default class FormInput extends Component {
     let valueItem
 
     let type = billModel.type
-    switch (type) {
-      case 'N':
-        valueItem =
-          this.getNumCom(billModel)
-        break
-      case 'DT':
-      case 'D':
-      case 'T':
-        valueItem =
-          this.getDateCom(type, billModel)
-        break
-      case 'HTML':
-      case 'HOS':
-        valueItem =
-          this.getHtmlcom(billModel)
-        break
-      default:
-        valueItem =
-          this.getTextCom(billModel)
-        break
+    if (billIsNum(billModel)) {
+      valueItem =
+        this.getNumCom(billModel)
+    } else if (billIsDate(billModel)) {
+      valueItem =
+        this.getDateCom(type, billModel)
+    } else if (billIsHtml(billModel)) {
+      valueItem =
+        this.getHtmlcom(billModel)
+    } else {
+      valueItem =
+        this.getTextCom(billModel)
     }
     return (
-      (type === 'DT' || type === 'D' || type === 'T') ? <div>
+      billIsDate(billModel) ? <div>
           {valueItem}
         </div> :
-        (type === 'MS') ? (this.renderTwoLines(
+        billIsMultiLine(billModel) ? (this.renderTwoLines(
           billModel,
           valueItem)) :
           (this.renderNormal(billModel, valueItem, modalOpen, modalList))
@@ -99,7 +94,7 @@ export default class FormInput extends Component {
         : 'visibleHidden'}>*
       </div>
       {valueItem}
-      {this.isSelect(billModel) &&
+      {billIsSelect(billModel) &&
       <Modal visible={modalOpen}
              animationType={'slide-up'}
              onClose={() => {
@@ -158,24 +153,24 @@ export default class FormInput extends Component {
       placeholder={(billModel.readOnly ||
         billModel.editable === 'F')
         ? ''
-        : (this.isSelect(billModel)
+        : (billIsSelect(billModel)
           ? '请选择'
           : '请输入')}
       clear={true}
       editable={(billModel.readOnly ||
         billModel.editable === 'F')
         ? false
-        : (this.isSelect(billModel)
+        : (billIsSelect(billModel)
           ? false
           : true)}
       disabled={false}
       // extra={(billModel.readOnly &&
-      //   billModel.editable === 'F' && this.isSelect(billModel))
+      //   billModel.editable === 'F' && billIsSelect(billModel))
       //   ? '>'
       //   : ''}
       onChange={this.onTextChange}
       onClick={this.onInputClick}
-      value={this.getValue(billModel)}
+      value={billGetValue(billModel)}
     />
   }
 
@@ -188,7 +183,7 @@ export default class FormInput extends Component {
     return <div className='form-input-value'
                 style={{ minHeight: '32px' }}
                 dangerouslySetInnerHTML={{
-                  __html: this.getValue(billModel),
+                  __html: billGetValue(billModel),
                 }}></div>
   }
 
@@ -210,8 +205,8 @@ export default class FormInput extends Component {
         billModel.editable === 'F') ? ' ' : type === 'DT' ? '选择时间' : '选择日期'}
       disabled={(billModel.readOnly ||
         billModel.editable === 'F') ? true : false}
-      value={!isObjEmpty(this.getValue(billModel))
-        ? new Date(this.getValue(billModel).replace(/\-/g, '/'))
+      value={!isObjEmpty(billGetValue(billModel))
+        ? new Date(billGetValue(billModel).replace(/\-/g, '/'))
         : ''}
       onChange={this.onDateChange}
     >
@@ -235,22 +230,22 @@ export default class FormInput extends Component {
                       placeholder={(billModel.readOnly ||
                         billModel.editable === 'F')
                         ? ''
-                        : (this.isSelect(billModel)
+                        : (billIsSelect(billModel)
                           ? '请选择'
                           : '请输入')}
                       editable={(billModel.readOnly ||
-                        billModel.editable === 'F') ? false : (this.isSelect(
+                        billModel.editable === 'F') ? false : (billIsSelect(
                         billModel)
                         ? false
                         : true)}
       // extra={(billModel.readOnly  &&
-      //   billModel.editable === 'F' && this.isSelect(billModel))
+      //   billModel.editable === 'F' && billIsSelect(billModel))
       //   ? '>'
       //   : ''}
                       onChange={this.onTextChange}
                       onClick={this.onInputClick}
                       type={'digit'}
-                      value={this.getValue(billModel)}
+                      value={billGetValue(billModel)}
     />
   }
 
@@ -268,7 +263,7 @@ export default class FormInput extends Component {
 
   onInputClick = e => {
     const { billModel } = this.state
-    if (this.isSelect(billModel) && !billModel.readOnly) {
+    if (billIsSelect(billModel) && !billModel.readOnly) {
       if (!isObjEmpty(billModel.localDatas)) {
         this.setState({
           modalList: billModel.localDatas,
@@ -310,32 +305,6 @@ export default class FormInput extends Component {
         dateValue)
     })
   }
-
-  isSelect = (billModel) => {
-    if (!isObjEmpty(billModel.localDatas)) {
-      return true
-    }
-    let dfType = billModel.type
-    if (isObjEmpty(dfType)) {
-      return false
-    }
-    switch (dfType) {
-      case 'C':
-      case 'D':
-      case 'DT':
-      case 'MF':
-      case 'SF':
-      case 'DF':
-        // return false
-        return true
-    }
-    return false
-  }
-
-  getValue = (billModel) => {
-    const value = billModel.value || billModel.defValue || ''
-    return value.toString()
-  }
 }
 
 const DatePickerCustom = ({ extra, onClick, children }) => (

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

@@ -2,7 +2,7 @@
   width: 100%;
   display: flex;
   flex-direction: row;
-  padding: 5px 0px 5px 8px;
+  padding: 5px 5px 5px 8px;
   //padding: 6px;
   background: white;
   border-bottom: 1px solid #eeeeee;
@@ -123,6 +123,7 @@
   font-size: 14px;
   color: red;
   padding-left: 10px;
+  padding-right: 4px;
 }
 
 .form-input-caption {

+ 4 - 0
uas-office-web/uas-mobile/src/configs/antd.config.less

@@ -42,6 +42,10 @@
   margin-top: 2px !important;
 }
 
+.am-list-item .am-list-line .am-list-content {
+  white-space: normal !important;
+}
+
 /********************Button按钮的样式***********************/
 .am-button {
   height: @com-button-height !important;

+ 204 - 10
uas-office-web/uas-mobile/src/model/common/BillModel.js

@@ -54,10 +54,7 @@ export default function BillModel (billModel) {
     this.updatable = billModel.updatable
     this.editable = ''//复制字段时要重置
 
-    this.isShow = billModel => (
-      billModel.isdefault && billModel.type !== 'H'
-    )
-    if (this.isShow(billModel) == false
+    if (billIsShow(billModel) == false
       && !isObjEmpty(billModel.renderer)
       && billModel.renderer.indexOf('defaultValue') != -1) {
       //隐藏字段,renderer里包含defaultValue,则复制value
@@ -68,14 +65,211 @@ export default function BillModel (billModel) {
       this.display = ''
     }
   }
+}
+
+/**
+ * 返回字段显示值
+ * @param billModel
+ * @returns {string}
+ */
+export function billGetValue (billModel) {
+  const value = billModel.value || billModel.defValue || ''
+  return value.toString()
+}
 
-  /*this.getValue = () => (
-    this.value || this.defValue || ''
-  )
+/**
+ * 返回字段真实值
+ * @param billModel
+ * @returns {*|string}
+ */
+export function billGetDisplay (billModel) {
+  return billModel.display || billGetValue(billModel)
+}
+
+/**
+ * 字段是否显示
+ * @param billModel
+ * @returns {boolean|*}
+ */
+export function billIsShow (billModel) {
+  return billModel.isdefault && billModel.type !== 'H'
+}
+
+/**
+ * 是否是选择类型
+ * @param billModel
+ * @returns {boolean}
+ */
+export function billIsSelect (billModel) {
+  if (!isObjEmpty(billModel.localDatas)) {
+    return true
+  }
+  let dfType = billModel.type
+  if (isObjEmpty(dfType)) {
+    return false
+  }
+  switch (dfType) {
+    case 'C':
+    case 'D':
+    case 'DT':
+    case 'MF':
+    case 'SF':
+    case 'DF':
+      return true
+  }
+  return false
+}
 
-  this.getDisplay = () => (
-    this.display || this.getValue()
-  )*/
+/**
+ * 是否是单选本地数据选择
+ * @param billModel
+ * @returns {boolean}
+ */
+export function billIsCombo (billModel) {
+  let dfType = billModel.type
+  if (isObjEmpty(dfType)) {
+    return false
+  }
+  switch (dfType) {
+    case 'C':
+      return true
+  }
+  return false
+}
+
+/**
+ * 是否是单选放大镜
+ * @param billModel
+ * @returns {boolean}
+ */
+export function billIsSingleDbfind (billModel) {
+  let dfType = billModel.type
+  if (isObjEmpty(dfType)) {
+    return false
+  }
+  switch (dfType) {
+    case 'SF':
+    case 'DF':
+      return true
+  }
+  return false
+}
+
+/**
+ * 是否是多选放大镜
+ * @param billModel
+ * @returns {boolean}
+ */
+export function billIsMultiDbfind (billModel) {
+  let dfType = billModel.type
+  if (isObjEmpty(dfType)) {
+    return false
+  }
+  switch (dfType) {
+    case 'MF':
+      return true
+  }
+  return false
+}
+
+/**
+ * 字段是否是日期类型
+ * @param billModel
+ * @returns {boolean}
+ */
+export function billIsDate (billModel) {
+  let dfType = billModel.type
+  if (isObjEmpty(dfType)) {
+    return false
+  }
+  switch (dfType) {
+    case 'DT':
+    case 'D':
+    case 'T':
+      return true
+  }
+  return false
+}
+
+/**
+ * 字段是否是数字类型
+ * @param billModel
+ * @returns {boolean}
+ */
+export function billIsNum (billModel) {
+  let dfType = billModel.type
+  if (isObjEmpty(dfType)) {
+    return false
+  }
+  switch (dfType) {
+    case 'N':
+      return true
+  }
+  return false
+}
+
+/**
+ * 字段是否是html类型
+ * @param billModel
+ * @returns {boolean}
+ */
+export function billIsHtml (billModel) {
+  let dfType = billModel.type
+  if (isObjEmpty(dfType)) {
+    return false
+  }
+  switch (dfType) {
+    case 'HTML':
+    case 'HOS':
+      return true
+  }
+  return false
+}
+
+/**
+ * 字段是否是多行字符串类型
+ * @param billModel
+ * @returns {boolean}
+ */
+export function billIsMultiLine (billModel) {
+  let dfType = billModel.type
+  if (isObjEmpty(dfType)) {
+    return false
+  }
+  switch (dfType) {
+    case 'MS':
+      return true
+  }
+  return false
+}
+
+/**
+ * 返回字段布局类型
+ * @param dfType
+ * @returns {number}
+ */
+export function 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
+  }
 }
 
 export const TYPE_TITLE = 'LOCAL_TITLE'

+ 8 - 12
uas-office-web/uas-mobile/src/utils/common/form.request.js

@@ -4,7 +4,10 @@
  */
 import { isObjEmpty, isObjNull } from './common.util'
 import BillGroupModel from '../../model/common/BillGroupModel'
-import BillModel from '../../model/common/BillModel'
+import BillModel, {
+  billGetDisplay,
+  billGetValue,
+} from '../../model/common/BillModel'
 import { message } from 'antd'
 
 export function analysisFormData (formData, isDetail) {
@@ -184,13 +187,13 @@ function analysisForm (formFields) {
       if (isObjNull(billModel)) {
         continue
       }
-      if (isObjEmpty(getValue(billModel)) && !billModel.allowBlank) {
+      if (isObjEmpty(billGetValue(billModel)) && !billModel.allowBlank) {
         message.error(`${billModel.caption}为必填项`)
         return null
       }
       //Todo 附件上传
 
-      formStore[billModel.field] = getDisplay(billModel)
+      formStore[billModel.field] = billGetDisplay(billModel)
     }
     return formStore
   } else {
@@ -207,13 +210,13 @@ function analysisGrid (gridBillMap) {
         let gridStore = {}
         for (let j = 0; j < gridFields.length; j++) {
           let billModel = gridFields[j]
-          if (isObjEmpty(getValue(billModel)) && !billModel.allowBlank) {
+          if (isObjEmpty(billGetValue(billModel)) && !billModel.allowBlank) {
             message.error(`${billModel.caption}为必填项`)
             return null
           }
           //Todo 附件上传
 
-          gridStore[billModel.field] = getDisplay(billModel)
+          gridStore[billModel.field] = billGetDisplay(billModel)
         }
         gridStoreList.push(gridStore)
       }
@@ -222,11 +225,4 @@ function analysisGrid (gridBillMap) {
   return gridStoreList
 }
 
-function getValue (billModel) {
-  return billModel.value || billModel.defValue || ''
-}
-
-function getDisplay (billModel) {
-  return billModel.display || getValue(billModel)
-}
 

+ 0 - 287
uas-office-web/uas-mobile/src/utils/common/form.util.js

@@ -1,287 +0,0 @@
-import React from 'react'
-import {
-  isObjEmpty,
-  isObjNull,
-} from './common.util'
-import FormInput from '../../components/common/formNew/FormInput'
-import FormAdd from '../../components/common/formNew/FormAdd'
-import { message } from 'antd'
-import BillModel, {
-  TYPE_ADD,
-  TYPE_TAB,
-  TYPE_TITLE,
-} from '../../model/common/BillModel'
-import FormTitle from '../../components/common/formNew/FormTitle'
-import BillGroupModel from '../../model/common/BillGroupModel'
-import { _baseURL } from '../../configs/api.config'
-import { Modal, Toast } from 'antd-mobile'
-import { refreshFormState } from '../../redux/actions/formState'
-import store from '../../redux/store/store'
-import { BILL_STATE, FILTER_STATE } from '../../redux/constants/actionTypes'
-
-/**
- * Created by RaoMeng on 2020/11/6
- * Desc: 通用表单生成组件工具类
- */
-const alert = Modal.alert
-
-/**
- * 通过json数据获取表单组件列表
- * @param billGroupModelList
- * @returns {[]}
- */
-export function getFormItems (billGroupModelList) {
-  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) {
-          //添加组标题
-          gridStartIndex = addGroupTitle(billGroupModelList,
-            g, billGroup, gridStartIndex, formItems)
-          //添加显示字段
-          for (let i = 0; i < showBillFields.length; i++) {
-            let billModel = showBillFields[i]
-            if (!isObjNull(billModel)) {
-              let itemViewType = getItemViewType(billModel.type)
-              if (billModel.renderer == 'detailAttach') {
-                itemViewType = 2
-              }
-              switch (itemViewType) {
-                case 1:
-                  formItems.push(
-                    <FormInput billModel={billModel} groupIndex={g}
-                               childIndex={i}
-                               baseUrl={_baseURL}
-                               key={g + 'formInput' + i}
-                               onTextChange={onTextChange.bind(this,
-                                 billGroupModelList)}
-                    />,
-                  )
-                  break
-                case 2:
-                  //附件
-                  /*formItems.push(
-                    <FormEnclosure billModel={billModel} groupIndex={g}
-                                   baseUrl={_baseURL}
-                                   childIndex={i}/>,
-                  )*/
-                  break
-                default:
-                  break
-              }
-            }
-          }
-          /*if (billGroup.isForm == false && billGroup.lastInType == true) {
-            //如果是最后一个从表,则添加【新增】按钮
-            formItems.push(
-              <FormAdd billModel={getAddModel(g)}
-                       groupIndex={g}
-                       onAddClick={onAddClick.bind(this, billGroupModelList)}
-                       key={'formAdd' + g}
-              />,
-            )
-          }*/
-        }
-      }
-    }
-  }
-  return formItems
-}
-
-/**
- * 添加明细组
- * @param groupIndex
- */
-function onAddClick (billGroupModelList, groupIndex) {
-  billGroupModelList[groupIndex].lastInType = false
-
-  let newBillGroup = newGridBillGroup(groupIndex,
-    billGroupModelList[groupIndex])
-  billGroupModelList.push(newBillGroup)
-  //刷新缓存数据
-  refreshFromData(billGroupModelList)
-}
-
-function newGridBillGroup (groupIndex, oldBillGroup) {
-  let oldGridIndex = oldBillGroup.gridIndex
-  let isForm = oldBillGroup.isForm
-
-  let newBillGroup = new BillGroupModel()
-  newBillGroup.isForm = isForm
-  if (isForm == true) {
-    newBillGroup.group = oldBillGroup.group
-  } else {
-    newBillGroup.group = `明细${oldGridIndex + 1}`
-  }
-  newBillGroup.billCaller = oldBillGroup.billCaller
-  newBillGroup.gridIndex = oldGridIndex + 1
-  newBillGroup.isDeleteAble = true
-  newBillGroup.lastInType = true
-  newBillGroup.groupIndex = groupIndex + 1
-
-  let showBillFields = oldBillGroup.showBillFields
-  let hideBillFields = oldBillGroup.hideBillFields
-
-  if (!isObjEmpty(showBillFields)) {
-    for (let i = 0; i < showBillFields.length; i++) {
-      let billModel = showBillFields[i]
-      newBillGroup.addShow(new BillModel(billModel))
-    }
-  }
-  if (!isObjEmpty(hideBillFields)) {
-    for (let i = 0; i < hideBillFields.length; i++) {
-      let billModel = hideBillFields[i]
-      newBillGroup.addHide(new BillModel(billModel))
-    }
-  }
-  return newBillGroup
-}
-
-function getAddModel (index) {
-  let addBillModel = new BillModel()
-  addBillModel.groupIndex = index
-  addBillModel.type = TYPE_ADD
-  addBillModel.caption = '添加单据'
-  return addBillModel
-}
-
-function 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
-  }
-}
-
-/**
- * 添加分组头部
- * @param g
- * @param billGroup
- * @param gridStartIndex
- * @param formItems
- */
-function addGroupTitle (
-  billGroupModelList, 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 = false
-
-  } else {
-    if (gridStartIndex === -1) {
-      gridStartIndex = g
-    }
-    titleBillModel.caption = `明细${g - gridStartIndex + 1}`
-    titleBillModel.allowBlank = billGroup.isDeleteAble
-  }
-  if (!isObjEmpty(titleBillModel.caption)) {
-    formItems.push(
-      <FormTitle
-        billModel={titleBillModel}
-        groupIndex={g}
-        onDeleteClick={onDeleteClick.bind(this, billGroupModelList)}
-        key={'formTitle' + g}
-      />,
-    )
-  }
-  return gridStartIndex
-}
-
-function onDeleteClick (billGroupModelList, groupIndex) {
-  // this.deleteAlert =
-  alert('提示', '确认删除该明细?', [
-    {
-      text: '取消',
-      onPress: () => {},
-      style: 'default',
-    },
-    {
-      text: '确定', onPress: () => {
-        deleteGroup(billGroupModelList, groupIndex)
-      },
-    },
-  ])
-}
-
-/**
- * 删除分组
- * @param groupIndex
- */
-function deleteGroup (billGroupModelList, groupIndex) {
-  let deleteGroup = billGroupModelList[groupIndex]
-  let isLastGroup = deleteGroup.lastInType
-  if (isLastGroup == true && groupIndex - 1 >= 0) {
-    let billGroup = billGroupModelList[groupIndex - 1]
-    if (deleteGroup.isForm == false && (billGroup.isForm == true)) {
-      //明细删除光了,要默认添加一个空明细表
-      deleteGroup.groupIndex = groupIndex - 1
-      deleteGroup.gridIndex = 0
-      let newGridGroup = newGridBillGroup(groupIndex - 1, deleteGroup)
-      newGridGroup.isDeleteAble = false
-      billGroupModelList.splice(groupIndex, 1)
-      billGroupModelList.push(newGridGroup)
-    } else {
-      billGroup.lastInType = true
-      billGroupModelList.splice(groupIndex, 1)
-    }
-  } else {
-    billGroupModelList.splice(groupIndex, 1)
-  }
-
-  //刷新缓存数据
-  refreshFromData(billGroupModelList)
-}
-
-function onTextChange (
-  billGroupModelList, groupIndex, childIndex, value, display) {
-  if (!isObjNull(billGroupModelList) &&
-    !isObjNull(billGroupModelList[groupIndex])) {
-    let billGroup = billGroupModelList[groupIndex]
-    if (!isObjNull(billGroup.showBillFields) &&
-      !isObjNull(billGroup.showBillFields[childIndex])) {
-      billGroup.showBillFields[childIndex].value = value
-      if (!isObjNull(display)) {
-        billGroup.showBillFields[childIndex].display = display
-      }
-    }
-  }
-}
-
-function refreshFromData (billGroupModelList) {
-  const stateType = store.getState().formState.stateType
-  if (stateType === FILTER_STATE) {
-    refreshFormState({
-      filterGroupList: billGroupModelList,
-    })
-  } else if (stateType === BILL_STATE) {
-    refreshFormState({
-      billGroupList: billGroupModelList,
-    })
-  }
-}
-
-