changeApply.js 68 KB

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