Commit 03f392f9 authored by zhengjiawei's avatar zhengjiawei

消防整改

parent 3b930af9
...@@ -26,7 +26,7 @@ class DetailContent extends Component { ...@@ -26,7 +26,7 @@ class DetailContent extends Component {
<div className="fire-resource-truck-detail-button"> <div className="fire-resource-truck-detail-button">
<Button className="go-back" icon={<BizIcon icon="fanhui" />} transparent onClick={handleClose} /> <Button className="go-back" icon={<BizIcon icon="fanhui" />} transparent onClick={handleClose} />
<div className="fire-resource-commit-button"> <div className="fire-resource-commit-button">
{ {states === '1' &&
<Button icon="ok" onClick={() => this.save()} transparent> <Button icon="ok" onClick={() => this.save()} transparent>
提交 提交
</Button> </Button>
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Input, Select, Table, DatePicker, Pagination ,Upload } from 'amos-antd'; import { Input, Select, Table, DatePicker, Pagination ,Upload } from 'amos-antd';
import { AmosAlert,Modal } from 'amos-framework'; import { AmosAlert,Modal } from 'amos-framework';
import _amosTool from 'amos-tool'; import _amosTool, { consts } from 'amos-tool';
import SysConsts from 'amos-processor/lib/config/consts'; import SysConsts from 'amos-processor/lib/config/consts';
import CommonContainer from './commonContainer/index'; import CommonContainer from './commonContainer/index';
import DetailContent from './detailContent/index'; import DetailContent from './detailContent/index';
...@@ -12,7 +12,6 @@ import { getBase64 } from './../../../utils/FileUtils'; ...@@ -12,7 +12,6 @@ import { getBase64 } from './../../../utils/FileUtils';
import { FireRectificationUrl } from '../../../consts/urlConsts'; import { FireRectificationUrl } from '../../../consts/urlConsts';
const { TextArea } = Input; const { TextArea } = Input;
const Search = Input.Search;
const Option = Select.Option; const Option = Select.Option;
const ghost = Modal.ghost; const ghost = Modal.ghost;
...@@ -20,6 +19,7 @@ const ls = _amosTool.Store.lsTool; ...@@ -20,6 +19,7 @@ const ls = _amosTool.Store.lsTool;
const apiKey = SysConsts.api_key; const apiKey = SysConsts.api_key;
const token = SysConsts.token; const token = SysConsts.token;
const url = FireRectificationUrl.fileUploadURL; const url = FireRectificationUrl.fileUploadURL;
let timer = null;
/** /**
* FireRectification * FireRectification
...@@ -55,7 +55,8 @@ class FireRectification extends Component { ...@@ -55,7 +55,8 @@ class FireRectification extends Component {
hiddenFileList: [],//隐患上传文件 hiddenFileList: [],//隐患上传文件
index: '',//记录当前上传文件对应数据的下标 index: '',//记录当前上传文件对应数据的下标
previewImage: '',//展示图片 previewImage: '',//展示图片
previewVisible: false previewVisible: false,
updateCount: 0
}; };
} }
componentDidMount() { componentDidMount() {
...@@ -114,13 +115,7 @@ class FireRectification extends Component { ...@@ -114,13 +115,7 @@ class FireRectification extends Component {
this.setState({ form },() =>this.getBillData(0)); this.setState({ form },() =>this.getBillData(0));
} }
} }
/**
*
* @param {*} value 输入参数
*/
handleSearch = (value) => {
this.handlerWhenDataChange('nameLike',value);
}
/** /**
* 关闭查看修改页面 * 关闭查看修改页面
* @param {*} e * @param {*} e
...@@ -133,14 +128,20 @@ class FireRectification extends Component { ...@@ -133,14 +128,20 @@ class FireRectification extends Component {
if (flag){ if (flag){
this.setState({ this.setState({
detailVisible: false, detailVisible: false,
updateFrom: {} }); updateFrom: {},
warmningFileList: [],
hiddenFileList: [] ,
updateCount: 0 });
} }
} }
}); });
} else { } else {
this.setState({ this.setState({
detailVisible: false, detailVisible: false,
updateFrom: {} }); updateFrom: {},
warmningFileList: [],
hiddenFileList: [] ,
updateCount: 0 });
} }
} }
...@@ -164,6 +165,22 @@ class FireRectification extends Component { ...@@ -164,6 +165,22 @@ class FireRectification extends Component {
this.setState({ dataStates: record.statuscode },()=>console.log('---------------获取单据相关数据----------------')); this.setState({ dataStates: record.statuscode },()=>console.log('---------------获取单据相关数据----------------'));
this.setState({ showMoreData: {} }); this.setState({ showMoreData: {} });
oneMoreDataAction(record.billno).then(data => { oneMoreDataAction(record.billno).then(data => {
let warn = [];
let hid = [];
const { updateFrom } = this.state;
if (data.warnnings) {
data.warnnings.map((item,i) =>{
warn.push({ req: item.req,doneResult: item.doneResult });
});
}
if (data.hidden) {
data.hidden.map((item,i) =>{
hid.push({ req: item.req,doneResult: item.doneResult });
});
}
updateFrom['warnningData'] = warn;
updateFrom['hiddenData'] = hid;
this.setState({ updateFrom });
this.setState({ this.setState({
showMoreData: data, showMoreData: data,
detailVisible: true detailVisible: true
...@@ -271,24 +288,30 @@ class FireRectification extends Component { ...@@ -271,24 +288,30 @@ class FireRectification extends Component {
savePack = (e) =>{ savePack = (e) =>{
let canSave = true; let canSave = true;
const { updateFrom,warmningFileList,hiddenFileList } = this.state; const { updateFrom,warmningFileList,hiddenFileList } = this.state;
if (updateFrom.warnningData !== undefined && updateFrom.warnningData.length !== 0) {
updateFrom.warnningData.map((item,i) =>{ updateFrom.warnningData.map((item,i) =>{
if (item.doneResult === '1') { if (item.doneResult === '1') {
let list = warmningFileList[`fileList${i}`]; let a = `fileList${i}`;
let list = warmningFileList[a];
if (list === undefined || list.length === 0) { if (list === undefined || list.length === 0) {
AmosAlert.error('错误', '告警信息已完成状态相关数据,凭证不能为空'); AmosAlert.error('错误', '告警信息已完成状态相关数据,凭证不能为空');
canSave = false; canSave = false;
} }
} }
}); });
updateFrom.dangerData.map((item,i) =>{ }
if (updateFrom.hiddenData !== undefined && updateFrom.hiddenData.length !== 0) {
updateFrom.hiddenData.map((item,i) =>{
if (item.doneResult === '1') { if (item.doneResult === '1') {
let list = hiddenFileList[`fileList${i}`]; let a = `fileList${i}`;
let list = hiddenFileList[a];
if (list === undefined || list.length === 0) { if (list === undefined || list.length === 0) {
AmosAlert.error('错误', '告警信息已完成状态相关数据,凭证不能为空'); AmosAlert.error('错误', '隐患信息已完成状态相关数据,凭证不能为空');
canSave = false; canSave = false;
} }
} }
}); });
}
let ref = this.regularUpdateData(); let ref = this.regularUpdateData();
if (!ref) { if (!ref) {
AmosAlert.warning('注意', '页面数据未发生变动,无需保存'); AmosAlert.warning('注意', '页面数据未发生变动,无需保存');
...@@ -304,18 +327,29 @@ class FireRectification extends Component { ...@@ -304,18 +327,29 @@ class FireRectification extends Component {
updateFrom.hiddenData.map((item,i) =>{ updateFrom.hiddenData.map((item,i) =>{
this.uploadFiles('hiddenData','hiddenFileList',i); this.uploadFiles('hiddenData','hiddenFileList',i);
}); });
timer = setInterval(()=>{
let lens = updateFrom.warnningData.length + updateFrom.hiddenData.length;
let cout = this.state.updateCount;
if (lens === cout) {
updateFrom['billNo'] = this.state.showMoreData.base.billno; updateFrom['billNo'] = this.state.showMoreData.base.billno;
updateAction(updateFrom).then(data => { updateAction(updateFrom).then(data => {
if (data.message === 'success') { if (data.message === 'success') {
AmosAlert[data.message]('提示',data.result); AmosAlert[data.message]('提示',data.result);
this.setState({ this.setState({
detailVisible: false, detailVisible: false,
updateFrom: {} },() =>this.getBillData(0)); updateFrom: {},
warmningFileList: [],
hiddenFileList: [],
updateCount: 0 },() =>this.getBillData(0));
} else { } else {
AmosAlert[data.message]('提示',data.result); AmosAlert[data.message]('提示',data.result);
} }
}); });
clearInterval(timer);
}
},800);
} }
} }
...@@ -333,7 +367,9 @@ class FireRectification extends Component { ...@@ -333,7 +367,9 @@ class FireRectification extends Component {
let formData = new FormData(); let formData = new FormData();
const { updateFrom } = this.state; const { updateFrom } = this.state;
const fileList = this.state[Lists]; const fileList = this.state[Lists];
fileList[`fileList${index}`].forEach(file => { const list = fileList[`fileList${index}`];
if ( list !== undefined && list.size !== 0) {
list.forEach(file => {
formData.append('files', file); formData.append('files', file);
}); });
fetch(url, { fetch(url, {
...@@ -359,10 +395,21 @@ class FireRectification extends Component { ...@@ -359,10 +395,21 @@ class FireRectification extends Component {
} }
}); });
updateFrom[listData][index].filePath = a; updateFrom[listData][index].filePath = a;
let countF = this.state.updateCount;
let count = countF + 1;
this.setState({ updateCount: count },()=> console.log(this.state.updateFrom));
this.setState({ updateFrom },()=> console.log(this.state.updateFrom)); this.setState({ updateFrom },()=> console.log(this.state.updateFrom));
}).catch(e => { }).catch(e => {
AmosAlert.error('错误', '图片上传失败'); AmosAlert.error('错误', '图片上传失败');
clearInterval(timer);
}); });
} else {
let countF = this.state.updateCount;
let count = countF + 1;
this.setState({ updateCount: count },()=> console.log(this.state.updateFrom));
}
} }
/** /**
* 处理结果修改监控 * 处理结果修改监控
...@@ -707,7 +754,7 @@ class FireRectification extends Component { ...@@ -707,7 +754,7 @@ class FireRectification extends Component {
} }
]; ];
const dataStates = this.state.dataStates; const dataStates = this.state.dataStates;
const { previewImage,previewVisible } = this.state; const { previewImage,previewVisible,form } = this.state;
const { base,warnnings,danger,hidden,fires,backResult } = this.state.showMoreData; const { base,warnnings,danger,hidden,fires,backResult } = this.state.showMoreData;
return ( return (
<div className="sefety-bills"> <div className="sefety-bills">
...@@ -715,9 +762,11 @@ class FireRectification extends Component { ...@@ -715,9 +762,11 @@ class FireRectification extends Component {
<div className="search-bgc"> <div className="search-bgc">
<div className="top-search"> <div className="top-search">
单据号: 单据号:
<Search <Input
style={{ width: '140px' }}
placeholder="搜索" placeholder="搜索"
onSearch={this.handleSearch} value={form.nameLike}
onChange={(e)=>this.handlerWhenDataChange('nameLike',e.target.value)}
/> />
<div className="finish-date"> <div className="finish-date">
<span>要求完成治理日期:</span> <span>要求完成治理日期:</span>
......
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