import React, { Component } from "react"; import { Button, Modal, message, Input, Form, Spin, } from "antd"; import $ from "jquery/src/ajax"; import "./index.less"; import { splitUrl } from '@/tools'; import ImgList from "../imgList"; /** * */ const PicturesWall = React.createClass({ getInitialState() { return { previewVisible: false, previewImage: "", fileList: this.props.pictureUrl, }; }, getDefaultProps() { return { changeClick: this.modifyChange, }; }, handleCancel() { this.setState({ previewVisible: false }); }, handlePreview(file) { this.setState({ previewImage: file.url || file.thumbUrl, previewVisible: true, }); }, handleChange(info) { let fileList = info.fileList; this.setState({ fileList }); this.props.fileList(fileList); }, componentWillReceiveProps(nextProps) { this.state.fileList = nextProps.pictureUrl; }, render() { const { fileList } = this.state; return (
{ this.handleChange(infor); }} fileList={fileList} />
); }, }); class MySuspend extends Component { constructor(props) { super(props); this.state = { reason: "", //原因 orgCodeUrl: [], //附件 loading: false, logList: [], //日志 emVisible: false, //审核弹窗 emReason: "", //审核说明 }; this.onOks = this.onOks.bind(this); this.getOrgCodeUrl = this.getOrgCodeUrl.bind(this); } componentDidMount() { const { rowData, type, again = false } = this.props type == "details" && !!rowData && !!rowData.id && this.getLog(rowData.id) if (again) { this.setState({ reason: rowData.reason, orgCodeUrl: splitUrl(rowData.annexUrl, ",", globalConfig.avatarHost + "/upload"), }) } } // 日志 getLog(id) { this.setState({ loading: true, }); $.ajax({ method: "get", dataType: "json", url: globalConfig.context + "/api/admin/orderProject/projectStopList", data: { taskStopId: id, }, success: function (data) { if (data.error.length === 0) { this.setState({ logList: data.data || [], }); } else { message.warning(data.error[0].message); } }.bind(this), }).always( function () { this.setState({ loading: false, }); }.bind(this) ); } // 确定 onOks() { const { selectedRowKeys, subClose, title } = this.props let annexUrl = [] if (this.state.orgCodeUrl.length) { let annexArr = []; this.state.orgCodeUrl.map(function (item) { if ( item.response && item.response.data && item.response.data.length ) { annexArr.push(item.response.data); } }); annexUrl = annexArr.join(","); } if (typeof annexUrl !== "string") { message.warning("请上传附件!"); return } if (!this.state.reason) { message.warning("请填写原因!"); return } if (!this.state.reason.replace(/\s+/g, '')) { message.warning("请填写原因!"); return; } this.setState({ loading: true, }); let infor = { ids: selectedRowKeys.toString(), type: title == "项目重启" ? 1 : 0, //0=项目暂停,1=项目重启 reason: this.state.reason, //原因 annexUrl: annexUrl.length ? annexUrl : undefined,//附件, } $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/orderProject/addProjectStop", data: infor, }).done( function (data) { this.setState({ loading: false, }); if (!data.error.length) { message.success("操作成功!"); subClose() } else { message.warning(data.error[0].message); } }.bind(this) ); } // 重新 onAgain() { const { subClose, title, rowData } = this.props let annexUrl = [] if (this.state.orgCodeUrl.length) { let annexArr = []; this.state.orgCodeUrl.map(function (item) { if ( item.response && item.response.data && item.response.data.length ) { annexArr.push(item.response.data); } }); annexUrl = annexArr.join(","); } if (typeof annexUrl !== "string") { message.warning("请上传附件!"); return } if (!this.state.reason) { message.warning("请填写原因!"); return } if (!this.state.reason.replace(/\s+/g, '')) { message.warning("请填写原因!"); return; } this.setState({ loading: true, }); let infor = { stopId: rowData.id, //暂停编号 type: title == "项目重启" ? 1 : 0, //0=项目暂停,1=项目重启 reason: this.state.reason, //原因 annexUrl: annexUrl.length ? annexUrl : undefined,//附件, } $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/orderProject/updateProjectStop", data: infor, }).done( function (data) { this.setState({ loading: false, }); if (!data.error.length) { message.success("重新发起成功!"); subClose() } else { message.warning(data.error[0].message); } }.bind(this) ); } // 图片添加 getOrgCodeUrl(e) { this.setState({ orgCodeUrl: e }); } // 关闭审核弹窗 emCancel() { const { subClose } = this.props this.setState({ emVisible: false, emReason: "", }, () => { subClose() }) } // 项目审核 examineProjectStop(status) { if (!this.state.emReason) { message.warning("请填写审核说明~"); return; } if (!this.state.emReason.replace(/\s+/g, '')) { message.warning("请填写审核说明~"); return; } this.setState({ loading: true, }); $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/orderProject/examineProjectStop", data: { taskStopId: this.props.rowData.id, reason: this.state.emReason, status, }, }).done( function (data) { if (!data.error.length) { this.setState({ loading: false, }) message.success("审核成功!"); this.emCancel() } else { message.warning(data.error[0].message); } }.bind(this) ); } render() { const { visible, title, orderNo, userName, contractNo, isApproved = false, subClose, selectedRows, type, reason, annexUrl, rowData, } = this.props const { logList } = this.state const FormItem = Form.Item; const formItemLayout = { labelCol: { span: 3 }, wrapperCol: { span: 20 }, }; return (
{title}
{type != "details" && "请您确定,是否将"} 订单号:{orderNo},客户:{userName},合同编号:{contractNo} {type != "details" && ("的项目进行" + (title == "项目重启" ? "重启" : "暂停"))}
{title == "项目重启" ? "重启" : "暂停"}项目清单:
{ selectedRows.length > 0 && selectedRows.map((item, index) =>
{index + 1}{"、" + item.commodityName + "-" + item.id}
) }
{ type == "details" ? {reason} : *{title == "项目重启" ? "重启原因" : "暂停原因"}} > { this.setState({ reason: e.target.value }); }} /> 点击“确定{title == "项目重启" ? "重启" : "暂停"}”, 审核通过后,项目状态更改为“{title == "项目重启" ? "正常" : "暂停"}”, 技术人员将暂停此项目的相关服务! }
{ type == "details" ? : *上传附件} >

图片建议:要清晰。

可上传与客户协议或截图等信息

}
{ type != "details" &&
} { // 日志 type == "details" &&
{ logList.map((item) =>
{item.createName + ":" + item.createTimes + " "} {" " + ["【发起】", "【通过】", "【拒绝】"][item.status] + " "} {"备注:" + item.reason}
) }
} { !!rowData && rowData.stopStatus == 0 && isApproved &&
}
{ // 项目审核 this.state.emVisible && { this.setState({ emVisible: false }) }} >
* 备注 } > { this.setState({ emReason: e.target.value }); }} />
}
); } } export default MySuspend;