|
import React from 'react';
|
|
import { Row, Col, Input, DatePicker, Button, Modal, Upload, Icon, message, Divider, TimePicker, Badge, Select, Popconfirm, Spin } from 'antd';
|
const { TextArea } = Input;
|
import HeadView from '../view/HeadView';
|
import BusDetailView from '../view/BusDetailView';
|
import TableView from '../view/TableView';
|
import ImageBoxView from '../view/ImageBoxView'
|
// 引入编辑器以及编辑器样式
|
import Fetch from '../fetch';
|
import moment from 'moment';
|
const format = 'HH:mm';
|
const { Option } = Select;
|
const yearFormat = 'YYYY-MM-DD';
|
const divStyle = {
|
margin: '20px'
|
}
|
const domain = Fetch.domain;
|
|
function typeStatus(type) {
|
switch (type) {
|
case 1:
|
return "待审核";
|
case 2:
|
return "未签到";
|
case 3:
|
return "已签到";
|
case 4:
|
return "不通过";
|
case 99:
|
return "取消";
|
}
|
}
|
export default class ExamineEdit extends React.Component {
|
constructor(props) {
|
super(props);
|
this.state = {
|
dateSource: [],
|
savedate: {},
|
formdata: {},
|
fileList: [],
|
previewVisible: false,
|
previewImage: '',
|
visible: false,
|
hitList: [],
|
num: 0,
|
taskType: 1,
|
status: '',
|
loading: false,
|
opinion: '',
|
modalLoading:false,
|
};
|
}
|
|
componentDidMount() {
|
document.title = '公安审核详情';
|
this.getDetail();
|
}
|
|
getDetail = () => {
|
const { id } = this.props.match.params;
|
this.setState({ loading: true })
|
Fetch.entryFind(id)
|
.then(res => {
|
console.log(res)
|
this.setState({
|
savedate: {
|
...res,
|
},
|
loading: false,
|
fileList: res.list ? res.list.map((item, index) => ({ uid: index, id: item.id, name: item.name, status: 'done', url: domain + `/api/v1/attachment/download/${item.id}?online=false` })) : []
|
});
|
|
})
|
}
|
|
saveInputChange = ({ target: { value, name } }) => {
|
this.setState({
|
[name]: value
|
})
|
}
|
|
submit = () => {
|
const { savedate, fileList } = this.state;
|
console.log(fileList);
|
if (!savedate.reason) {
|
message.warning("申请理由不能为空");
|
return;
|
}
|
if (fileList === []) {
|
message.warning("请上传申请附件");
|
return;
|
}
|
|
Fetch.entrySave(savedate)
|
.then(res => {
|
if (res.statuscode === 1) {
|
message.success("提交成功!");
|
this.props.history.push("/entry/policeSecurity")
|
} else {
|
message.error('保存失败,请联系管理员', 2)
|
}
|
});
|
}
|
|
cancle = () => {
|
this.props.history.push("/entry/policeSecurity");
|
}
|
handlePreview = (file) => {
|
this.setState({
|
previewImage: file.url || file.thumbUrl,
|
previewVisible: true,
|
});
|
}
|
|
showModal = () => {
|
this.setState({
|
visible: true,
|
});
|
}
|
|
handleCancelModel = (e) => {
|
this.setState({
|
visible: false,
|
});
|
}
|
|
handleOk = e => {
|
const { savedate, opinion } = this.state;
|
console.log(savedate);
|
|
this.setState({
|
modalLoading: true
|
});
|
Fetch.entryAudit(savedate.id, 2, opinion)
|
.then(res => {
|
console.log(res)
|
if (res.statuscode === 1) {
|
message.success("提交成功!");
|
this.setState({ modalLoading: false })
|
this.props.history.push("/entry/policeSecurity")
|
} else {
|
this.setState({ modalLoading: false })
|
message.error('保存失败,请联系管理员', 2)
|
}
|
});
|
};
|
|
getNum = (e) => {
|
console.log(e.target.value)
|
this.setState({
|
num: e.target.value
|
})
|
}
|
getPerson = () => {
|
const { num } = this.state;
|
const { id } = this.state.savedate;
|
if (!num) {
|
message.error("请输入摇号数量")
|
return;
|
}
|
if (isNaN(num)) {
|
message.error("请输入数字")
|
return;
|
}
|
Fetch.getActPerson(id, num)
|
.then(res => {
|
this.setState({
|
hitList: res.data
|
})
|
});
|
}
|
|
|
publishResult = () => {
|
const { hitList, savedate } = this.state;
|
Fetch.publishResult(hitList, savedate.id)
|
.then(res => {
|
if (res.code === 0) {
|
message.success("发布成功!");
|
this.setState({
|
visible: false,
|
}, this.getDetail);
|
} else {
|
message.error('发布失败,请联系管理员', 2)
|
}
|
});
|
}
|
|
confirm = (e) => {
|
console.log(e);
|
const data = { id: e, status: 2 };
|
this.setState({ loading: true })
|
Fetch.auditPerson(data).then(res => {
|
if (res.code == 0) {
|
console.log(res)
|
this.setState({ loading: false })
|
message.success('审核通过');
|
this.getDetail();
|
} else {
|
this.setState({ loading: false })
|
message.error('请求失败,请联系管理员', 2)
|
}
|
}
|
)
|
}
|
|
cancel = (e) => {
|
console.log(e);
|
const data = { id: e, status: 4 };
|
this.setState({ loading: true })
|
Fetch.auditPerson(data).then(res => {
|
if (res.code == 0) {
|
console.log(res)
|
this.setState({ loading: false })
|
message.error('审核不通过');
|
this.getDetail();
|
} else {
|
this.setState({ loading: false })
|
message.error('请求失败,请联系管理员', 2)
|
}
|
}
|
)
|
}
|
|
onClick = () => {
|
console.log('111')
|
const { savedate } = this.state;
|
// window.open(domain + `api/v1/attachment/materials?associateTypeId=1019&entityId=` + savedate.id)
|
}
|
|
handleCancel = () => this.setState({ previewVisible: false })
|
render() {
|
const { savedate, opinion, fileList, loading } = this.state;
|
console.log('list', fileList)
|
const props = {
|
action: domain + `api/v1/attachment/materials?associateTypeId=1019&entityId=` + savedate.id,
|
onChange: ({ file, fileList }) => {
|
if (file.status !== 'uploading') {
|
console.log(file);
|
console.log(fileList);
|
|
}
|
this.setState({ fileList });
|
},
|
fileList: fileList,
|
showUploadList: {
|
showRemoveIcon: false
|
},
|
onDownload: (file) => {
|
Fetch.attachmentDownload(file.id)
|
.then(res => {
|
message.success("下载成功!");
|
});
|
},
|
};
|
|
|
return (
|
<div className="app-page">
|
<Spin spinning={loading}>
|
<HeadView history={this.props.history} />
|
<BusDetailView type='公安审核' >
|
<div style={divStyle}>
|
<Row type="flex" align='middle' justify="space-around">
|
<Col span={6} pull={0} style={{ textAlign: 'center' }}><span>申请单号</span></Col>
|
<Col span={6} push={0} ><span>{savedate.id}</span></Col>
|
<Col span={12} push={0} ></Col>
|
</Row>
|
</div>
|
<div style={divStyle}>
|
<Row type="flex" align='middle' justify="space-around">
|
<Col span={6} pull={0} style={{ textAlign: 'center' }}><span>申请时间</span></Col>
|
<Col span={6} push={0} ><span>{moment(savedate.createTime).format("YYYY-MM-DD HH:mm")}</span></Col>
|
<Col span={12} push={0} ></Col>
|
</Row>
|
</div>
|
<div style={divStyle}>
|
<Row type="flex" align='middle' justify="space-around">
|
<Col span={6} pull={0} style={{ textAlign: 'center' }}><span>申请理由</span></Col>
|
<Col span={6} push={0} ><span>{savedate.reason}</span></Col>
|
<Col span={12} push={0} ></Col>
|
</Row>
|
</div>
|
<div style={divStyle}>
|
<Row type="flex" align='middle' justify="space-around">
|
<Col span={6} pull={0} style={{ textAlign: 'center' }}><span>申请附件</span></Col>
|
<Col span={18} push={0} >
|
<Upload {...props}>
|
{/* <Button disabled>
|
<Icon type="upload" /> 上传附件
|
</Button> */}
|
</Upload>
|
</Col>
|
</Row>
|
</div>
|
|
<div style={divStyle}>
|
<Row type="flex" align='middle' justify="space-around">
|
<Col span={6} pull={0} style={{ textAlign: 'center' }}><span>审批意见</span></Col>
|
<Col span={18} push={0} >
|
<TextArea rows={4} placeholder="请输入审批意见" style={{ width: '92%' }} value={opinion || ""} onChange={this.saveInputChange} name='opinion' /></Col>
|
</Row>
|
</div>
|
<div style={{ display: 'flex', justifyContent: 'center' }}>
|
<Button style={{ marginRight: '15px', width: '150px' }} type="primary" onClick={this.showModal}>提交</Button>
|
<Button style={{ marginLeft: '15px', width: '150px' }} onClick={this.cancle}>返回</Button>
|
</div>
|
|
</BusDetailView>
|
|
<Modal
|
title="提交审核"
|
visible={this.state.visible}
|
onOk={this.handleOk}
|
confirmLoading={this.state.modalLoading}
|
onCancel={this.handleCancelModel}
|
width='300px'
|
>
|
<p>确认提交审核吗?</p>
|
</Modal>
|
</Spin>
|
</div>
|
);
|
}
|
|
}
|