changeDetailJszj.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  1. import React, { Component } from "react";
  2. import { Form, Upload, Modal, Input, Button, message, Select } from "antd";
  3. import AgreeButton from "./agreeButton.js";
  4. import Rizhi from "./rizhi.js";
  5. import { getProcessStatusNew } from "@/tools.js";
  6. import $ from "jquery/src/ajax";
  7. // import ReactToPrint from "react-to-print";
  8. const formItemLayout = {
  9. labelCol: { span: 8 },
  10. wrapperCol: { span: 14 }
  11. };
  12. const changeType = [
  13. {
  14. value: "0",
  15. key: "退单退款"
  16. },
  17. {
  18. value: "1",
  19. key: "项目及金额变更"
  20. },
  21. {
  22. value: "2",
  23. key: "仅项目变更"
  24. },
  25. {
  26. value: "3",
  27. key: "仅金额变更"
  28. },
  29. {
  30. value: "4",
  31. key: "重报"
  32. },
  33. {
  34. value: "5",
  35. key: "赠送"
  36. }
  37. ];
  38. const getChangeType = function(e) {
  39. if (e || e == 0) {
  40. let str = e.toString();
  41. let theType = "";
  42. changeType.map(function(item) {
  43. if (item.value == str) {
  44. theType = item.key;
  45. }
  46. });
  47. return theType;
  48. }
  49. };
  50. class Itemlist extends Component {
  51. constructor(props) {
  52. super(props);
  53. }
  54. render() {
  55. let pageData = this.props.pageData;
  56. return (
  57. <div className="clearfix">
  58. <Form.Item
  59. label={pageData.labelA}
  60. {...pageData.formItemLayoutA}
  61. className="half-item"
  62. >
  63. <p style={{ width: 500, wordWrap: "break-word" }}>{pageData.dataA}</p>
  64. </Form.Item>
  65. <Form.Item
  66. label={pageData.labelB}
  67. {...pageData.formItemLayoutB}
  68. className="half-item"
  69. >
  70. <span>{pageData.dataB}</span>
  71. </Form.Item>
  72. </div>
  73. );
  74. }
  75. }
  76. class ChangeDetail extends Component {
  77. constructor(props) {
  78. super(props);
  79. this.state = {
  80. previewVisible: false,
  81. buttonStatus: true,
  82. dataSource: [],
  83. reason: ""
  84. };
  85. this.getOrgCodeUrl = this.getOrgCodeUrl.bind(this);
  86. this.changeButtonStatus = this.changeButtonStatus.bind(this);
  87. }
  88. getOrgCodeUrl(e) {
  89. this.setState({
  90. orgCodeUrl: e
  91. });
  92. }
  93. //同意拒绝按钮的有无
  94. changeButtonStatus() {
  95. this.setState({
  96. buttonStatus: !this.state.buttonStatus
  97. });
  98. }
  99. loadDataChange() {
  100. $.ajax({
  101. method: "get",
  102. dataType: "json",
  103. async: false,
  104. crossDomain: false,
  105. url: globalConfig.context + "/api/admin/orderChange/orderChangeLogList",
  106. data: {
  107. changeId: this.props.data.id
  108. },
  109. success: function(data) {
  110. if (data.error.length || data.data.list == "") {
  111. if (data.error && data.error.length) {
  112. message.warning(data.error[0].message);
  113. }
  114. } else {
  115. this.setState({
  116. dataSource: data.data
  117. });
  118. }
  119. }.bind(this)
  120. });
  121. }
  122. componentDidMount() {
  123. window.setTimeout(() => {
  124. this.loadDataChange();
  125. }, 10);
  126. }
  127. render() {
  128. const pageData = [
  129. {
  130. labelA: "客户名称",
  131. formItemLayoutA: formItemLayout,
  132. dataA: this.props.data.userName,
  133. labelB: "合同编号",
  134. formItemLayoutB: formItemLayout,
  135. dataB: this.props.data.contractNo
  136. },
  137. {
  138. labelA: "时间",
  139. formItemLayoutA: formItemLayout,
  140. dataA: this.props.data.createTimes,
  141. labelB: "发起人",
  142. formItemLayoutB: formItemLayout,
  143. dataB: this.props.data.applicant
  144. },
  145. {
  146. labelA: "当前进度",
  147. formItemLayoutA: formItemLayout,
  148. dataA:
  149. this.props.data.status !== 4
  150. ? getProcessStatusNew(this.props.data.processState) + "审核中"
  151. : getProcessStatusNew(this.props.data.processState) + "已完成",
  152. labelB: "变更类型",
  153. formItemLayoutB: formItemLayout,
  154. dataB: getChangeType(this.props.data.type)
  155. },
  156. {
  157. labelA: "合同额(万元)",
  158. formItemLayoutA: formItemLayout,
  159. dataA: this.props.data.totalAmount,
  160. labelB: "已收款(万元)",
  161. formItemLayoutB: formItemLayout,
  162. dataB: this.props.data.settlementAmount
  163. },
  164. {
  165. labelA: "欠款(万元)",
  166. formItemLayoutA: formItemLayout,
  167. dataA: this.props.data.arrears,
  168. labelB: "申请退款(万元)",
  169. formItemLayoutB: formItemLayout,
  170. dataB: this.props.data.changeAmount
  171. },
  172. {
  173. labelA: "变更原因",
  174. formItemLayoutA: formItemLayout,
  175. dataA: this.props.data.remarks
  176. }
  177. ];
  178. const planData = [
  179. {
  180. labelA: "项目进度",
  181. formItemLayoutA: formItemLayout,
  182. dataA: this.props.data.projectState,
  183. onChangeA: value => {
  184. this.setState({
  185. projectState: value
  186. });
  187. },
  188. labelB: "发生成本费用(万元)",
  189. formItemLayoutB: formItemLayout,
  190. dataB: this.props.data.zxsCost,
  191. onChangeB: value => {
  192. this.setState({
  193. zxsCost: value
  194. });
  195. }
  196. },
  197. {
  198. labelA: "备注",
  199. formItemLayoutA: formItemLayout,
  200. dataA: this.props.data.zxsRemarks,
  201. onChangeA: value => {
  202. this.setState({
  203. zxsRemarks: value
  204. });
  205. }
  206. }
  207. ];
  208. const financeData = [
  209. {
  210. labelA: "收款时间",
  211. formItemLayoutA: formItemLayout,
  212. dataA: this.props.data.paymentTimes,
  213. labelB: "收款金额(万元)",
  214. formItemLayoutB: formItemLayout,
  215. dataB: this.props.data.paymentAmount
  216. },
  217. {
  218. labelA: "开票时间",
  219. formItemLayoutA: formItemLayout,
  220. dataA: this.props.data.invoiceTimes,
  221. labelB: "已开票金额(万元)",
  222. formItemLayoutB: formItemLayout,
  223. dataB: this.props.data.invoiceAmount
  224. },
  225. {
  226. labelA: "发生成本(万元)",
  227. formItemLayoutA: formItemLayout,
  228. dataA: this.props.data.cwCost,
  229. labelB: "应退金额(万元)",
  230. formItemLayoutB: formItemLayout,
  231. dataB: this.props.data.refundableAmount
  232. },
  233. {
  234. labelA: "补充资料/备注",
  235. formItemLayoutA: formItemLayout,
  236. dataA: this.props.data.cwRemarks
  237. }
  238. ];
  239. const buttonData = [
  240. {
  241. name: "同意",
  242. title: "理由",
  243. placeholder: "请输入理由",
  244. type: "primary",
  245. status: 2,
  246. onChange: value => {
  247. this.setState({
  248. remarks: value
  249. });
  250. }
  251. },
  252. {
  253. name: "拒绝",
  254. title: "理由",
  255. placeholder: "请输入理由",
  256. type: "danger",
  257. status: 3,
  258. onChange: value => {
  259. this.setState({
  260. remarks: value
  261. });
  262. }
  263. }
  264. ];
  265. const orgCodeUrl = this.props.pictureUrl;
  266. return (
  267. <div className="clearfix">
  268. <div
  269. className="clearfix"
  270. style={{ marginTop: 20 }}
  271. ref={e => {
  272. this.refs = e;
  273. }}
  274. >
  275. <h2 style={{ textAlign: "center", marginBottom: 10 }}>
  276. 合同变更记录
  277. </h2>
  278. {pageData.map((item, index) => {
  279. return <Itemlist key={index} pageData={item} />;
  280. })}
  281. <Form.Item
  282. label="变更凭证"
  283. labelCol={{ span: 4 }}
  284. wrapperCol={{ span: 18 }}
  285. >
  286. <Upload
  287. className="demandDetailShow-upload"
  288. listType="picture-card"
  289. fileList={orgCodeUrl}
  290. onPreview={file => {
  291. this.setState({
  292. previewImage: file.url || file.thumbUrl,
  293. previewVisible: true
  294. });
  295. }}
  296. />
  297. <Modal
  298. maskClosable={false}
  299. footer={null}
  300. visible={this.state.previewVisible}
  301. onCancel={() => {
  302. this.setState({ previewVisible: false });
  303. }}
  304. >
  305. <img
  306. alt=""
  307. style={{ width: "100%" }}
  308. src={this.state.previewImage || ""}
  309. />
  310. </Modal>
  311. <Rizhi changeId={this.props.data.id} />
  312. </Form.Item>
  313. <ul
  314. style={{ width: "868px", overflow: "hidden", paddingLeft: "90px" }}
  315. >
  316. {/* <span>操作人:</span> */}
  317. {this.state.dataSource.map((item, index) => (
  318. <li
  319. key={index}
  320. style={{
  321. width: "100%",
  322. height: "auto",
  323. wordBreak: "break-all",
  324. color: "black",
  325. marginBottom: "10px"
  326. }}
  327. >{`${item.aname}: ${item.remarks}`}</li>
  328. ))}
  329. </ul>
  330. {/* {this.props.data.processState >= 4 ? (
  331. <div>
  332. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  333. 当前项目进度(咨询师经理填写)
  334. </h3>
  335. {planData.map((item, index) => {
  336. return <Itemlist key={index} pageData={item} />;
  337. })}
  338. </div>
  339. ) : (
  340. ""
  341. )} */}
  342. {/* {this.props.data.processState >= 5 ? (
  343. <div>
  344. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  345. 当前财务状态(财务填写)
  346. </h3>
  347. {financeData.map((item, index) => {
  348. return <Itemlist key={index} pageData={item} />;
  349. })}
  350. </div>
  351. ) : (
  352. ""
  353. )} */}
  354. <div>
  355. <Form.Item
  356. label="备注"
  357. labelCol={{ span: 4 }}
  358. wrapperCol={{ span: 14 }}
  359. >
  360. <Input.TextArea
  361. value={this.state.reason}
  362. rows={4}
  363. placeholder="请输入备注"
  364. onChange={e => {
  365. let reason = e.target.value;
  366. this.setState({ reason });
  367. }}
  368. />
  369. </Form.Item>
  370. </div>
  371. </div>
  372. {this.props.processState === this.props.data.processState ? (
  373. this.state.buttonStatus ? (
  374. <div
  375. className="clearfix"
  376. style={{ display: "flex", justifyContent: "space-around" }}
  377. >
  378. {buttonData.map((item, index) => {
  379. return (
  380. <AgreeButton
  381. data={item}
  382. key={index}
  383. backData={this.props.data}
  384. processState={this.props.processState}
  385. visible={this.changeButtonStatus}
  386. loadData={this.props.loadData}
  387. ajaxData={this.state}
  388. rejectState={this.state.rejectState}
  389. reason={this.state.reason}
  390. />
  391. );
  392. })}
  393. <Select
  394. defaultValue="0"
  395. style={{
  396. width: 120,
  397. float: "left",
  398. position: "relative",
  399. bottom: "28px",
  400. right: "-600px"
  401. }}
  402. onChange={val => {
  403. this.setState({ rejectState: val });
  404. console.log(val, this.state.rejectState);
  405. }}
  406. >
  407. <Option
  408. value="0"
  409. style={{
  410. display: this.props.processState >= 1 ? "block" : "none"
  411. }}
  412. >
  413. 营销员
  414. </Option>
  415. <Option
  416. value="1"
  417. style={{
  418. display: this.props.processState >= 2 ? "block" : "none"
  419. }}
  420. >
  421. 营销管理员
  422. </Option>
  423. <Option
  424. value="2"
  425. style={{
  426. display: this.props.processState >= 3 ? "block" : "none"
  427. }}
  428. >
  429. 技术员
  430. </Option>
  431. <Option
  432. value="3"
  433. style={{
  434. display: this.props.processState >= 4 ? "block" : "none"
  435. }}
  436. >
  437. 技术经理
  438. </Option>
  439. <Option
  440. value="4"
  441. style={{
  442. display: this.props.processState >= 5 ? "block" : "none"
  443. }}
  444. >
  445. 技术总监
  446. </Option>
  447. <Option
  448. value="5"
  449. style={{
  450. display: this.props.processState >= 6 ? "block" : "none"
  451. }}
  452. >
  453. 财务专员(退单)
  454. </Option>
  455. <Option
  456. value="6"
  457. style={{
  458. display: this.props.processState >= 7 ? "block" : "none"
  459. }}
  460. >
  461. 财务总监
  462. </Option>
  463. <Option
  464. value="7"
  465. style={{
  466. display: this.props.processState >= 8 ? "block" : "none"
  467. }}
  468. >
  469. 总裁
  470. </Option>
  471. </Select>
  472. </div>
  473. ) : (
  474. ""
  475. )
  476. ) : (
  477. ""
  478. )}
  479. {/* <ReactToPrint
  480. trigger={() => (
  481. <div className="clearfix">
  482. <Button type="primary" style={{ float: "right", marginTop: 10 }}>
  483. 打印
  484. </Button>
  485. </div>
  486. )}
  487. content={() => this.refs}
  488. /> */}
  489. </div>
  490. );
  491. }
  492. }
  493. export { ChangeDetail };