Browse Source

放大镜类型初步实现

RaoMeng 6 years ago
parent
commit
520c7ab235

+ 252 - 249
uas-office-web/wxuasapproval/src/components/approvalAdd/FormInput.jsx

@@ -1,249 +1,252 @@
-/**
- * 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, Modal } from 'antd-mobile'
-import { isObjEmpty } from '../../utils/common'
-import moment from 'moment'
-
-export default class FormInput extends Component {
-
-  constructor () {
-    super()
-
-    this.state = {
-      billModel: new BillModel(),
-      modalOpen: false,
-      modalList: [],
-    }
-  }
-
-  componentDidMount () {
-    let { billModel } = this.props
-
-    this.setState({
-      billModel: billModel,
-      modalVisible: false,
-    })
-  }
-
-  componentWillReceiveProps () {
-    this.componentDidMount()
-  }
-
-  componentWillUnmount () {
-
-  }
-
-  render () {
-    const { billModel, modalOpen, modalList } = this.state
-    let valueItem
-
-    let type = billModel.type
-    if (type === 'N') {
-      valueItem =
-        <InputItem className='form-input-value' clear
-                   placeholder={this.isSelect(billModel)
-                     ? '请选择'
-                     : ((billModel.readOnly === 'T' ||
-                       billModel.editable === 'F')
-                       ? ''
-                       : '请输入')}
-                   editable={(billModel.readOnly === 'T' ||
-                     billModel.editable === 'F') ? false : (this.isSelect(
-                     billModel)
-                     ? false
-                     : true)}
-          // extra={(billModel.readOnly === 'T' &&
-          //   billModel.editable === 'F' && this.isSelect(billModel))
-          //   ? '>'
-          //   : ''}
-                   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(billModel)
-                                  ? '请选择'
-                                  : ((billModel.readOnly === 'T' ||
-                                    billModel.editable === 'F')
-                                    ? ''
-                                    : '请输入')}
-                                clear={true}
-                                editable={(billModel.readOnly === 'T' ||
-                                  billModel.editable === 'F')
-                                  ? false
-                                  : (this.isSelect(billModel)
-                                    ? false
-                                    : true)}
-                                disabled={false}
-        // extra={(billModel.readOnly === 'T' &&
-        //   billModel.editable === 'F' && this.isSelect(billModel))
-        //   ? '>'
-        //   : ''}
-                                onChange={this.onTextChange}
-                                onClick={this.onInputClick}
-                                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}
-        {this.isSelect(billModel) &&
-        <Modal visible={modalOpen}
-               animationType={'slide-up'}
-               onClose={() => {
-                 this.setState({
-                   modalOpen: false,
-                 })
-               }}
-               title={billModel.caption}
-               popup
-        >
-          <List className='form-common-modal-root'>
-            {modalList && (
-              modalList.map((modalObj, index) => (
-                <List.Item key={index}
-                           onClick={this.onModalSelect.bind(this,
-                             index)}>{modalObj.value}</List.Item>
-              ))
-            )}
-          </List>
-        </Modal>}
-      </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 => {
-    // if (this.props.onInputClick) {
-    //   this.props.onInputClick(this.props.groupIndex, this.props.childIndex)
-    // }
-    const { billModel } = this.state
-    if (!isObjEmpty(billModel.localDatas)) {
-      console.log('modaldata', billModel.localDatas)
-      this.setState({
-        modalList: billModel.localDatas,
-        modalOpen: true,
-      })
-    }
-  }
-
-  onModalSelect = index => {
-    const { modalList } = this.state
-    if (!isObjEmpty(modalList) && modalList[index] && this.props.onTextChange) {
-      this.props.onTextChange(this.props.groupIndex, this.props.childIndex,
-        modalList[index].value, modalList[index].display)
-    }
-    this.setState({
-      modalList: [],
-      modalOpen: false,
-    })
-  }
-
-  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 = (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
-  }
-}
-
-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>
-)
+/**
+ * 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, Modal } from 'antd-mobile'
+import { isObjEmpty } from '../../utils/common'
+import moment from 'moment'
+import { fetchPost } from '../../utils/fetchRequest'
+
+export default class FormInput extends Component {
+
+  constructor () {
+    super()
+
+    this.state = {
+      billModel: new BillModel(),
+      modalOpen: false,
+      modalList: [],
+    }
+  }
+
+  componentDidMount () {
+    let { billModel } = this.props
+
+    this.setState({
+      billModel: billModel,
+    })
+  }
+
+  componentWillReceiveProps () {
+    this.componentDidMount()
+  }
+
+  componentWillUnmount () {
+
+  }
+
+  render () {
+    const { billModel, modalOpen, modalList } = this.state
+    let valueItem
+
+    let type = billModel.type
+    if (type === 'N') {
+      valueItem =
+        <InputItem className='form-input-value' clear
+                   placeholder={this.isSelect(billModel)
+                     ? '请选择'
+                     : ((billModel.readOnly === 'T' ||
+                       billModel.editable === 'F')
+                       ? ''
+                       : '请输入')}
+                   editable={(billModel.readOnly === 'T' ||
+                     billModel.editable === 'F') ? false : (this.isSelect(
+                     billModel)
+                     ? false
+                     : true)}
+          // extra={(billModel.readOnly === 'T' &&
+          //   billModel.editable === 'F' && this.isSelect(billModel))
+          //   ? '>'
+          //   : ''}
+                   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(billModel)
+                                  ? '请选择'
+                                  : ((billModel.readOnly === 'T' ||
+                                    billModel.editable === 'F')
+                                    ? ''
+                                    : '请输入')}
+                                clear={true}
+                                editable={(billModel.readOnly === 'T' ||
+                                  billModel.editable === 'F')
+                                  ? false
+                                  : (this.isSelect(billModel)
+                                    ? false
+                                    : true)}
+                                disabled={false}
+        // extra={(billModel.readOnly === 'T' &&
+        //   billModel.editable === 'F' && this.isSelect(billModel))
+        //   ? '>'
+        //   : ''}
+                                onChange={this.onTextChange}
+                                onClick={this.onInputClick}
+                                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}
+        {this.isSelect(billModel) &&
+        <Modal visible={modalOpen}
+               animationType={'slide-up'}
+               onClose={() => {
+                 this.setState({
+                   modalOpen: false,
+                 })
+               }}
+               title={billModel.caption}
+               popup
+        >
+          <List className='form-common-modal-root'>
+            {modalList && (
+              modalList.map((modalObj, index) => (
+                <List.Item key={index}
+                           onClick={this.onModalSelect.bind(this,
+                             index)}>{modalObj.value}</List.Item>
+              ))
+            )}
+          </List>
+        </Modal>}
+      </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 => {
+    const { billModel } = this.state
+    if(this.isSelect(billModel)){
+      if (!isObjEmpty(billModel.localDatas)) {
+        console.log('modaldata', billModel.localDatas)
+        this.setState({
+          modalList: billModel.localDatas,
+          modalOpen: true,
+        })
+      } else {
+        if (this.props.onInputClick) {
+          this.props.onInputClick(this.props.groupIndex, this.props.childIndex)
+        }
+      }
+    }
+  }
+
+  onModalSelect = index => {
+    const { modalList } = this.state
+    if (!isObjEmpty(modalList) && modalList[index] && this.props.onTextChange) {
+      this.props.onTextChange(this.props.groupIndex, this.props.childIndex,
+        modalList[index].value, modalList[index].display)
+    }
+    this.setState({
+      modalList: [],
+      modalOpen: false,
+    })
+  }
+
+  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 = (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
+  }
+}
+
+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>
+)

+ 4 - 3
uas-office-web/wxuasapproval/src/components/approvalAdd/formCommon.css

@@ -46,7 +46,7 @@
 
 .form-common-layout .am-list-line {
     padding-right: 8px;
-    border-bottom: none;
+    border-bottom: none !important;
 }
 
 .form-common-layout .am-list .am-list-item.am-textarea-item {
@@ -88,6 +88,7 @@
     font-size: 14px;
     color: red;
     padding: 4px;
+    font-weight: bold;
 }
 
 .form-input-value {
@@ -109,7 +110,7 @@
 }
 
 .form-common-modal-root {
-    min-height: 300px;
-    max-height: 70vh;
+    min-height: 280px;
+    max-height: 76vh;
     overflow: auto;
 }

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

@@ -1,4 +1,8 @@
-export default function LocalData () {
-  this.value = ''//显示的值  ||附件时候表示 路径,文件名
-  this.display = ''//上传的值 ||附件时候表示上传的附件id
-}
+export default function LocalData () {
+  this.value = ''//显示的值  ||附件时候表示 路径,文件名
+  this.display = ''//上传的值 ||附件时候表示上传的附件id
+
+  this.name = ''
+  this.obj = {}//选项对象
+  this.isSelected = false//是否被选中,用于多选
+}

+ 290 - 7
uas-office-web/wxuasapproval/src/pages/approval/ApprovalAdd.jsx

@@ -6,7 +6,7 @@
 import React, { Component } from 'react'
 import { isObjEmpty, isObjNull } from '../../utils/common'
 import { message } from 'antd'
-import { Toast, List, Button, Modal } from 'antd-mobile'
+import { Toast, List, Button, Modal, Checkbox } from 'antd-mobile'
 import { fetchGet, fetchPost } from '../../utils/fetchRequest'
 import BillModel, {
   TYPE_ADD,
@@ -21,6 +21,7 @@ import FormAdd from '../../components/approvalAdd/FormAdd'
 import FormImage from '../../components/approvalAdd/FormImage'
 
 const alert = Modal.alert
+const CheckboxItem = Checkbox.CheckboxItem
 
 let mCaller//当前单据的Caller
 let mId//当前单据拥有的id,新增默认为0  如果mid为-1,说明保存时候使用更新的接口
@@ -35,8 +36,9 @@ let mDefaultMap
 let mShowBillModels, mFormBillModels, mUpdateBillModels, mAllBillModels
 
 let mBaseUrl = window.location.origin
-  + (process.env.REACT_APP_ROUTER_BASE_NAME || '/ERP')
+  // + (process.env.REACT_APP_ROUTER_BASE_NAME || '/ERP')
   // && 'http://erp.yitoa.com:8888/ERP'
+  && 'http://29226oq576.qicp.vip/erp'
 
 export default class ApprovalAdd extends Component {
 
@@ -45,6 +47,9 @@ export default class ApprovalAdd extends Component {
 
     this.state = {
       billGroupModelList: [],
+      modalOpen: false,
+      modalList: [],
+      selectModel: {},
     }
   }
 
@@ -70,7 +75,8 @@ export default class ApprovalAdd extends Component {
   }
 
   render () {
-    const { billGroupModelList } = this.state
+    const { billGroupModelList, modalOpen, modalList, selectModel } = this.state
+    let selectType = selectModel.type
     let formItems = []
     if (!isObjEmpty(billGroupModelList)) {
       //从表的起始Groupindex
@@ -149,10 +155,121 @@ export default class ApprovalAdd extends Component {
                   fontSize: '16px',
                 }}
                 onClick={this.onSubmitClick}>提交</Button>}
+
+        <Modal visible={modalOpen}
+               animationType={'slide-up'}
+               onClose={() => {
+                 this.setState({
+                   modalOpen: false,
+                 })
+               }}
+               title={selectModel.caption}
+               popup
+        >
+          <List className='form-common-modal-root'>
+            {modalList && (
+              modalList.map((modalObj, index) => (
+                (selectType === 'MF')
+                  ? (<CheckboxItem key={index}
+                                   checked={modalObj.isSelected == true}
+                                   onChange={e => {
+                                     let checked = e.target.checked
+                                     modalList[index].isSelected = checked
+                                     this.setState({
+                                       modalList,
+                                     })
+                                   }}>{modalObj.value}</CheckboxItem>)
+                  : (<List.Item key={index}
+                                wrap
+                                onClick={this.onDbfindSelect.bind(this,
+                                  selectModel,
+                                  index)}>{modalObj.value}</List.Item>)
+
+              ))
+            )}
+          </List>
+        </Modal>
       </div>
     )
   }
 
+  /**
+   * 放大镜选项选中
+   */
+  onDbfindSelect = (selectModel, index) => {
+    const { billGroupModelList, modalList } = this.state
+    let groupIndex = selectModel.groupIndex
+    let childIndex = selectModel.childIndex
+    let selectData = modalList[index]
+    if (selectModel.type === 'C') {
+      if (!isObjEmpty(billGroupModelList) &&
+        !isObjNull(billGroupModelList[groupIndex])) {
+        let billGroup = billGroupModelList[groupIndex]
+        billGroup[childIndex].value = selectData.value
+        billGroup[childIndex].display = selectData.display
+      }
+      this.setState({
+        billGroupModelList,
+        modalOpen: false,
+        selectModel: {},
+      })
+    } else {
+      let dataObj = selectData.obj
+      let isForm = selectModel.isForm
+      if (!isObjEmpty(billGroupModelList) &&
+        !isObjNull(billGroupModelList[groupIndex])) {
+        if (isForm == true) {
+          billGroupModelList.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 = billGroupModelList[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(billGroupModelList)
+      this.setState({
+        billGroupModelList,
+        modalOpen: false,
+        selectModel: {},
+      })
+    }
+  }
+
   /**
    * 添加明细组
    * @param groupIndex
@@ -287,17 +404,183 @@ export default class ApprovalAdd extends Component {
   }
 
   onInputClick = (groupIndex, childIndex) => {
-    /*const { billGroupModelList } = this.state
+    const { billGroupModelList } = this.state
     if (!isObjNull(billGroupModelList) &&
       !isObjNull(billGroupModelList[groupIndex])) {
       let billGroup = billGroupModelList[groupIndex]
       if (!isObjNull(billGroup.showBillFields) &&
         !isObjNull(billGroup.showBillFields[childIndex])) {
         let billModel = billGroup.showBillFields[childIndex]
-        let localDatas = billModel.localDatas
+        if (isObjNull(billModel)) {
+          return
+        }
+        billModel.childIndex = childIndex
+        this.setState({
+          selectModel: billModel,
+        })
+        Toast.loading('数据请求中', 0)
+        let type = billModel.type
+        if (type === 'C') {
+          //单项选择
+          this.getComboValue(billModel)
+        } else if (type === 'SF' || type === 'DF') {
+          //DBFind选择
+          this.getDbfindList(billModel, billGroup)
+        } else if (type === 'MF') {
+          //多项选择
+
+        }
+      }
+    }
+  }
+
+  /**
+   * 放大镜类型
+   * @param billModel
+   * @param billGroup
+   */
+  getDbfindList (billModel, billGroup) {
+    let fieldKey = billModel.field
+    let isForm = billGroup.isForm
+    let gridCaller = ''
+    if (isForm == false && !isObjEmpty(billModel.findFunctionName)) {
+      let findFunctionNames = billModel.findFunctionName.split('\|')
+      if (!isObjEmpty(findFunctionNames)) {
+        gridCaller = findFunctionNames[0]
+        // fieldKey=findFunctionNames[1]
+      }
+    }
+    let condition = '1=1'
+
+    let params = {
+      which: isForm == true ? 'form' : 'grid',
+      caller: isForm == true
+        ? (billGroup.billCaller || mCaller)
+        : gridCaller,
+      field: fieldKey,
+      condition: condition,
+      page: 1,
+      pageSize: 1000,
+    }
+    if (isForm == false) {
+      params.gridField = fieldKey
+      params.gridCaller = (billGroup.billCaller || mCaller)
+    }
+    fetchGet(mBaseUrl + '/mobile/common/dbfind.action',
+      params).then(response => {
+      Toast.hide()
+      let dbfinds = response.dbfinds || response.gridDbfinds
+      if (isObjEmpty(dbfinds)) {
+        message.warn('选项数据为空')
+        return
+      }
+      let dataStr = response.data
+      let dataList = JSON.parse(dataStr)
+      if (isObjEmpty(dataList)) {
+        message.warn('选项数据为空')
+        return
+      }
+      let fieldKeyLike = ''
+      let configMap = {}
+      dbfinds.forEach((config, index) => {
+        //显示值对应字段名
+        let dbGridField = config.dbGridField || config.ds_dbfindfield
+        //实际字段名
+        let field = config.field || config.ds_gridfield
+        if (!isObjEmpty(dbGridField) && !isObjEmpty(field)) {
+          if (field == fieldKey) {
+            fieldKeyLike = dbGridField
+          }
+          configMap[dbGridField] = field
+        }
+      })
+      let dbList = []
+      dataList.forEach((item, index) => {
+        let localData = new LocalData()
+        localData.name = item[fieldKeyLike]
+        let jsonMap = {}
+        for (let key in configMap) {
+          jsonMap[configMap[key]] = item[key]
+        }
+        localData.value = this.getShowValue(jsonMap)
+        localData.obj = jsonMap
+        dbList.push(localData)
+      })
+
+      if (dbList.length === 0) {
+        message.error('选项数据为空')
+      } else {
+        this.setState({
+          modalList: dbList,
+          modalOpen: true,
+        })
+      }
+    }).catch(error => {
+      Toast.hide()
+      if (typeof error === 'string') {
+        message.error(error)
+      } else {
+        message.error('选项获取失败')
+      }
+    })
+  }
 
+  getShowValue = (jsonMap) => {
+    let showValue = ''
+    for (let key in jsonMap) {
+      if (!isObjEmpty(jsonMap[key])) {
+        showValue += jsonMap[key] + ','
       }
-    }*/
+    }
+    showValue = showValue.substr(0, showValue.length - 1)
+    return showValue
+  }
+
+  getComboValue (billModel) {
+    fetchPost(mBaseUrl + '/mobile/common/getComboValue.action', {
+      caller: mCaller,
+      field: billModel.field,
+    }).then(response => {
+      Toast.hide()
+      if ('combdatas' in response) {
+        let combdatas = response.combdatas
+        if (isObjEmpty(combdatas)) {
+          message.warn('选项数据为空')
+          return
+        }
+        let combList = []
+        for (let i = 0; i < combdatas.length; i++) {
+          let combObj = combdatas[i]
+          if (isObjNull(combObj)) {
+            continue
+          }
+          let comb = new LocalData()
+          if (typeof combObj === 'string') {
+            comb.value = combObj
+            comb.display = combObj
+          } else if (typeof combObj === 'object') {
+            comb.value = combObj.DISPLAY
+            comb.display = combObj.DISPLAY
+          }
+          combList.push(comb)
+        }
+        if (combList.length === 0) {
+          message.error('选项数据为空')
+        } else {
+          this.setState({
+            modalList: combList,
+            modalOpen: true,
+          })
+        }
+      }
+    }).catch(error => {
+      Toast.hide()
+      if (typeof error === 'string') {
+        message.error(error)
+      } else {
+        message.error('选项获取失败')
+      }
+    })
   }
 
   onTextChange = (groupIndex, childIndex, value, display) => {
@@ -481,7 +764,7 @@ export default class ApprovalAdd extends Component {
       Toast.hide()
       let billGroupModels = this.handlerBill(response)
       // this.changeBillModel(billGroupModels)
-      console.log('raomeng', billGroupModels)
+      // console.log('raomeng', billGroupModels)
       this.setState({
         billGroupModelList: billGroupModels,
       })

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

@@ -35,9 +35,9 @@ let mDoneIndex = 0
 let mSendIndex = 0
 
 let mBaseUrl = window.location.origin
-  + (process.env.REACT_APP_ROUTER_BASE_NAME || '/ERP')
+  // + (process.env.REACT_APP_ROUTER_BASE_NAME || '/ERP')
   // && 'http://erp.yitoa.com:8888/ERP'
-  // && 'http://29226oq576.qicp.vip/erp'
+  && 'http://29226oq576.qicp.vip/erp'
 
 // process.env.REACT_APP_ROUTER_BASE_NAME || '/ERP'