changeApply.js 63 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202
  1. import React, { Component } from "react";
  2. import {
  3. Form,
  4. Select,
  5. Input,
  6. Button,
  7. message,
  8. Spin,
  9. Tag,
  10. Table,
  11. Col,
  12. Popconfirm,
  13. Modal,
  14. AutoComplete
  15. } from "antd";
  16. import $ from "jquery/src/ajax";
  17. import ResolutionDetail from "@/resolutionDetail";
  18. import PicturesWall from "./picturesWall";
  19. import Rizhi from "./rizhi";
  20. import {
  21. cuiJieDian,
  22. orderTypes,
  23. customerType,
  24. jiedian,
  25. tepi,
  26. boutique
  27. } from "@/dataDic.js";
  28. import { moneyVerify } from "@/tools.js"
  29. const FormItem = Form.Item;
  30. const confirm = Modal.confirm;
  31. const Option = AutoComplete.Option;
  32. const formItemLayout = {
  33. labelCol: { span: 8 },
  34. wrapperCol: { span: 14 }
  35. };
  36. class ChangeApply extends Component {
  37. constructor(props) {
  38. super(props);
  39. this.state = {
  40. data: {},
  41. voucherUrl: [],
  42. dataSource: [],
  43. cuiDataSource: [],
  44. changeCuiList: [
  45. {
  46. title: "变更状态",
  47. dataIndex: "type",
  48. key: "type",
  49. render: text => {
  50. let str = "";
  51. let color = "";
  52. if (text == 1) {
  53. str = "增";
  54. color = "#87d068";
  55. } else if (text == 2) {
  56. str = "改";
  57. color = "#108ee9";
  58. } else if (text == 3) {
  59. str = "删";
  60. color = "#f50";
  61. }
  62. return (
  63. <Tag
  64. color={color}
  65. style={{ display: text == 0 ? "none" : "inline-block" }}
  66. >
  67. {str}
  68. </Tag>
  69. );
  70. }
  71. },
  72. {
  73. title: "项目名称",
  74. dataIndex: "commodityName",
  75. key: "commodityName",
  76. render: (text, record, index) => {
  77. let dataArr = this.state.proDataSource || [];
  78. if (text) {
  79. return <span>{text}</span>;
  80. }
  81. return (
  82. <Select
  83. placeholder="请选择名称"
  84. style={{ width: "150px" }}
  85. disabled={this.state.getLoad && record.sortName ? true : false}
  86. onChange={e => {
  87. record.sortName = e;
  88. dataArr.forEach(item => {
  89. if (item.commodityName == record.sortName) {
  90. record.cname = item.cname;
  91. record.ctid = item.id;
  92. record.isSave = true;
  93. record.sort = item.cSort;
  94. cuiJieDian.forEach(item => {
  95. if (item.value == record.sort) {
  96. record.arr = item.children;
  97. let yearFlag = true;
  98. if (record.sort == 6) {
  99. yearFlag = false;
  100. }
  101. this.setState({
  102. getLoad: true,
  103. yearFlag
  104. });
  105. }
  106. });
  107. }
  108. });
  109. }}
  110. >
  111. {dataArr.map((item,index) => {
  112. if (item.type == 3) {
  113. return (
  114. <Select.Option key={item.id} value={item.commodityName} disabled>
  115. {item.commodityName}
  116. </Select.Option>
  117. );
  118. }else {
  119. return (
  120. <Select.Option key={item.id} value={item.commodityName}>
  121. {item.commodityName}
  122. </Select.Option>
  123. );
  124. }
  125. })}
  126. </Select>
  127. );
  128. }
  129. },
  130. {
  131. title: "项目分类",
  132. dataIndex: "projectType",
  133. key: "projectType",
  134. render: (text, record) => {
  135. if (text) {
  136. let arr = this.state.proDataSource || [];
  137. let str = "";
  138. for (let i = 0; i < arr.length; i++) {
  139. if (this.state.proDataSource[i].cSort == text) {
  140. str = this.state.proDataSource[i].cname;
  141. return <span>{str}</span>;
  142. }
  143. }
  144. }
  145. if (this.state.getLoad) {
  146. return (
  147. <Select
  148. style={{ width: "150px" }}
  149. placeholder="请选择分类"
  150. value={record.cname}
  151. >
  152. <Select.Option key={record.sort} value={record.cname}>
  153. {record.cname}
  154. </Select.Option>
  155. </Select>
  156. );
  157. } else {
  158. return (
  159. <Select style={{ width: "150px" }} placeholder="请选择分类">
  160. <Select.Option key={record.sort} value={record.cname}>
  161. {record.cname}
  162. </Select.Option>
  163. </Select>
  164. );
  165. }
  166. }
  167. },
  168. {
  169. title: "催款科目",
  170. dataIndex: "dunTypeName",
  171. key: "dunTypeName",
  172. render: (text, record) => {
  173. if (text) {
  174. return <span>{text}</span>;
  175. }
  176. if (this.state.getLoad) {
  177. let arr = record.arr || [];
  178. return (
  179. <Select
  180. style={{ width: "150px" }}
  181. placeholder="请选择分类"
  182. onChange={e => {
  183. record.dunType = e;
  184. if (e != 1) {
  185. this.setState({
  186. timeFlag: true
  187. });
  188. } else {
  189. this.setState({
  190. timeFlag: false
  191. });
  192. }
  193. if (e == 1 && record.sort == 6) {
  194. this.setState({
  195. yearFlag: true
  196. });
  197. } else if (e != 1 && record.sort == 6) {
  198. this.setState({
  199. yearFlag: false
  200. });
  201. }
  202. if (record.sort == 3 && e == 3) {
  203. this.setState({
  204. boFlag: true
  205. });
  206. } else {
  207. this.setState({
  208. boFlag: false
  209. });
  210. }
  211. }}
  212. >
  213. {arr.map(item => {
  214. record;
  215. return (
  216. <Select.Option key={item.value} value={item.value}>
  217. {item.key}
  218. </Select.Option>
  219. );
  220. })}
  221. </Select>
  222. );
  223. } else {
  224. return (
  225. <Select style={{ width: "150px" }} placeholder="请选择分类">
  226. <Select.Option key={0} value={"请选择上一项"}></Select.Option>
  227. </Select>
  228. );
  229. }
  230. }
  231. },
  232. {
  233. title: "首付时间(特批需选择时间)",
  234. dataIndex: "waitDay",
  235. key: "waitDay",
  236. render: (text, record) => {
  237. if (record.dunTypeName) {
  238. if (text == 0) {
  239. var str = "当天";
  240. } else if (!text) {
  241. var str = "";
  242. } else {
  243. var str = text + "天";
  244. }
  245. return <span>{str}</span>;
  246. }
  247. return (
  248. <Select
  249. placeholder="请选择时间"
  250. style={{ width: "150px" }}
  251. disabled={
  252. this.state.approval != 0 && !this.state.timeFlag
  253. ? false
  254. : true
  255. }
  256. onChange={e => {
  257. record.waitDay = e;
  258. }}
  259. >
  260. <Select.Option key={0}>当天</Select.Option>
  261. <Select.Option key={3}>3天</Select.Option>
  262. <Select.Option key={5}>5天</Select.Option>
  263. <Select.Option key={7}>7天</Select.Option>
  264. <Select.Option key={15}>15天</Select.Option>
  265. </Select>
  266. );
  267. }
  268. },
  269. {
  270. title: "金额(万元)",
  271. dataIndex: "money",
  272. key: "money",
  273. render: (text, record) => {
  274. if (record.dunTypeName) {
  275. if (record.appropriationRatio && !record.money) {
  276. return <span>{record.appropriationRatio}(拨款比例)</span>;
  277. } else if (record.appropriationRatio && record.money) {
  278. return (
  279. <span>
  280. {text}(比例:{record.appropriationRatio})
  281. </span>
  282. );
  283. } else {
  284. return <span>{text}</span>;
  285. }
  286. }
  287. if (this.state.boFlag) {
  288. return (
  289. <div>
  290. <div style={{ width: 70, float: "left", marginRight: 5 }}>
  291. <Select
  292. placeholder="选择"
  293. defaultValue={"金额"}
  294. onChange={e => {
  295. record.boStatus = e;
  296. }}
  297. >
  298. <Select.Option key={true}>比例</Select.Option>
  299. <Select.Option key={false}>金额</Select.Option>
  300. </Select>
  301. </div>
  302. <div style={{ float: "right" }}>
  303. <Input
  304. value={record.money}
  305. placeholder="请根据左侧类型填写"
  306. key={record.id}
  307. required="required"
  308. onChange={e => {
  309. record.money = e.target.value;
  310. this.setState({
  311. contactList: this.state.contactList
  312. });
  313. }}
  314. style={{ width: "120px" }}
  315. />
  316. </div>
  317. </div>
  318. );
  319. } else {
  320. return (
  321. <div>
  322. <Input
  323. value={record.money}
  324. placeholder="请输入金额(必填项)"
  325. key={record.id}
  326. required="required"
  327. onChange={e => {
  328. record.money = e.target.value;
  329. this.setState({ contactList: this.state.contactList });
  330. }}
  331. style={{ width: "120px" }}
  332. />
  333. </div>
  334. );
  335. }
  336. }
  337. },
  338. {
  339. title: "服务年限",
  340. dataIndex: "startDate",
  341. key: "startDate",
  342. render: (text, record) => {
  343. if (record.dunTypeName) {
  344. return <span>{text}</span>;
  345. }
  346. return (
  347. <Select
  348. placeholder="请选择年限"
  349. style={{ width: "150px" }}
  350. disabled={this.state.yearFlag ? true : false}
  351. onChange={e => {
  352. record.effectiveCount = e;
  353. }}
  354. >
  355. {/* <Select.Option key={null}>无</Select.Option> */}
  356. <Select.Option key={1}>一年</Select.Option>
  357. <Select.Option key={3}>两年</Select.Option>
  358. <Select.Option key={5}>三年</Select.Option>
  359. <Select.Option key={7}>四年</Select.Option>
  360. <Select.Option key={9}>五年</Select.Option>
  361. </Select>
  362. );
  363. }
  364. },
  365. {
  366. title: "催款状态",
  367. dataIndex: "status",
  368. key: "status",
  369. render: text => {
  370. return <span>{text == 1 ? "已启动" : "未启动"}</span>;
  371. }
  372. },
  373. {
  374. title: "操作",
  375. dataIndex: "dels",
  376. key: "dels",
  377. render: (text, record, index) => {
  378. return (
  379. <div>
  380. <Popconfirm
  381. title="是否删除?"
  382. onConfirm={() => {
  383. this.changeDeleteCui(record);
  384. }}
  385. okText="删除"
  386. cancelText="不删除"
  387. >
  388. <Button
  389. disabled={this.state.listCuiFlag}
  390. style={{
  391. marginRight: "10px",
  392. display: this.state.displayList ? "none" : "block"
  393. }}
  394. >
  395. 删除
  396. </Button>
  397. </Popconfirm>
  398. {record.isSave ? (
  399. <Button
  400. type="primary"
  401. onClick={e => {
  402. this.changeSaveCui(record);
  403. }}
  404. >
  405. 保存
  406. </Button>
  407. ) : (
  408. ""
  409. )}
  410. </div>
  411. );
  412. }
  413. }
  414. ],
  415. resVisible: false,
  416. proColumns: [
  417. {
  418. title: "变更状态",
  419. dataIndex: "type",
  420. key: "type",
  421. render: (text, record) => {
  422. let str = "";
  423. let color = "";
  424. if (text == 1) {
  425. str = "增";
  426. color = "#87d068";
  427. } else if (text == 2) {
  428. str = "改";
  429. color = "#108ee9";
  430. } else if (text == 3) {
  431. str = "删";
  432. color = "#f50";
  433. }
  434. return (
  435. <span>
  436. <Tag
  437. color={color}
  438. style={{ display: text == 0 ? "none" : "inline-block" }}
  439. >
  440. {str}
  441. </Tag>
  442. {record.splitStatus == 1 ? (
  443. <Tag
  444. color="#108ee9"
  445. // onClick={e => {
  446. // e.stopPropagation();
  447. // this.showRes(record);
  448. // }}
  449. >
  450. 父项目
  451. </Tag>
  452. ) : (
  453. ""
  454. )}
  455. {record.splitStatus == 2 ? (
  456. <Tag
  457. color="#108ee9"
  458. // onClick={e => {
  459. // e.stopPropagation();
  460. // this.showRes(record);
  461. // }}
  462. >
  463. 子项目
  464. </Tag>
  465. ) : (
  466. ""
  467. )}
  468. </span>
  469. );
  470. }
  471. },
  472. {
  473. title: "业务项目名称",
  474. dataIndex: "commodityName",
  475. key: "commodityName"
  476. },
  477. {
  478. title: "项目类别",
  479. dataIndex: "cname",
  480. key: "cname"
  481. },
  482. {
  483. title: "项目数量",
  484. dataIndex: "commodityQuantity",
  485. key: "commodityQuantity"
  486. },
  487. {
  488. title: "金额(万元)",
  489. dataIndex: "commodityPrice",
  490. key: "commodityPrice",
  491. render: (text, record) => {
  492. if (record.splitStatus == 2) {
  493. return "/";
  494. } else {
  495. return text;
  496. }
  497. }
  498. },
  499. {
  500. title: "主要项目",
  501. dataIndex: "main",
  502. key: "main",
  503. render: text => {
  504. return text ? "是" : "否";
  505. }
  506. },
  507. {
  508. title: "项目负责人",
  509. dataIndex: "receiverName",
  510. key: "receiverName"
  511. },
  512. {
  513. title: "项目说明",
  514. dataIndex: "taskComment",
  515. key: "taskComment",
  516. render: text => {
  517. return text && text.length > 8 ? text.substr(0, 8) + "…" : text;
  518. }
  519. },
  520. {
  521. title: "操作",
  522. dataIndex: "ABC",
  523. key: "ABC",
  524. render: (text, record) => {
  525. return (
  526. <div>
  527. <Button
  528. onClick={e => {
  529. e.stopPropagation();
  530. this.showConfirm(this.changeDeletePro, record);
  531. }}
  532. disabled={this.state.listFlag}
  533. style={{
  534. display: this.state.displayList ? "none" : "block"
  535. }}
  536. >
  537. 删除
  538. </Button>
  539. </div>
  540. );
  541. }
  542. }
  543. ]
  544. };
  545. this.departmentList = this.departmentList.bind(this);
  546. this.changeApply = this.changeApply.bind(this);
  547. this.getVoucherUrl = this.getVoucherUrl.bind(this);
  548. this.proList = this.proList.bind(this);
  549. this.cuiList = this.cuiList.bind(this);
  550. this.showConfirm = this.showConfirm.bind(this);
  551. this.changeAddPro = this.changeAddPro.bind(this);
  552. this.changeProSubmit = this.changeProSubmit.bind(this);
  553. this.changeDeletePro = this.changeDeletePro.bind(this);
  554. this.changeAddCui = this.changeAddCui.bind(this);
  555. this.changeDeleteCui = this.changeDeleteCui.bind(this);
  556. this.changeSaveCui = this.changeSaveCui.bind(this);
  557. this.submitChange = this.submitChange.bind(this);
  558. this.editCui = this.editCui.bind(this);
  559. this.editPro = this.editPro.bind(this);
  560. this.submitEditCui = this.submitEditCui.bind(this);
  561. this.submitEditPro = this.submitEditPro.bind(this);
  562. this.nextCancel = this.nextCancel.bind(this);
  563. this.customerChange = this.customerChange.bind(this);
  564. this.selectAuto = this.selectAuto.bind(this);
  565. this.supervisor = this.supervisor.bind(this);
  566. this.httpChange = this.httpChange.bind(this);
  567. this.showRes = this.showRes.bind(this);
  568. this.resCancel = this.resCancel.bind(this);
  569. }
  570. componentDidMount() {
  571. // this.setState({
  572. // data: this.props.orderData
  573. // },() => {
  574. // this.proList();
  575. // this.cuiList();
  576. // })
  577. }
  578. nextCancel() {
  579. this.setState({
  580. addnextVisible: false,
  581. changeVisible: false
  582. });
  583. }
  584. showConfirm(fn, record) {
  585. confirm({
  586. title: "确定删除此项目吗?",
  587. content: (
  588. <span style={{ color: "red" }}>
  589. 删除后会将该项目下的所有催款节点自动清除!!!
  590. </span>
  591. ),
  592. onOk() {
  593. fn(record);
  594. },
  595. onCancel() { }
  596. });
  597. }
  598. //服务值改变时请求客户名称
  599. httpChange(e) {
  600. this.state.gid = "";
  601. if (e.length >= 1) {
  602. this.supervisor(e, false);
  603. }
  604. this.setState({
  605. commodityName: e
  606. });
  607. }
  608. //客户名称自动补全
  609. customerChange(e) {
  610. if (this.state.customType) {
  611. this.state.autoId = "";
  612. if (e.length >= 2) {
  613. this.supervisor(e, true);
  614. }
  615. this.setState({
  616. customerName: e
  617. });
  618. } else {
  619. this.setState({
  620. customerName: ""
  621. });
  622. message.warning("客户所属类型必须指定");
  623. }
  624. }
  625. //上级主管输入框失去焦点是判断客户是否存在
  626. selectAuto(value) {
  627. let kid = [];
  628. let fwList = this.state.customerArr;
  629. fwList.map(function (item) {
  630. if (value == item.bname) {
  631. kid = item;
  632. }
  633. });
  634. this.setState({
  635. commodityName: value,
  636. gid: kid.id,
  637. //commodityPrice:kid.price==0?kid.price.toString():kid.price,
  638. commodityFirstPayment:
  639. kid.firstPayment == 0 ? kid.firstPayment.toString() : kid.firstPayment
  640. });
  641. }
  642. //加载(自动补全)
  643. supervisor(e, state) {
  644. //客户名称与服务名称自动补全
  645. let api = state
  646. ? "/api/admin/customer/getCustomerByName"
  647. : "/api/admin/order/getBusinessProjectByName";
  648. $.ajax({
  649. method: "get",
  650. dataType: "json",
  651. crossDomain: false,
  652. url: globalConfig.context + api,
  653. data: state
  654. ? {
  655. name: e,
  656. type: this.state.customType
  657. }
  658. : {
  659. businessName: e
  660. },
  661. success: function (data) {
  662. let thedata = data.data;
  663. if (!thedata) {
  664. if (data.error && data.error.length) {
  665. message.warning(data.error[0].message);
  666. }
  667. thedata = {};
  668. }
  669. this.setState({
  670. states: state,
  671. customerArr: thedata
  672. });
  673. }.bind(this)
  674. }).always(
  675. function () {
  676. this.setState({
  677. loading: false
  678. });
  679. }.bind(this)
  680. );
  681. }
  682. //变更申请
  683. changeApply() {
  684. if (this.state.flag) return;
  685. this.setState({
  686. flag: true
  687. });
  688. if (moneyVerify(this.state.data.totalAmount)) {
  689. return false;
  690. }
  691. if (moneyVerify(this.state.data.changeAmount)) {
  692. return false;
  693. }
  694. let theorgCodeUrl = [];
  695. if (this.state.voucherUrl.length) {
  696. let picArr = [];
  697. this.state.voucherUrl.map(function (item) {
  698. if (item.response && item.response.data && item.response.data.length) {
  699. picArr.push(item.response.data);
  700. }
  701. });
  702. theorgCodeUrl = picArr.join(",");
  703. }
  704. Object.assign(this.state.data, {
  705. id: this.props.orderData.id, //订单编号
  706. changeType: 0,
  707. voucherUrl: theorgCodeUrl.length ? theorgCodeUrl : "",
  708. consultantExamine: [],
  709. managerExamine: []
  710. });
  711. $.ajax({
  712. method: "post",
  713. dataType: "json",
  714. crossDomain: false,
  715. url: globalConfig.context + "/api/admin/orderChange/updateOrderChange",
  716. data: this.state.data
  717. }).done(
  718. function (data) {
  719. if (!data.error.length) {
  720. message.success("变更成功!");
  721. this.props.onCancel();
  722. this.setState({
  723. flag: false
  724. });
  725. this.setState({
  726. loading: false
  727. });
  728. } else {
  729. message.warning(data.error[0].message);
  730. this.setState({
  731. flag: false
  732. });
  733. this.setState({
  734. loading: false
  735. });
  736. }
  737. }.bind(this)
  738. );
  739. }
  740. // componentDidMount() {
  741. // window.setTimeout(() => {
  742. // this.loadDataChange();
  743. // }, 10);
  744. // }
  745. // loadDataChange() {
  746. // console.log(this.props);
  747. // $.ajax({
  748. // method: "get",
  749. // dataType: "json",
  750. // crossDomain: false,
  751. // url: globalConfig.context + "/api/admin/orderChange/orderChangeLogList",
  752. // data: {
  753. // changeId: this.props.data.id
  754. // },
  755. // success: function(data) {
  756. // if (data.error.length || data.data.list == "") {
  757. // if (data.error && data.error.length) {
  758. // message.warning(data.error[0].message);
  759. // }
  760. // } else {
  761. // this.setState({
  762. // dataSource: data.data
  763. // });
  764. // }
  765. // }.bind(this)
  766. // });
  767. // }
  768. // 拆分详细
  769. showRes(record) {
  770. this.setState({
  771. resVisible: true,
  772. resRecord: record
  773. })
  774. }
  775. resCancel() {
  776. this.setState({
  777. resVisible: false
  778. })
  779. }
  780. cuiList(id) {
  781. $.ajax({
  782. method: "get",
  783. dataType: "json",
  784. crossDomain: false,
  785. url: globalConfig.context + "/api/admin/orderChange/selectChangeDun",
  786. data: {
  787. id: id || this.state.data.id
  788. },
  789. success: function (data) {
  790. if (data.data && data.data.length) {
  791. if (id) {
  792. this.setState({
  793. listCuiFlag: true
  794. });
  795. }
  796. this.setState({
  797. cuiDataSource: data.data
  798. });
  799. }
  800. }.bind(this)
  801. });
  802. }
  803. proList(id) {
  804. $.ajax({
  805. method: "get",
  806. dataType: "json",
  807. crossDomain: false,
  808. url: globalConfig.context + "/api/admin/orderChange/selectChangeTask",
  809. data: {
  810. id: id || this.state.data.id
  811. },
  812. success: function (data) {
  813. if (data.data && data.data.length) {
  814. if (id) {
  815. this.setState({
  816. listFlag: true
  817. });
  818. }
  819. data.data.forEach(item => {
  820. item.key = item.id
  821. })
  822. this.setState({
  823. proDataSource: data.data
  824. });
  825. }
  826. }.bind(this)
  827. });
  828. }
  829. departmentList() {
  830. $.ajax({
  831. method: "get",
  832. dataType: "json",
  833. crossDomain: false,
  834. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  835. data: {},
  836. success: function (data) {
  837. let thedata = data.data;
  838. let theArr = [];
  839. if (!thedata) {
  840. if (data.error && data.error.length) {
  841. message.warning(data.error[0].message);
  842. }
  843. } else {
  844. thedata.map(function (item, index) {
  845. theArr.push({
  846. key: index,
  847. name: item.name,
  848. id: item.id
  849. });
  850. });
  851. }
  852. this.setState({
  853. departmentArr: theArr
  854. });
  855. }.bind(this)
  856. });
  857. }
  858. getVoucherUrl(e) {
  859. this.setState({
  860. voucherUrl: e
  861. });
  862. }
  863. changeAddPro() {
  864. this.setState({
  865. changeVisible: true,
  866. gid: "",
  867. customerArr: [],
  868. commodityName: "",
  869. commodityQuantity: "",
  870. commodityId: "",
  871. taskComment: "",
  872. main: undefined,
  873. commodityPrice: ""
  874. });
  875. }
  876. changeProSubmit() {
  877. if (this.state.gid == undefined || !this.state.gid) {
  878. message.warning("服务名称不匹配!");
  879. return false;
  880. }
  881. if (!this.state.commodityPrice) {
  882. message.warning("请输入金额!");
  883. this.refs.commodityPrice.focus();
  884. return false;
  885. }
  886. let reg = /^([0]|[1-9][0-9]*)$/;
  887. if (
  888. !this.state.commodityQuantity ||
  889. !reg.test(this.state.commodityQuantity)
  890. ) {
  891. message.warning("请输入正确商品数量!");
  892. this.refs.commodityQuantity.focus();
  893. return false;
  894. }
  895. if (!this.state.main) {
  896. message.warning("请选择是否为主要项目!");
  897. this.refs.commodityQuantity.focus();
  898. return false;
  899. }
  900. this.setState({
  901. loading: true
  902. });
  903. let type = 0;
  904. if (this.state.typeChange == 4 || this.state.typeChange == 5) {
  905. type = 1;
  906. }
  907. $.ajax({
  908. method: "post",
  909. dataType: "json",
  910. crossDomain: false,
  911. url: globalConfig.context + "/api/admin/orderChange/addChangeTask",
  912. data: {
  913. commodityId: this.state.gid, //商品ID
  914. orderNo: this.state.data.orderNo, //订单编号
  915. commodityName: this.state.commodityName, //商品名称
  916. commodityQuantity: this.state.commodityQuantity, //商品数量
  917. commodityPrice: this.state.commodityPrice, //签单总价
  918. taskComment: this.state.taskComment, //服务说明
  919. main: this.state.main, //是否为主要项目
  920. cid: this.state.data.id, //变更ID
  921. type
  922. },
  923. success: function (data) {
  924. let theArr = [];
  925. if (data.error && data.error.length) {
  926. message.warning(data.error[0].message);
  927. } else {
  928. message.success("保存成功");
  929. this.nextCancel();
  930. this.proList();
  931. }
  932. }.bind(this)
  933. }).always(
  934. function () {
  935. this.setState({
  936. loading: false
  937. });
  938. }.bind(this)
  939. );
  940. }
  941. changeDeletePro(record) {
  942. this.setState({
  943. loading: true
  944. });
  945. $.ajax({
  946. method: "post",
  947. dataType: "json",
  948. crossDomain: false,
  949. url: globalConfig.context + "/api/admin/orderChange/updateChangeTask",
  950. data: {
  951. id: record.id,
  952. type: 3,
  953. tid: record.tid,
  954. splitStatus: record.splitStatus
  955. },
  956. success: function (data) {
  957. let theArr = [];
  958. if (data.error && data.error.length) {
  959. message.warning(data.error[0].message);
  960. } else {
  961. message.success("删除成功");
  962. this.proList();
  963. this.cuiList();
  964. }
  965. }.bind(this)
  966. }).always(
  967. function () {
  968. this.setState({
  969. loading: false
  970. });
  971. }.bind(this)
  972. );
  973. }
  974. //点击新增变更催款节点
  975. changeAddCui() {
  976. this.state.cuiDataSource.push({
  977. key: this.state.cuiDataSource.length,
  978. money: "",
  979. dunSubject: undefined,
  980. orderNo: this.state.data.orderNo,
  981. dunTarget: this.state.kehuId
  982. });
  983. this.setState({
  984. cuiDataSource: this.state.cuiDataSource,
  985. cuiFlag: true
  986. });
  987. }
  988. //删除变更收款节点
  989. changeDeleteCui(index) {
  990. if (index.id) {
  991. this.state.cuiDataSource.splice(index.id, 1);
  992. this.setState({
  993. contactListNew: this.state.cuiDataSource,
  994. cuiFlag: false,
  995. addFlag: false,
  996. boFlag: false
  997. });
  998. $.ajax({
  999. url: globalConfig.context + "/api/admin/orderChange/updateChangeDun",
  1000. method: "post",
  1001. data: {
  1002. id: index.id,
  1003. type: 3,
  1004. tid: index.tid
  1005. }
  1006. }).done(
  1007. function (data) {
  1008. this.setState({
  1009. loading: false
  1010. });
  1011. if (!data.error.length) {
  1012. message.success("删除成功!");
  1013. this.setState({
  1014. cuiFlag: false
  1015. });
  1016. this.cuiList();
  1017. } else {
  1018. message.warning(data.error[0].message);
  1019. }
  1020. }.bind(this)
  1021. );
  1022. } else {
  1023. this.state.cuiDataSource.splice(index.key, 1);
  1024. this.setState({
  1025. cuiDataSource: this.state.cuiDataSource,
  1026. cuiFlag: false,
  1027. addFlag: false,
  1028. boFlag: false
  1029. });
  1030. }
  1031. }
  1032. changeSaveCui(record) {
  1033. if (record.boStatus == "false") {
  1034. record.boStatus = false;
  1035. } else if (record.boStatus == "true") {
  1036. record.boStatus = true;
  1037. }
  1038. if (!this.state.yearFlag) {
  1039. if (!record.effectiveCount) {
  1040. message.warning("请选择服务年限");
  1041. return;
  1042. }
  1043. } else {
  1044. record.effectiveCount = "";
  1045. }
  1046. if (record.money == "") {
  1047. message.warning("请填写金额");
  1048. return;
  1049. }
  1050. if (record.boStatus) {
  1051. if (
  1052. typeof +record.money == "number" &&
  1053. +record.money >= 0 &&
  1054. +record.money <= 1
  1055. ) {
  1056. record.appropriationRatio = record.money;
  1057. } else {
  1058. message.warning("金额比例填写错误,比例范围0~1");
  1059. return;
  1060. }
  1061. }
  1062. if (!record.dunType) {
  1063. message.warning("请选择对应科目");
  1064. return;
  1065. }
  1066. if (record.dunType != 1) {
  1067. record.waitDay = "";
  1068. }
  1069. this.setState({
  1070. loading: true
  1071. });
  1072. if (record.boStatus) {
  1073. $.ajax({
  1074. url: globalConfig.context + "/api/admin/orderChange/addChangeDun",
  1075. method: "post",
  1076. data: {
  1077. orderNo: record.orderNo,
  1078. ctid: record.ctid,
  1079. projectType: record.sort,
  1080. dunType: record.dunType,
  1081. appropriationRatio: record.appropriationRatio,
  1082. waitDay: record.waitDay,
  1083. effectiveCount: record.effectiveCount,
  1084. cid: this.state.data.id //变更ID
  1085. }
  1086. }).done(
  1087. function (data) {
  1088. this.setState({
  1089. loading: false
  1090. });
  1091. if (!data.error.length) {
  1092. message.success("保存成功!");
  1093. this.setState({
  1094. cuiFlag: false,
  1095. boFlag: false,
  1096. addFlag: false
  1097. });
  1098. this.cuiList();
  1099. } else {
  1100. message.warning(data.error[0].message);
  1101. }
  1102. }.bind(this)
  1103. );
  1104. } else {
  1105. $.ajax({
  1106. url: globalConfig.context + "/api/admin/orderChange/addChangeDun",
  1107. method: "post",
  1108. data: {
  1109. orderNo: record.orderNo,
  1110. ctid: record.ctid,
  1111. projectType: record.sort,
  1112. dunType: record.dunType,
  1113. money: record.money,
  1114. waitDay: record.waitDay,
  1115. effectiveCount: record.effectiveCount,
  1116. cid: this.state.data.id //变更ID
  1117. }
  1118. }).done(
  1119. function (data) {
  1120. this.setState({
  1121. loading: false
  1122. });
  1123. if (!data.error.length) {
  1124. message.success("保存成功!");
  1125. this.setState({
  1126. cuiFlag: false,
  1127. boFlag: false,
  1128. addFlag: false
  1129. });
  1130. this.cuiList();
  1131. } else {
  1132. message.warning(data.error[0].message);
  1133. }
  1134. }.bind(this)
  1135. );
  1136. }
  1137. }
  1138. submitChange() {
  1139. if (this.state.processStatus <= 4) {
  1140. message.warning("当前订单流程不能发起变更!");
  1141. return false;
  1142. }
  1143. if (this.state.changeAmount === "") {
  1144. message.warning("申请退款金额不能为空!");
  1145. return false;
  1146. }
  1147. if (this.state.remarksC.trim() == "") {
  1148. message.warning("请正确填写变更原因");
  1149. return false;
  1150. }
  1151. if (this.state.startRemarks.trim() == "") {
  1152. message.warning("请正确填写备注信息");
  1153. return false;
  1154. }
  1155. let theorgCodeUrl = [];
  1156. if (this.state.voucherUrl.length) {
  1157. let picArr = [];
  1158. this.state.voucherUrl.map(function (item) {
  1159. if (item.response && item.response.data && item.response.data.length) {
  1160. picArr.push(item.response.data);
  1161. }
  1162. });
  1163. theorgCodeUrl = picArr.join(",");
  1164. }
  1165. this.setState({
  1166. loading: true
  1167. });
  1168. $.ajax({
  1169. url: globalConfig.context + "/api/admin/orderChange/updateOrderChange",
  1170. method: "post",
  1171. data: {
  1172. id: this.state.changeId,
  1173. changeType: 0,
  1174. orderNo: this.state.orderNo, //订单编号
  1175. processState: 0,
  1176. startRemarks: this.state.startRemarks,
  1177. remarks: this.state.remarksC,
  1178. voucherUrl: theorgCodeUrl.length ? theorgCodeUrl : "",
  1179. totalAmount: this.state.totalAmount,
  1180. settlementAmount: this.state.settlementAmount,
  1181. changeAmount: this.state.changeAmount,
  1182. applicant: this.state.salesmanName,
  1183. depName: this.state.depName,
  1184. type: this.state.typeChange
  1185. }
  1186. }).done(
  1187. function (data) {
  1188. if (!data.error.length) {
  1189. this.setState({
  1190. loading: false
  1191. });
  1192. message.success("发起变更成功");
  1193. this.handleCancelclose();
  1194. } else {
  1195. message.warning(data.error[0].message);
  1196. this.setState({
  1197. loading: false
  1198. });
  1199. }
  1200. }.bind(this)
  1201. );
  1202. }
  1203. editCui(record) {
  1204. this.setState({
  1205. editCuiVisible: true,
  1206. editCuiMoney: record.money,
  1207. editCuiTid: record.tid,
  1208. editCuiId: record.id
  1209. });
  1210. }
  1211. editPro(record) {
  1212. this.setState({
  1213. editProVisible: true,
  1214. editSplitStatus: record.splitStatus,
  1215. editProMoney: record.commodityPrice,
  1216. editProCommodityQuantity: record.commodityQuantity,
  1217. editProTid: record.tid,
  1218. editProId: record.id
  1219. });
  1220. }
  1221. submitEditCui() {
  1222. this.setState({
  1223. loading: true
  1224. });
  1225. $.ajax({
  1226. url: globalConfig.context + "/api/admin/orderChange/updateChangeDun",
  1227. method: "post",
  1228. data: {
  1229. id: this.state.editCuiId,
  1230. type: this.state.editCuiTid ? 2 : 1,
  1231. money: this.state.editCuiMoney,
  1232. tid: this.state.editCuiTid,
  1233. }
  1234. }).done(
  1235. function (data) {
  1236. this.setState({
  1237. loading: false
  1238. });
  1239. if (!data.error.length) {
  1240. message.success("修改成功!");
  1241. this.cuiList();
  1242. this.proList()
  1243. this.setState({
  1244. editCuiVisible: false
  1245. });
  1246. } else {
  1247. message.warning(data.error[0].message);
  1248. }
  1249. }.bind(this)
  1250. );
  1251. }
  1252. submitEditPro() {
  1253. this.setState({
  1254. loading: true
  1255. });
  1256. $.ajax({
  1257. url: globalConfig.context + "/api/admin/orderChange/updateChangeTask",
  1258. method: "post",
  1259. data: {
  1260. id: this.state.editProId,
  1261. type: this.state.editProTid ? 2 : 1,
  1262. commodityPrice: this.state.editProMoney,
  1263. commodityQuantity: this.state.editProCommodityQuantity,
  1264. tid: this.state.editProTid
  1265. }
  1266. }).done(
  1267. function (data) {
  1268. this.setState({
  1269. loading: false
  1270. });
  1271. if (!data.error.length) {
  1272. message.success("修改成功!");
  1273. this.proList();
  1274. this.cuiList()
  1275. this.setState({
  1276. editProVisible: false
  1277. });
  1278. } else {
  1279. message.warning(data.error[0].message);
  1280. }
  1281. }.bind(this)
  1282. );
  1283. }
  1284. componentWillMount() {
  1285. this.departmentList();
  1286. this.state.data = this.props.orderData;
  1287. this.state.data.oldPrice = this.props.orderData.totalAmount;
  1288. this.setState({
  1289. data: this.state.data,
  1290. voucherUrl: this.props.voucherUrl
  1291. });
  1292. this.proList();
  1293. this.cuiList();
  1294. let e = this.props.orderData.type;
  1295. if (e == 1) {
  1296. this.setState({
  1297. hetongFlag: false,
  1298. listFlag: false,
  1299. listCuiFlag: false,
  1300. tuiKuanFlag: false,
  1301. displayList: false
  1302. });
  1303. } else if (e == 2) {
  1304. this.setState({
  1305. hetongFlag: true,
  1306. listFlag: false,
  1307. listCuiFlag: false,
  1308. tuiKuanFlag: true,
  1309. displayList: false
  1310. });
  1311. } else if (e == 3) {
  1312. this.setState({
  1313. listFlag: false,
  1314. hetongFlag: false,
  1315. listCuiFlag: false,
  1316. tuiKuanFlag: false,
  1317. displayList: true
  1318. });
  1319. } else if (e == 4) {
  1320. this.setState({
  1321. listFlag: false,
  1322. listCuiFlag: false,
  1323. hetongFlag: false,
  1324. tuiKuanFlag: true,
  1325. displayList: false
  1326. });
  1327. } else if (e == 5) {
  1328. this.setState({
  1329. listFlag: false,
  1330. listCuiFlag: false,
  1331. hetongFlag: true,
  1332. tuiKuanFlag: true,
  1333. displayList: false
  1334. });
  1335. } else {
  1336. this.setState({
  1337. listFlag: true,
  1338. hetongFlag: true,
  1339. listCuiFlag: true,
  1340. tuiKuanFlag: false,
  1341. displayList: false
  1342. });
  1343. }
  1344. }
  1345. componentWillReceiveProps(nextProps) {
  1346. this.state.data = nextProps.orderData;
  1347. this.state.data.oldPrice = nextProps.orderData.totalAmount;
  1348. this.setState({
  1349. data: this.state.data,
  1350. voucherUrl: nextProps.voucherUrl
  1351. });
  1352. this.proList();
  1353. this.cuiList();
  1354. let e = nextProps.orderData.type;
  1355. if (e == 1) {
  1356. this.setState({
  1357. hetongFlag: false,
  1358. listFlag: false,
  1359. listCuiFlag: false,
  1360. tuiKuanFlag: false,
  1361. displayList: false
  1362. });
  1363. } else if (e == 2) {
  1364. this.setState({
  1365. hetongFlag: true,
  1366. listFlag: false,
  1367. listCuiFlag: false,
  1368. tuiKuanFlag: true,
  1369. displayList: false
  1370. });
  1371. } else if (e == 3) {
  1372. this.setState({
  1373. listFlag: false,
  1374. hetongFlag: false,
  1375. listCuiFlag: false,
  1376. tuiKuanFlag: false,
  1377. displayList: true
  1378. });
  1379. } else if (e == 4) {
  1380. this.setState({
  1381. listFlag: false,
  1382. listCuiFlag: false,
  1383. hetongFlag: false,
  1384. tuiKuanFlag: true,
  1385. displayList: false
  1386. });
  1387. } else if (e == 5) {
  1388. this.setState({
  1389. listFlag: false,
  1390. listCuiFlag: false,
  1391. hetongFlag: true,
  1392. tuiKuanFlag: true,
  1393. displayList: false
  1394. });
  1395. } else {
  1396. this.setState({
  1397. listFlag: true,
  1398. hetongFlag: true,
  1399. listCuiFlag: true,
  1400. tuiKuanFlag: false,
  1401. displayList: false
  1402. });
  1403. }
  1404. // }
  1405. }
  1406. // componentWillMount() {
  1407. // this.departmentList();
  1408. // }
  1409. render() {
  1410. const expandedRowRender = e => {
  1411. const data = e.list;
  1412. data.forEach((item) => {
  1413. item.key = item.id
  1414. })
  1415. let columns = [];
  1416. if (e.list instanceof Array && e.list.length) {
  1417. columns = [
  1418. {
  1419. title: "变更状态",
  1420. dataIndex: "type",
  1421. key: "type",
  1422. render: (text, record) => {
  1423. let str = "";
  1424. let color = "";
  1425. if (text == 1) {
  1426. str = "增";
  1427. color = "#87d068";
  1428. } else if (text == 2) {
  1429. str = "改";
  1430. color = "#108ee9";
  1431. } else if (text == 3) {
  1432. str = "删";
  1433. color = "#f50";
  1434. }
  1435. return (
  1436. <span>
  1437. <Tag
  1438. color={color}
  1439. style={{ display: text == 0 ? "none" : "inline-block" }}
  1440. >
  1441. {str}
  1442. </Tag>
  1443. {record.splitStatus == 1 ? (
  1444. <Tag
  1445. color="#108ee9"
  1446. // onClick={e => {
  1447. // e.stopPropagation();
  1448. // this.showRes(record);
  1449. // }}
  1450. >
  1451. 父项目
  1452. </Tag>
  1453. ) : (
  1454. ""
  1455. )}
  1456. {record.splitStatus == 2 ? (
  1457. <Tag
  1458. color="#108ee9"
  1459. // onClick={e => {
  1460. // e.stopPropagation();
  1461. // this.showRes(record);
  1462. // }}
  1463. >
  1464. 子项目
  1465. </Tag>
  1466. ) : (
  1467. ""
  1468. )}
  1469. </span>
  1470. );
  1471. }
  1472. },
  1473. {
  1474. title: "业务项目名称",
  1475. dataIndex: "commodityName",
  1476. key: "commodityName"
  1477. },
  1478. {
  1479. title: "项目类别",
  1480. dataIndex: "cname",
  1481. key: "cname"
  1482. },
  1483. {
  1484. title: "项目数量",
  1485. dataIndex: "commodityQuantity",
  1486. key: "commodityQuantity"
  1487. },
  1488. {
  1489. title: "金额(万元)",
  1490. dataIndex: "commodityPrice",
  1491. key: "commodityPrice",
  1492. render: (text, record) => {
  1493. if (record.splitStatus == 2) {
  1494. return "/";
  1495. } else {
  1496. return text;
  1497. }
  1498. }
  1499. },
  1500. {
  1501. title: "主要项目",
  1502. dataIndex: "main",
  1503. key: "main",
  1504. render: text => {
  1505. return text ? "是" : "否";
  1506. }
  1507. },
  1508. {
  1509. title: "项目负责人",
  1510. dataIndex: "receiverName",
  1511. key: "receiverName"
  1512. },
  1513. {
  1514. title: "项目说明",
  1515. dataIndex: "taskComment",
  1516. key: "taskComment",
  1517. render: text => {
  1518. return text && text.length > 8 ? text.substr(0, 8) + "…" : text;
  1519. }
  1520. },
  1521. {
  1522. title: "操作",
  1523. dataIndex: "ABC",
  1524. key: "ABC",
  1525. render: (text, record) => {
  1526. return (
  1527. <div>
  1528. <Button
  1529. onClick={e => {
  1530. e.stopPropagation();
  1531. this.showConfirm(this.changeDeletePro, record);
  1532. }}
  1533. disabled={this.state.listFlag}
  1534. style={{
  1535. display: this.state.displayList ? "none" : "block"
  1536. }}
  1537. >
  1538. 删除
  1539. </Button>
  1540. </div>
  1541. );
  1542. }
  1543. }
  1544. ];
  1545. return (
  1546. <Table
  1547. columns={columns}
  1548. dataSource={data}
  1549. pagination={false}
  1550. onRowDoubleClick={this.listFlag ? "" : this.editPro}
  1551. />
  1552. );
  1553. } else {
  1554. columns = [];
  1555. return (
  1556. <p style={{ fontWeight: "bold", color: "red", textAlign: "center" }}>
  1557. 此项目暂未拆分
  1558. </p>
  1559. );
  1560. }
  1561. };
  1562. const { TextArea } = Input;
  1563. const data = this.state.data;
  1564. // let departmentArr = this.state.departmentArr || [];
  1565. const dataSources = this.state.customerArr || [];
  1566. const cuiDataList = this.state.contactList || [];
  1567. let departmentArr = this.state.departmentArr || [];
  1568. const options = this.state.states
  1569. ? dataSources.map(group => (
  1570. <Select.Option key={group.id} value={group.name}>
  1571. {group.name}
  1572. </Select.Option>
  1573. ))
  1574. : dataSources.map((group, index) => (
  1575. <Select.Option key={index} value={group.bname}>
  1576. {group.bname}
  1577. </Select.Option>
  1578. ));
  1579. return (
  1580. <div>
  1581. {this.state.resVisible ? (
  1582. <ResolutionDetail
  1583. cancel={this.resCancel}
  1584. detail={this.state.resRecord}
  1585. visible={this.state.resVisible}
  1586. id={this.state.resRecord.orderNo}
  1587. />
  1588. ) : (
  1589. ""
  1590. )}
  1591. <div className="clearfix">
  1592. <FormItem className="half-item" {...formItemLayout} label="客户名称">
  1593. <span>{data.userName}</span>
  1594. </FormItem>
  1595. </div>
  1596. <div className="clearfix">
  1597. <FormItem className="half-item" {...formItemLayout} label="合同编号">
  1598. <span>{data.contractNo}</span>
  1599. </FormItem>
  1600. </div>
  1601. <div className="clearfix">
  1602. <FormItem
  1603. className="half-item"
  1604. {...formItemLayout}
  1605. label="申请变更部门"
  1606. >
  1607. <span>{this.state.data.depName}</span>
  1608. </FormItem>
  1609. <FormItem className="half-item" {...formItemLayout} label="申请人">
  1610. {/* <Input
  1611. placeholder="请输入申请人"
  1612. ref="signTotalAmount"
  1613. value={data.applicant}
  1614. onChange={e => {
  1615. let data = this.state.data;
  1616. data.applicant = e.target.value;
  1617. this.setState({ data });
  1618. }}
  1619. style={{ width: "240px" }}
  1620. /> */}
  1621. <span>{data.applicant}</span>
  1622. </FormItem>
  1623. </div>
  1624. <div className="clearfix">
  1625. <FormItem
  1626. labelCol={{ span: 4 }}
  1627. wrapperCol={{ span: 18 }}
  1628. label="变更类型"
  1629. >
  1630. <Select
  1631. placeholder="选择合同变更类型"
  1632. style={{ width: 200 }}
  1633. disabled={this.state.changeFlag}
  1634. onChange={e => {
  1635. let data = this.state.data;
  1636. data.type = e;
  1637. this.setState({ data, changeFlag: true });
  1638. if (e == 1) {
  1639. this.setState({
  1640. hetongFlag: false,
  1641. listFlag: false,
  1642. listCuiFlag: false,
  1643. tuiKuanFlag: false,
  1644. displayList: false
  1645. });
  1646. } else if (e == 2) {
  1647. this.setState({
  1648. hetongFlag: true,
  1649. listFlag: false,
  1650. listCuiFlag: false,
  1651. tuiKuanFlag: true,
  1652. displayList: false
  1653. });
  1654. } else if (e == 3) {
  1655. this.setState({
  1656. listFlag: false,
  1657. hetongFlag: false,
  1658. listCuiFlag: false,
  1659. tuiKuanFlag: false,
  1660. displayList: true
  1661. });
  1662. } else if (e == 4) {
  1663. this.setState({
  1664. listFlag: false,
  1665. listCuiFlag: false,
  1666. hetongFlag: false,
  1667. tuiKuanFlag: true,
  1668. displayList: false
  1669. });
  1670. } else if (e == 5) {
  1671. this.setState({
  1672. listFlag: false,
  1673. listCuiFlag: false,
  1674. hetongFlag: true,
  1675. tuiKuanFlag: true,
  1676. displayList: false
  1677. });
  1678. } else {
  1679. this.setState({
  1680. listFlag: true,
  1681. hetongFlag: true,
  1682. listCuiFlag: true,
  1683. tuiKuanFlag: false,
  1684. displayList: false
  1685. });
  1686. }
  1687. }}
  1688. value={data.type}
  1689. >
  1690. <Option value={0}>退单退款</Option>
  1691. <Option value={1}>项目及金额变更</Option>
  1692. <Option value={2}>仅项目变更</Option>
  1693. <Option value={3}>仅金额变更</Option>
  1694. <Option value={4}>重报</Option>
  1695. <Option value={5}>赠送</Option>
  1696. </Select>
  1697. <Button
  1698. style={{ marginLeft: 10 }}
  1699. onClick={e => {
  1700. this.state.data.startRemarks = "";
  1701. this.state.data.remarks = "";
  1702. this.state.data.changeAmount = "0";
  1703. this.state.data.depNameChange = undefined;
  1704. this.state.data.typeChange = [];
  1705. this.state.data.totalAmount = this.state.data.oldPrice;
  1706. this.setState({
  1707. listFlag: false,
  1708. hetongFlag: false,
  1709. listCuiFlag: false,
  1710. tuiKuanFlag: false,
  1711. displayList: false,
  1712. startRemarks: "",
  1713. data: this.state.data,
  1714. changeFlag: false,
  1715. voucherUrl: []
  1716. // changeAmount: "0",
  1717. // applicant: undefined,
  1718. // depNameChange: undefined,
  1719. // typeChange: [],
  1720. // changeFlag: false
  1721. });
  1722. }}
  1723. >
  1724. 重置
  1725. </Button>
  1726. </FormItem>
  1727. </div>
  1728. <div className="clearfix">
  1729. <FormItem
  1730. labelCol={{ span: 4 }}
  1731. wrapperCol={{ span: 18 }}
  1732. label="合同额(万元)"
  1733. >
  1734. <Input
  1735. placeholder="请输入合同额"
  1736. ref="signTotalAmount"
  1737. disabled={this.state.hetongFlag}
  1738. value={data.totalAmount}
  1739. onChange={e => {
  1740. let data = this.state.data;
  1741. data.totalAmount = e.target.value;
  1742. this.setState({ data });
  1743. }}
  1744. style={{ width: "240px" }}
  1745. />
  1746. </FormItem>
  1747. <FormItem
  1748. labelCol={{ span: 4 }}
  1749. wrapperCol={{ span: 18 }}
  1750. label="已收款(万元)"
  1751. >
  1752. {/* <Input
  1753. placeholder="请输入已收款"
  1754. ref="signTotalAmount"
  1755. value={data.settlementAmount}
  1756. onChange={e => {
  1757. let data = this.state.data;
  1758. data.settlementAmount = e.target.value;
  1759. this.setState({ data });
  1760. }}
  1761. style={{ width: "240px" }}
  1762. /> */}
  1763. <span>
  1764. {this.state.data.settlementAmount}&nbsp;&nbsp;&nbsp;&nbsp;
  1765. <span style={{ color: "red" }}>
  1766. (注:已收款与现实收款不符,请与财务专员联系)
  1767. </span>
  1768. </span>
  1769. </FormItem>
  1770. <FormItem
  1771. labelCol={{ span: 4 }}
  1772. wrapperCol={{ span: 18 }}
  1773. label="申请退款(万元)"
  1774. >
  1775. <Input
  1776. placeholder="请输入申请退款"
  1777. ref="signTotalAmount"
  1778. disabled={this.state.tuiKuanFlag}
  1779. value={data.changeAmount}
  1780. onChange={e => {
  1781. let data = this.state.data;
  1782. data.changeAmount = e.target.value;
  1783. this.setState({ data });
  1784. }}
  1785. style={{ width: "240px" }}
  1786. />
  1787. </FormItem>
  1788. </div>
  1789. <div>
  1790. <div>
  1791. <span
  1792. style={{
  1793. marginLeft: "50px",
  1794. fontSize: "20px"
  1795. }}
  1796. >
  1797. 项目业务
  1798. </span>
  1799. <span style={{ color: "red" }}>
  1800. (注:项目删除后,此项目的全部节点、全部工时,全部被删除,请谨慎删除!)
  1801. </span>
  1802. <Button
  1803. type="primary"
  1804. onClick={this.changeAddPro}
  1805. disabled={this.state.listFlag}
  1806. style={{
  1807. float: "right",
  1808. marginRight: "50px",
  1809. marginBottom: "15px",
  1810. display: this.state.displayList ? "none" : "block"
  1811. }}
  1812. >
  1813. 添加项目明细
  1814. </Button>
  1815. </div>
  1816. <div className="patent-table" style={{ marginBottom: 10 }}>
  1817. {/* <Spin spinning={this.state.loading}> */}
  1818. <Table
  1819. columns={this.state.proColumns}
  1820. dataSource={this.state.proDataSource}
  1821. expandedRowRender={expandedRowRender}
  1822. pagination={false}
  1823. onRowDoubleClick={this.listFlag ? "" : this.editPro}
  1824. bordered
  1825. size="small"
  1826. />
  1827. {/* </Spin> */}
  1828. </div>
  1829. <div>
  1830. <span
  1831. style={{
  1832. marginLeft: "50px",
  1833. fontSize: "20px"
  1834. }}
  1835. >
  1836. 催款节点
  1837. </span>
  1838. <span style={{ color: "red" }}>
  1839. (注:节点删除后,无论节点是否触发,均会删除,请谨慎删除!)
  1840. </span>
  1841. <Button
  1842. type="primary"
  1843. onClick={e => {
  1844. this.changeAddCui();
  1845. }}
  1846. disabled={this.state.listCuiFlag}
  1847. style={{
  1848. float: "right",
  1849. marginRight: "50px",
  1850. marginBottom: "15px",
  1851. display: this.state.displayList ? "none" : "block"
  1852. }}
  1853. >
  1854. 添加催款节点
  1855. </Button>
  1856. </div>
  1857. <div className="clearfix">
  1858. {/* <Spin spinning={this.state.loading}> */}
  1859. <Form layout="horizontal">
  1860. <Table
  1861. pagination={false}
  1862. columns={this.state.changeCuiList}
  1863. dataSource={this.state.cuiDataSource}
  1864. scroll={{ x: "max-content", y: 0 }}
  1865. onRowDoubleClick={this.listCuiFlag ? "" : this.editCui}
  1866. bordered
  1867. size="small"
  1868. />
  1869. <Col span={24} offset={9} style={{ marginTop: "15px" }}></Col>
  1870. </Form>
  1871. {/* </Spin> */}
  1872. </div>
  1873. </div>
  1874. <div className="clearfix">
  1875. <FormItem
  1876. style={{ height: "auto" }}
  1877. labelCol={{ span: 4 }}
  1878. wrapperCol={{ span: 18 }}
  1879. label="变更原因"
  1880. >
  1881. <TextArea
  1882. rows={4}
  1883. placeholder="因企业政府补助费用与营销员签单承诺费用不一"
  1884. ref="signTotalAmount"
  1885. style={{ width: "95%" }}
  1886. value={data.remarks}
  1887. onChange={e => {
  1888. let data = this.state.data;
  1889. data.remarks = e.target.value;
  1890. this.setState({ data });
  1891. }}
  1892. />
  1893. </FormItem>
  1894. </div>
  1895. {/* 备注 */}
  1896. <div className="clearfix">
  1897. <FormItem
  1898. style={{ height: "auto" }}
  1899. labelCol={{ span: 4 }}
  1900. wrapperCol={{ span: 18 }}
  1901. label="备注"
  1902. >
  1903. <TextArea
  1904. rows={4}
  1905. placeholder="请输入备注信息"
  1906. ref="signTotalAmount"
  1907. style={{ width: "95%" }}
  1908. value={data.startRemarks}
  1909. onChange={e => {
  1910. let data = this.state.data;
  1911. data.startRemarks = e.target.value;
  1912. this.setState({ data });
  1913. }}
  1914. />
  1915. </FormItem>
  1916. </div>
  1917. <div className="clearfix">
  1918. <FormItem
  1919. labelCol={{ span: 4 }}
  1920. wrapperCol={{ span: 18 }}
  1921. label="变更凭证"
  1922. >
  1923. <PicturesWall
  1924. fileList={this.getVoucherUrl}
  1925. pictureUrl={this.state.voucherUrl}
  1926. url="/api/admin/orderChange/uploadFile"
  1927. sign="order_change_file"
  1928. />
  1929. <Rizhi changeId={data.id} />
  1930. <p>图片建议:要清晰。</p>
  1931. </FormItem>
  1932. </div>
  1933. {/* <ul
  1934. style={{
  1935. width: "868px",
  1936. overflow: "hidden",
  1937. paddingLeft: "90px",
  1938. marginBottom: "20px"
  1939. }}
  1940. >
  1941. {this.state.dataSource.map((item, index) => (
  1942. <li
  1943. key={index}
  1944. style={{
  1945. width: "100%",
  1946. height: "auto",
  1947. wordBreak: "break-all",
  1948. color: "black",
  1949. marginBottom: "10px"
  1950. }}
  1951. >{`${item.aname}: ${item.remarks}`}</li>
  1952. ))}
  1953. </ul> */}
  1954. <div className="clearfix">
  1955. <Button
  1956. type="primary"
  1957. style={{ float: "right", marginRight: 40 }}
  1958. onClick={this.changeApply}
  1959. >
  1960. 发起变更申请
  1961. </Button>
  1962. </div>
  1963. <Modal
  1964. title="修改项目金额及数量"
  1965. visible={this.state.editProVisible}
  1966. onOk={this.submitEditPro}
  1967. width={300}
  1968. okText={"保存"}
  1969. onCancel={() => {
  1970. this.setState({
  1971. editProVisible: false
  1972. });
  1973. }}
  1974. >
  1975. <div className="clearfix">
  1976. <FormItem
  1977. labelCol={{ span: 6 }}
  1978. wrapperCol={{ span: 14 }}
  1979. label="项目金额"
  1980. style={{
  1981. display: this.state.editSplitStatus == 2 ? "none" : "block"
  1982. }}
  1983. >
  1984. <Input
  1985. placeholder="请输入金额"
  1986. rows={4}
  1987. value={this.state.editProMoney}
  1988. onChange={e => {
  1989. this.setState({ editProMoney: e.target.value });
  1990. }}
  1991. />
  1992. </FormItem>
  1993. <FormItem
  1994. labelCol={{ span: 6 }}
  1995. wrapperCol={{ span: 14 }}
  1996. label="项目数量"
  1997. >
  1998. <Input
  1999. placeholder="请输入数量"
  2000. rows={4}
  2001. value={this.state.editProCommodityQuantity}
  2002. onChange={e => {
  2003. this.setState({ editProCommodityQuantity: e.target.value });
  2004. }}
  2005. />
  2006. </FormItem>
  2007. </div>
  2008. </Modal>
  2009. <Modal
  2010. title="修改催款节点金额"
  2011. visible={this.state.editCuiVisible}
  2012. onOk={this.submitEditCui}
  2013. okText={"保存"}
  2014. width={300}
  2015. onCancel={e => {
  2016. this.setState({
  2017. editCuiVisible: false
  2018. });
  2019. }}
  2020. >
  2021. <div className="clearfix">
  2022. <FormItem
  2023. labelCol={{ span: 6 }}
  2024. wrapperCol={{ span: 14 }}
  2025. label="催款金额"
  2026. >
  2027. <Input
  2028. placeholder="请输入金额"
  2029. rows={4}
  2030. value={this.state.editCuiMoney}
  2031. onChange={e => {
  2032. this.setState({ editCuiMoney: e.target.value });
  2033. }}
  2034. />
  2035. </FormItem>
  2036. </div>
  2037. </Modal>
  2038. <Modal
  2039. maskClosable={false}
  2040. visible={this.state.changeVisible}
  2041. onOk={this.nextCancel}
  2042. onCancel={this.nextCancel}
  2043. width="800px"
  2044. title={"添加变更项目"}
  2045. footer=""
  2046. className="admin-desc-content"
  2047. >
  2048. <Form
  2049. layout="horizontal"
  2050. // id="demand-form"
  2051. >
  2052. {/* <Spin spinning={this.state.loading}> */}
  2053. <div className="clearfix">
  2054. <FormItem
  2055. className="half-item"
  2056. {...formItemLayout}
  2057. label="服务名称"
  2058. >
  2059. <AutoComplete
  2060. className="certain-category-search"
  2061. dropdownClassName="certain-category-search-dropdown"
  2062. dropdownMatchSelectWidth={false}
  2063. dropdownStyle={{ width: 200 }}
  2064. style={{ width: "200px" }}
  2065. dataSource={options}
  2066. placeholder="输入服务名称"
  2067. value={this.state.commodityName}
  2068. onChange={this.httpChange}
  2069. filterOption={true}
  2070. onSelect={this.selectAuto}
  2071. >
  2072. <Input />
  2073. </AutoComplete>
  2074. <span className="mandatory">*</span>
  2075. </FormItem>
  2076. <FormItem
  2077. className="half-item"
  2078. {...formItemLayout}
  2079. label="服务数量"
  2080. >
  2081. <Input
  2082. placeholder="请输入服务数量"
  2083. value={this.state.commodityQuantity}
  2084. style={{ width: "200px" }}
  2085. onChange={e => {
  2086. this.setState({ commodityQuantity: e.target.value });
  2087. }}
  2088. ref="commodityQuantity"
  2089. />
  2090. <span className="mandatory">*</span>
  2091. </FormItem>
  2092. <FormItem
  2093. className="half-item"
  2094. {...formItemLayout}
  2095. label="实签价格(万元)"
  2096. >
  2097. <Input
  2098. placeholder="请输入实签价格"
  2099. value={this.state.commodityPrice}
  2100. style={{ width: "200px" }}
  2101. onChange={e => {
  2102. this.setState({ commodityPrice: e.target.value });
  2103. }}
  2104. ref="commodityPrice"
  2105. />
  2106. <span className="mandatory">*</span>
  2107. </FormItem>
  2108. <FormItem
  2109. className="half-item"
  2110. {...formItemLayout}
  2111. label="主要业务"
  2112. >
  2113. <Select
  2114. placeholder="选择是否为主要业务"
  2115. style={{ width: "200px" }}
  2116. value={this.state.main}
  2117. onChange={e => {
  2118. this.setState({ main: e });
  2119. }}
  2120. >
  2121. {boutique.map(function(item) {
  2122. return (
  2123. <Select.Option key={item.value}>{item.key}</Select.Option>
  2124. );
  2125. })}
  2126. </Select>
  2127. <span className="mandatory">*</span>
  2128. </FormItem>
  2129. <div className="clearfix">
  2130. <FormItem
  2131. labelCol={{ span: 4 }}
  2132. wrapperCol={{ span: 16 }}
  2133. label="服务说明"
  2134. >
  2135. <Input
  2136. type="textarea"
  2137. placeholder="请输入服务说明"
  2138. value={this.state.taskComment}
  2139. onChange={e => {
  2140. this.setState({ taskComment: e.target.value });
  2141. }}
  2142. />
  2143. </FormItem>
  2144. </div>
  2145. <FormItem
  2146. wrapperCol={{ span: 12, offset: 4 }}
  2147. className="half-middle"
  2148. >
  2149. <Button
  2150. className="submitSave"
  2151. type="primary"
  2152. onClick={this.changeProSubmit}
  2153. >
  2154. 保存
  2155. </Button>
  2156. <Button
  2157. className="submitSave"
  2158. type="ghost"
  2159. onClick={this.nextCancel}
  2160. >
  2161. 取消
  2162. </Button>
  2163. </FormItem>
  2164. </div>
  2165. {/* </Spin> */}
  2166. </Form>
  2167. </Modal>
  2168. </div>
  2169. );
  2170. }
  2171. }
  2172. export default ChangeApply;