Commit 53922b4e by YuMengShuai

添加Ptspta2组件

parent de29e94a
import React, { Component, Fragment } from 'react'
import {
Page, Validator, Notification, FormItem,
InputItem, Input, Bind, SelectItem, Button, Label, DatePickerItem, Section, Table, TextAreaItem, ConfirmButton, Steps
} from '@/components/Common-Library'
import Api from '@/service/api'
import CodeTableFactory from '@/components/CodeTable'
import "./index.less"
import { inject, observer } from 'mobx-react'
import { action, observable } from 'mobx'
import { Row, Col, Popconfirm, Modal } from 'antd';
import { PtyPicker } from '@/components/Business-Library'
import { Link, withRouter } from 'react-router-dom'
const { Pre, Next, StepWrapper } = Steps
const CodeTable = CodeTableFactory.getInstance()
const confirm = Modal.confirm
@withRouter
@inject('UserContext')
@inject('i18n')
@observer
export default class PtsptaScreen extends Component {
@observable
formBlur = false
constructor(props) {
super(props)
this.model = props.model
this.bind = Bind.bind(this)
}
async componentWillMount() {
}
componentWillUnmount() {
//this.model.closeValidate()//关闭校验
}
// 1,将字符串val按照 \n 截取为多个字符串保存到数组中
// 2,将数组中长度超过指定长度的字符串分成两个字符串保存到数组中,将长度为0的字符串从数组中删除掉
// 3,将数组以 \n 为连接点 重新 组装成字符串
// 4,将得到的字符串赋值给 this.model..... 进行显示
hasCharOfArray = (array, char) => {
for (let i = 0; i < array.length; i++) {
if (char == array[i]) {
return true;
}
}
return false;
}
huan = (val) => {
const allowChar = ['.', ',', '-', '(', ')', '/', '=', "'", '+', ':', '?', '!', '"', '%', '&', '*', '<', '>', ';', '{',
'@', '#', '_', '\n', ' ', '\r'];
for (let i = 0; i < val.length; i++) {
if (
(
(val.charCodeAt(i) >= '0'.charCodeAt(0) && val.charCodeAt(i) <= '9'.charCodeAt(0)) ||
(val.charCodeAt(i) >= 'a'.charCodeAt(0) && val.charCodeAt(i) <= 'z'.charCodeAt(0)) ||
(val.charCodeAt(i) >= 'A'.charCodeAt(0) && val.charCodeAt(i) <= 'Z'.charCodeAt(o)) ||
this.hasCharOfArray(allowChar, val[i])
) == false
) {
console.log(val[i]);
return;
}
}
const MAX = 35;
const COUNT = 4;
let dataArrayTemp = [];
let dataResult = [];
// 1,将字符串val按照 \n 截取为多个字符串保存到数组中
dataArrayTemp = val.split("\n");
// 2,将数组中长度超过指定长度的字符串分成两个字符串保存到数组中,将长度为0的字符串从数组中删除掉
for (let item of dataArrayTemp) {
// if (item.length > 0 && item.length <= MAX) {
if (item.length <= MAX) {
dataResult.push(item);
} else if (item.length > MAX) {
dataResult.push(item.substr(0, MAX));
dataResult.push(item.substr(MAX));
}
}
// 3,将数组以 \n 为连接点 重新 组装成字符串 // 4,将得到的字符串赋值给 this.model...... 进行显示
if (dataResult.length > COUNT) {
return;
} else {
this.model[this.props.argArr.prefix + '_adrblk'] = dataResult.join("\n");
}
}
clearTxt=()=>{
let prefix = this.props.argArr.prefix
if(this.model[prefix + '_extkey']==''){
this.model[prefix + '_namcn']=''
this.model[prefix + '_adrcn']=''
this.model[prefix + '_adrblk']=''
}
}
childEvevnt = childData => {
this.child = childData;
}
handleClick=()=>{
this.child.handleClick();
}
render() {
const bind = this.bind
const { argArr } = this.props
let desc = argArr.desc
let desc1 = argArr.desc1
let prefix = argArr.prefix
let url = argArr.url
let flg = argArr.flg
let datakey = argArr.datakey
let isDisabled = argArr.isDisabled
return (
<Col span={24}>
<Row className="row">
<Col span={5} offset={2}>
<Label value={desc} />
</Col>
<Col span={11} >
<InputItem InputProps={{...bind(prefix + '_extkey'),onAfterChange:this.clearTxt,onPressEnter:this.handleClick,formBlur:this.props.formBlur}} disabled={this.props.isDisabled} />
</Col>
<Col span={4} offset={1}>
<PtyPicker url={url} flg={flg} model={this.model} extkey={this.model[prefix + '_extkey']} dataKey={datakey} prefix={prefix} disabled={this.props.isDisabled} extkey={this.model[prefix + '_extkey']} childEvevnt={this.childEvevnt} />
{/*<PtyPicker url={url} flg={flg} model={this.model} extkey={this.model[prefix + '_extkey']} dataKey={datakey} prefix={prefix} disabled={isDisabled} />*/}
</Col>
</Row>
<Row className="row">
<Col span={5} offset={2}>
<Label value={desc1} />
</Col>
<Col span={14} >
{/* <TextAreaItem rows={4} onChange={(val) => { this.huan(val) }} style={{ resize: "none", "word-wrap": "break-word" }} className="section" InputProps={bind(prefix + '_adrblk')} /> */}
<TextAreaItem rows={2}
disabled={true}
value={this.model[prefix + '_adrblk']}
onChange={(val) => { this.huan(val) }}
disabled={isDisabled}
style={{ resize: "none" }} className="section" InputProps={bind(prefix + '_adrblk')} />
</Col>
</Row>
</Col>
)
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment