changeDetailCwzj.js 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. import React, { Component } from "react";
  2. import { Form, Upload, Modal, Input } from "antd";
  3. import AgreeButton from "./agreeButton.js";
  4. import Rizhi from "./rizhi.js";
  5. import { getProcessStatusNew } from "@/tools.js";
  6. const formItemLayout = {
  7. labelCol: { span: 8 },
  8. wrapperCol: { span: 14 }
  9. };
  10. const changeType = [
  11. {
  12. value: "0",
  13. key: "退单退款"
  14. },
  15. {
  16. value: "1",
  17. key: "项目及金额变更"
  18. },
  19. {
  20. value: "2",
  21. key: "仅项目变更"
  22. },
  23. {
  24. value: "3",
  25. key: "仅金额变更"
  26. },
  27. {
  28. value: "4",
  29. key: "重报"
  30. },
  31. {
  32. value: "5",
  33. key: "赠送"
  34. }
  35. ];
  36. const getChangeType = function(e) {
  37. if (e || e == 0) {
  38. let str = e.toString();
  39. let theType = "";
  40. changeType.map(function(item) {
  41. if (item.value == str) {
  42. theType = item.key;
  43. }
  44. });
  45. return theType;
  46. }
  47. };
  48. class Itemlist extends Component {
  49. constructor(props) {
  50. super(props);
  51. }
  52. render() {
  53. let pageData = this.props.pageData;
  54. return (
  55. <div className="clearfix">
  56. <Form.Item
  57. label={pageData.labelA}
  58. {...pageData.formItemLayoutA}
  59. className="half-item"
  60. >
  61. <span>{pageData.dataA}</span>
  62. </Form.Item>
  63. <Form.Item
  64. label={pageData.labelB}
  65. {...pageData.formItemLayoutB}
  66. className="half-item"
  67. >
  68. <span>{pageData.dataB}</span>
  69. </Form.Item>
  70. </div>
  71. );
  72. }
  73. }
  74. class ItemInput extends Component {
  75. constructor(props) {
  76. super(props);
  77. this.state = {
  78. valueA: "",
  79. valueB: ""
  80. };
  81. }
  82. componentDidMount() {
  83. this.props.onRef(this);
  84. }
  85. reset() {
  86. this.setState({
  87. valueA: "",
  88. valueB: ""
  89. });
  90. }
  91. render() {
  92. let pageData = this.props.pageData;
  93. return (
  94. <div className="clearfix">
  95. <Form.Item
  96. label={pageData.labelA}
  97. {...pageData.formItemLayoutA}
  98. className="half-item"
  99. >
  100. <Input
  101. value={this.state.valueA}
  102. onChange={e => {
  103. this.setState({ valueA: e.target.value });
  104. pageData.onChangeA(e.target.value);
  105. }}
  106. />
  107. </Form.Item>
  108. <Form.Item
  109. label={pageData.labelB}
  110. {...pageData.formItemLayoutB}
  111. className="half-item"
  112. >
  113. <Input
  114. value={this.state.valueB}
  115. onChange={e => {
  116. this.setState({ valueB: e.target.value });
  117. pageData.onChangeB(e.target.value);
  118. }}
  119. />
  120. </Form.Item>
  121. </div>
  122. );
  123. }
  124. }
  125. class ChangeDetail extends Component {
  126. constructor(props) {
  127. super(props);
  128. this.state = {
  129. previewVisible: false,
  130. buttonStatus: true
  131. };
  132. this.getOrgCodeUrl = this.getOrgCodeUrl.bind(this);
  133. this.changeButtonStatus = this.changeButtonStatus.bind(this);
  134. }
  135. getOrgCodeUrl(e) {
  136. this.setState({
  137. orgCodeUrl: e
  138. });
  139. }
  140. //同意拒绝按钮的有无
  141. changeButtonStatus() {
  142. this.setState({
  143. buttonStatus: !this.state.buttonStatus
  144. });
  145. }
  146. onRef(ref) {
  147. this.fun = ref;
  148. }
  149. render() {
  150. const pageData = [
  151. {
  152. labelA: "客户名称",
  153. formItemLayoutA: formItemLayout,
  154. dataA: this.props.data.userName,
  155. labelB: "合同编号",
  156. formItemLayoutB: formItemLayout,
  157. dataB: this.props.data.contractNo
  158. },
  159. {
  160. labelA: "时间",
  161. formItemLayoutA: formItemLayout,
  162. dataA: this.props.data.createTimes,
  163. labelB: "发起人",
  164. formItemLayoutB: formItemLayout,
  165. dataB: this.props.data.applicant
  166. },
  167. {
  168. labelA: "当前进度",
  169. formItemLayoutA: formItemLayout,
  170. dataA: this.props.data.processStateText,
  171. labelB: "变更类型",
  172. formItemLayoutB: formItemLayout,
  173. dataB: getChangeType(this.props.data.type)
  174. },
  175. {
  176. labelA: "合同额(万元)",
  177. formItemLayoutA: formItemLayout,
  178. dataA: this.props.data.totalAmount,
  179. labelB: "已收款(万元)",
  180. formItemLayoutB: formItemLayout,
  181. dataB: this.props.data.settlementAmount
  182. },
  183. {
  184. labelA: "欠款(万元)",
  185. formItemLayoutA: formItemLayout,
  186. dataA: this.props.data.arrears,
  187. labelB: "申请退款(万元)",
  188. formItemLayoutB: formItemLayout,
  189. dataB: this.props.data.changeAmount
  190. },
  191. {
  192. labelA: "备注",
  193. formItemLayoutA: formItemLayout,
  194. dataA: this.props.data.remarks
  195. }
  196. ];
  197. const planData = [
  198. {
  199. labelA: "项目进度",
  200. formItemLayoutA: formItemLayout,
  201. dataA: this.props.data.projectState,
  202. onChangeA: value => {
  203. this.setState({
  204. projectState: value
  205. });
  206. },
  207. labelB: "发生成本费用(万元)",
  208. formItemLayoutB: formItemLayout,
  209. dataB: this.props.data.zxsCost,
  210. onChangeB: value => {
  211. this.setState({
  212. zxsCost: value
  213. });
  214. }
  215. },
  216. {
  217. labelA: "备注",
  218. formItemLayoutA: formItemLayout,
  219. dataA: this.props.data.zxsRemarks,
  220. onChangeA: value => {
  221. this.setState({
  222. zxsRemarks: value
  223. });
  224. }
  225. }
  226. ];
  227. const financeData = [
  228. {
  229. labelA: "收款时间",
  230. formItemLayoutA: formItemLayout,
  231. dataA: this.props.data.paymentTimes,
  232. labelB: "收款金额(万元)",
  233. formItemLayoutB: formItemLayout,
  234. dataB: this.props.data.paymentAmount
  235. },
  236. {
  237. labelA: "开票时间",
  238. formItemLayoutA: formItemLayout,
  239. dataA: this.props.data.invoiceTimes,
  240. labelB: "已开票金额(万元)",
  241. formItemLayoutB: formItemLayout,
  242. dataB: this.props.data.invoiceAmount
  243. },
  244. {
  245. labelA: "发生成本(万元)",
  246. formItemLayoutA: formItemLayout,
  247. dataA: this.props.data.cwCost,
  248. labelB: "应退金额(万元)",
  249. formItemLayoutB: formItemLayout,
  250. dataB: this.props.data.refundableAmount
  251. },
  252. {
  253. labelA: "补充资料/备注",
  254. formItemLayoutA: formItemLayout,
  255. dataA: this.props.data.cwRemarks
  256. }
  257. ];
  258. const buttonData = [
  259. {
  260. name: "同意",
  261. title: "理由",
  262. placeholder: "请输入理由",
  263. type: "primary",
  264. status: 2,
  265. onChange: value => {
  266. this.setState({
  267. remarks: value
  268. });
  269. }
  270. },
  271. {
  272. name: "拒绝",
  273. title: "理由",
  274. placeholder: "请输入理由",
  275. type: "danger",
  276. status: 3,
  277. onChange: value => {
  278. this.setState({
  279. remarks: value
  280. });
  281. }
  282. }
  283. ];
  284. const orgCodeUrl = this.props.pictureUrl;
  285. console.log(this.props.processState === this.props.data.processState);
  286. return (
  287. <div>
  288. {pageData.map((item, index) => {
  289. return <Itemlist key={index} pageData={item} />;
  290. })}
  291. <Form.Item
  292. label="变更凭证"
  293. labelCol={{ span: 4 }}
  294. wrapperCol={{ span: 18 }}
  295. >
  296. <Upload
  297. className="demandDetailShow-upload"
  298. listType="picture-card"
  299. fileList={orgCodeUrl}
  300. onPreview={file => {
  301. this.setState({
  302. previewImage: file.url || file.thumbUrl,
  303. previewVisible: true
  304. });
  305. }}
  306. />
  307. <Modal
  308. maskClosable={false}
  309. footer={null}
  310. visible={this.state.previewVisible}
  311. onCancel={() => {
  312. this.setState({ previewVisible: false }, () => {
  313. this.foo.reset();
  314. });
  315. }}
  316. >
  317. <img
  318. alt=""
  319. style={{ width: "100%" }}
  320. src={this.state.previewImage || ""}
  321. />
  322. </Modal>
  323. <Rizhi changeId={this.props.data.id} />
  324. </Form.Item>
  325. {this.props.data.type === 0 && this.props.data.processState >= 4 ? (
  326. <div>
  327. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  328. 当前项目进度(咨询师经理填写)
  329. </h3>
  330. {planData.map((item, index) => {
  331. return <Itemlist key={index} pageData={item} />;
  332. })}
  333. </div>
  334. ) : (
  335. ""
  336. )}
  337. {this.props.data.type === 0 ? (
  338. this.props.data.processState >= 5 ? (
  339. <div>
  340. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  341. 当前财务状态(财务填写)
  342. </h3>
  343. {financeData.map((item, index) => {
  344. return <Itemlist key={index} pageData={item} />;
  345. })}
  346. </div>
  347. ) : (
  348. ""
  349. )
  350. ) : this.props.data.status === 4 ? (
  351. <div>
  352. <h3 style={{ marginLeft: 10, fontWeight: 800, marginBottom: 10 }}>
  353. 当前财务状态(财务填写)
  354. </h3>
  355. {financeData.map((item, index) => {
  356. return <Itemlist key={index} pageData={item} />;
  357. })}
  358. </div>
  359. ) : (
  360. ""
  361. )}
  362. {this.props.data.status !== 4 ? (
  363. this.state.buttonStatus ? (
  364. <div
  365. className="clearfix"
  366. style={{ display: "flex", justifyContent: "space-around" }}
  367. >
  368. {buttonData.map((item, index) => {
  369. return (
  370. <AgreeButton
  371. data={item}
  372. key={index}
  373. backData={this.props.data}
  374. processState={this.props.processState}
  375. visible={this.changeButtonStatus}
  376. loadData={this.props.loadData}
  377. />
  378. );
  379. })}
  380. </div>
  381. ) : (
  382. ""
  383. )
  384. ) : (
  385. ""
  386. )}
  387. </div>
  388. );
  389. }
  390. }
  391. export { ChangeDetail };