|
|
@@ -16,8 +16,11 @@ import {
|
|
|
Toast,
|
|
|
} from 'antd-mobile'
|
|
|
import { isObjEmpty, isObjNull } from '../../utils/common'
|
|
|
+import MapSearch from '../map/MapSearch'
|
|
|
import moment from 'moment'
|
|
|
|
|
|
+const prompt = Modal.prompt
|
|
|
+
|
|
|
export default class FormInput extends Component {
|
|
|
|
|
|
constructor () {
|
|
|
@@ -66,13 +69,17 @@ export default class FormInput extends Component {
|
|
|
valueItem =
|
|
|
this.getHtmlcom(billModel)
|
|
|
break
|
|
|
+ case 'SM':
|
|
|
+ valueItem =
|
|
|
+ this.getSearchMap(billModel, modalOpen)
|
|
|
+ break
|
|
|
default:
|
|
|
valueItem =
|
|
|
this.getTextCom(billModel)
|
|
|
break
|
|
|
}
|
|
|
return (
|
|
|
- (type === 'DT' || type === 'D' || type === 'T') ? <div>
|
|
|
+ (type === 'DT' || type === 'D' || type === 'T' || type === 'SM') ? <div>
|
|
|
{valueItem}
|
|
|
</div> :
|
|
|
(type === 'MS') ? (this.renderTwoLines(
|
|
|
@@ -147,6 +154,52 @@ export default class FormInput extends Component {
|
|
|
</div>
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 加载带搜索的地图类型
|
|
|
+ * @param {*} billModel
|
|
|
+ * @param {*} modalOpen
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+
|
|
|
+ getSearchMap (billModel, modalOpen) {
|
|
|
+ return <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>
|
|
|
+ {
|
|
|
+ <InputItem className='form-input-value' clear
|
|
|
+ placeholder={'请选择'}
|
|
|
+ editable={false}
|
|
|
+ onClick={() => {
|
|
|
+ this.setState({
|
|
|
+ modalOpen: true,
|
|
|
+ })
|
|
|
+ }}
|
|
|
+ value={billModel.getValue()}
|
|
|
+ />
|
|
|
+ }
|
|
|
+ <Modal visible={modalOpen}
|
|
|
+ animationType={'slide-up'}
|
|
|
+ onClose={() => {
|
|
|
+ this.setState({
|
|
|
+ modalOpen: false,
|
|
|
+ })
|
|
|
+ }}
|
|
|
+ title={billModel.caption}
|
|
|
+ popup
|
|
|
+ >
|
|
|
+ <div className='map-modal-root'>
|
|
|
+ <MapSearch
|
|
|
+ onLocationSelect={this.onMapSelect}/>
|
|
|
+ </div>
|
|
|
+ </Modal>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 文本输入类型
|
|
|
* @param billModel
|
|
|
@@ -279,6 +332,41 @@ export default class FormInput extends Component {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ onMapSelect = (location) => {
|
|
|
+ const { billModel } = this.state
|
|
|
+ this.setState({
|
|
|
+ modalOpen: false,
|
|
|
+ })
|
|
|
+
|
|
|
+ prompt('拜访单位', '请完善单位名称', [
|
|
|
+ {
|
|
|
+ text: '跳过此步', onPress: value => {
|
|
|
+ billModel.value = location.title;
|
|
|
+ this.setState({
|
|
|
+ billModel,
|
|
|
+ }, () => {
|
|
|
+ this.props.onTextChange &&
|
|
|
+ this.props.onTextChange(this.props.groupIndex, this.props.childIndex,
|
|
|
+ location.title)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ text: '确定', onPress: value => {
|
|
|
+ billModel.value = value;
|
|
|
+ this.setState({
|
|
|
+ billModel,
|
|
|
+ }, () => {
|
|
|
+ this.props.onTextChange &&
|
|
|
+ this.props.onTextChange(this.props.groupIndex, this.props.childIndex,
|
|
|
+ value)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ], 'default', location.title)
|
|
|
+ }
|
|
|
+
|
|
|
onModalSelect = index => {
|
|
|
const { modalList } = this.state
|
|
|
console.log(modalList)
|
|
|
@@ -323,6 +411,7 @@ export default class FormInput extends Component {
|
|
|
case 'MF':
|
|
|
case 'SF':
|
|
|
case 'DF':
|
|
|
+ case 'SM':
|
|
|
// return false
|
|
|
return true
|
|
|
}
|