changeApply.js 68 KB

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