Commit 4f76d27a authored by 王珂's avatar 王珂

修改电力设备bug

parent c4a2063b
......@@ -4,7 +4,7 @@ import SysConsts from 'amos-processor/lib/config/consts';
import formatUrl from 'amos-processor/lib/utils/urlFormat';
import * as endConf from 'amos-processor/lib/config/endconf';
import { FasSerUrl } from '../../../../consts/urlConsts';
import { Form, Upload, Input, Select, Radio, Modal, AmosAlert, Icon } from 'amos-framework';
import { Form, Upload, Input, Select, Radio, Modal, AmosAlert, Icon, Toast } from 'amos-framework';
import { TreeSelect } from 'amos-antd';
import PropTypes from 'amos-react-router/lib/PropTypes';
import { getEquipmentDataAction, getFireStationDataAction, getPrePlanPictureAction } from '../../../../services/ledgerService';
......@@ -109,6 +109,16 @@ class EquipmentModel extends Component {
onInputChange = (key, value) => {
const { form } = this.state;
let reg = /[\u4E00-\u9FA5]/g;
if (key === 'code') {
if (reg.test(value)) {
Toast.open({
content: '编码不能输入汉字',
placement: 'topMiddle'
});
return;
}
}
form[key] = value.trim();
this.setState({ form });
};
......@@ -162,6 +172,7 @@ class EquipmentModel extends Component {
getPrePlanPictureData = equipmentId => {
getPrePlanPictureAction(equipmentId, '').then(data => {
let pMap = new Map();
console.log(data);
data.forEach(ele => {
let type = ele.type;
if (type >= 1 && type <= 4) {
......
......@@ -108,33 +108,33 @@ class MatchEquipment extends Component {
componentDidMount() {
if (this.props.location.state) {
let { equipmentId, show } = this.props.location.state;
if(equipmentId===undefined){
equipmentId = this.props.location.query.equipmentId
this.setState({ equipmentId:equipmentId });
if (equipmentId === undefined){
equipmentId = this.props.location.query.equipmentId;
this.setState({ equipmentId });
}
let { searchParam } = this.state;
searchParam.pageNumber = 0;
searchParam.pageSize = 10;
if (equipmentId) {
this.getEquipmentData(equipmentId);
this.setState({equipmentId},()=>this.getMatchEquipmentListData(searchParam));
this.setState({equipmentId},()=>this.getPrePlanPictureData());
this.setState({ equipmentId },()=>this.getMatchEquipmentListData(searchParam));
this.setState({ equipmentId },()=>this.getPrePlanPictureData());
}
if (void 0 !== show) {
this.setState({ show });
}
}
//兼容url直接请求
if(this.props.location.query){
if (this.props.location.query){
let { equipmentId } = this.props.location.query;
let { searchParam } = this.state;
searchParam.pageNumber = 0;
searchParam.pageSize = 10;
if (equipmentId) {
this.getEquipmentData(equipmentId);
this.setState({equipmentId},()=>this.getMatchEquipmentListData(searchParam));
this.setState({equipmentId},()=>this.getPrePlanPictureData());
this.setState({ equipmentId:equipmentId });
this.setState({ equipmentId },()=>this.getMatchEquipmentListData(searchParam));
this.setState({ equipmentId },()=>this.getPrePlanPictureData());
this.setState({ equipmentId });
}
}
}
......
......@@ -104,15 +104,18 @@ class Equipment extends Component {
}
onChange(type, value) {
let val = value.trim();
if (type === 'name') {
this.setState({ name: value });
this.setState({ name: val });
} else {
this.setState({ equipClassify: value });
this.setState({ equipClassify: val });
}
let searchParam = [{ name: type, value, type: 'LIKE' }];
if (val) {
let searchParam = [{ name: type, value: val, type: 'LIKE' }];
searchParam.current = 0;
this.getEquipmentListData(searchParam);
}
}
onRowClick = record => {
let { selectedRowKeys, selectedRows } = this.state;
......@@ -263,7 +266,7 @@ class Equipment extends Component {
submit = (e) => {
let { form } = this.model;
const { isClick } = this.state
const { isClick } = this.state;
if (isClick) {   //如果为true 开始执行
this.setState({ isClick: false });  //将isClick 变成false,将不会执行处理事件
form.validate((valid, dataValues) => {
......@@ -278,7 +281,7 @@ class Equipment extends Component {
if (dataValues) {
for (var key in dataValues) {
if (dataValues[key] == null || typeof(dataValues[key]) == "undefined") {
if (dataValues[key] == null || typeof dataValues[key] == 'undefined') {
delete dataValues[key];
}
}
......@@ -303,7 +306,7 @@ class Equipment extends Component {
'X-Access-Token': ls.read(token),
'appKey': window.appKey ,
'product': window.product,
'token':ls.read(token)
'token': ls.read(token)
},
body: formData
}).then(e => {
......@@ -322,7 +325,7 @@ class Equipment extends Component {
}
});
const that = this;   // 为定时器中的setState绑定this
setTimeout(function () {       // 设置延迟事件,1秒后将执行
setTimeout(() => {       // 设置延迟事件,1秒后将执行
that.setState({ isClick: true });   // 将isClick设置为true
}, 5000);
}
......@@ -340,7 +343,7 @@ class Equipment extends Component {
</div>
<div className='important-equipment-tools'>
<span>搜索:</span>
<Input value={name} onChange={e => this.onChange('name', e.target.value)} placeholder="按编号,名称搜索"/>
<Input value={name} onChange={e => this.onChange('name', e.target.value)} placeholder="按编号,名称搜索" />
<Button icon={<BizIcon icon="tianjia" />} transparent onClick={() => this.add()} />
<Button icon={<BizIcon icon="xiugai" />} transparent onClick={() => this.edit()} />
<Button icon={<BizIcon icon="shanchu" />} transparent onClick={() => this.delete()} />
......
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