legalAdd.jsx 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. import React, { Component } from "react";
  2. import {
  3. Form,
  4. Button,
  5. message,
  6. Modal,
  7. Spin,
  8. Input,
  9. DatePicker,
  10. Radio,
  11. Popconfirm
  12. } from "antd";
  13. import ImgList from "../../../common/imgList";
  14. import $ from "jquery/src/ajax";
  15. const { TextArea } = Input;
  16. const RadioGroup = Radio.Group;
  17. class legalAdd extends Component {
  18. constructor(props) {
  19. super(props);
  20. this.state = {
  21. visible: false,
  22. mainModalKeys: 0,
  23. type: "",
  24. date: "",
  25. remarks: "",
  26. loading: false,
  27. };
  28. this.addLegal = this.addLegal.bind(this);
  29. }
  30. addLegal() {
  31. let theorgCodeUrl = [];
  32. if (!this.state.fileList) {
  33. message.warning("请上传凭证");
  34. return;
  35. } else {
  36. let picArr = [];
  37. this.state.fileList.map(function (item) {
  38. if (item.response && item.response.data && item.response.data.length) {
  39. picArr.push(item.response.data);
  40. }
  41. });
  42. theorgCodeUrl = picArr.join(",");
  43. }
  44. if (!this.state.date) {
  45. message.warning("请选择时间");
  46. return;
  47. }
  48. this.setState({
  49. addDunOrderLoading: true,
  50. loading: true,
  51. });
  52. $.ajax({
  53. method: "post",
  54. dataType: "json",
  55. crossDomain: false,
  56. url: globalConfig.context + "/api/admin/lagalAffairs/addLagalAffairsLog",
  57. data: {
  58. orderNo: this.props.orderNo,
  59. type: this.state.type,
  60. status: this.state.status ? this.state.status : 0 ,
  61. date: this.state.date,
  62. remarks: this.state.remarks,
  63. attachmentUrl: theorgCodeUrl.length ? theorgCodeUrl : "",
  64. },
  65. success: function (data) {
  66. if (data.error.length) {
  67. this.setState({
  68. loading: false,
  69. });
  70. message.warning(data.error[0].message);
  71. } else {
  72. this.setState({
  73. loading: false,
  74. });
  75. this.props.modelBack();
  76. // this.props.visible = false
  77. message.success("添加成功");
  78. this.tabelContentRef && this.tabelContentRef.onRefresh();
  79. }
  80. }.bind(this),
  81. }).done(
  82. function () {
  83. this.setState({
  84. addDunOrderLoading: false,
  85. });
  86. }.bind(this)
  87. );
  88. }
  89. render() {
  90. // const { getFieldDecorator } = this.props.form;
  91. const formItemLayout = {
  92. labelCol: { span: 10 },
  93. wrapperCol: { span: 12 },
  94. };
  95. return (
  96. <div>
  97. <Modal
  98. maskClosable={false}
  99. visible={this.props.visibles}
  100. onOk={this.props.onOk}
  101. onCancel={this.props.onCancel}
  102. key={this.state.mainModalKeys}
  103. width="1200px"
  104. title="新增法务数据"
  105. footer=""
  106. className="admin-desc-content"
  107. >
  108. <Form onSubmit={this.handleSubmit} ref={this.formRef}>
  109. <Form.Item
  110. {...formItemLayout}
  111. label="法务类型"
  112. name="type"
  113. hasFeedback
  114. >
  115. <RadioGroup
  116. onChange={(e) => {
  117. this.setState({
  118. type: e.target.value,
  119. });
  120. }}
  121. >
  122. <Radio value="0">法务催收中</Radio>
  123. <Radio value="1">延期法务</Radio>
  124. <Radio value="2">法务已完成</Radio>
  125. </RadioGroup>
  126. </Form.Item>
  127. {this.state.type == 2 ? (
  128. <Form.Item
  129. {...formItemLayout}
  130. label="完成状态"
  131. name="status"
  132. hasFeedback
  133. >
  134. <RadioGroup
  135. onChange={(e) => {
  136. this.setState({
  137. status: e.target.value,
  138. });
  139. }}
  140. >
  141. <Radio value="1">已回款</Radio>
  142. <Radio value="2">以诉讼</Radio>
  143. <Radio value="3">以坏账处理</Radio>
  144. </RadioGroup>
  145. </Form.Item>
  146. ) : null}
  147. <Form.Item
  148. name="date"
  149. {...formItemLayout}
  150. label="延期时间"
  151. hasFeedback
  152. >
  153. <DatePicker
  154. onChange={(date, dateString) => {
  155. this.setState({
  156. date: dateString,
  157. });
  158. }}
  159. />
  160. </Form.Item>
  161. <Form.Item
  162. name="remarks"
  163. {...formItemLayout}
  164. label="法务情况"
  165. hasFeedback
  166. >
  167. <TextArea
  168. rows={4}
  169. onChange={(e) => {
  170. this.setState({
  171. remarks: e.target.value,
  172. });
  173. }}
  174. />
  175. </Form.Item>
  176. <Form.Item
  177. name="fileList"
  178. {...formItemLayout}
  179. label="附件"
  180. hasFeedback
  181. >
  182. <ImgList
  183. accept="application/pdf,image/png,application/msword"
  184. domId="nowProjectStatus"
  185. uploadConfig={{
  186. action:
  187. globalConfig.context +
  188. "/api/admin/newOrder/uploadDunLogFile",
  189. data: { sign: "dun_log_attachment" },
  190. multiple: true,
  191. listType: "text",
  192. }}
  193. onChange={(info) => {
  194. let fileList = info.fileList;
  195. this.setState({ fileList });
  196. }}
  197. fileList={this.state.fileList}
  198. />
  199. </Form.Item>
  200. <div style={{ display: "flex" }}>
  201. <Button
  202. type="primary"
  203. loading={this.state.loading}
  204. >
  205. <Popconfirm
  206. title="您确定此订单提交法务数据?"
  207. onConfirm={this.addLegal}
  208. onCancel={()=>{
  209. this.setState({
  210. loading:false
  211. })
  212. }}
  213. okText="确定"
  214. cancelText="取消"
  215. loading={this.state.loading}
  216. >
  217. <a href="#">提交</a>
  218. </Popconfirm>
  219. </Button>
  220. <Button
  221. type="dashed"
  222. style={{ marginLeft: "15px" }}
  223. onClick={this.props.onCancel}
  224. >
  225. 取消
  226. </Button>
  227. </div>
  228. </Form>
  229. </Modal>
  230. </div>
  231. );
  232. }
  233. }
  234. export default legalAdd;