contractJsy.js 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370
  1. import React from "react";
  2. import {Button, Input, Spin, Table, message, Form, Modal, Tabs, Tag, Tooltip} from "antd";
  3. import $ from "jquery/src/ajax";
  4. import {
  5. getNewOrderStatus,
  6. getProcessStatusNew,
  7. splitUrl,
  8. getjiedian,
  9. getboutique,
  10. getCuikuan,
  11. getProjectStatus,
  12. ShowModal,
  13. getType
  14. } from "@/tools.js";
  15. import "./customer.less";
  16. import { ChangeDetail } from "./changeComponent/changeDetailJsy.js";
  17. import { SearchInput } from "./changeComponent/searchInput.js";
  18. import OrderDetail from "./changeComponent/orderDetail";
  19. import ShowModalDiv from "@/showModal.jsx";
  20. import OrderRiZi from "@/orderRiZi.jsx";
  21. import {ChooseList} from "./chooseList";
  22. import {getProjectName} from "../../../tools";
  23. import ProjectDetailsReadOnly from "../../../common/projectDetailsReadOnly";
  24. import OrderItemStatus from '../../../../component/common/orderItemStatus';
  25. const contractChange = Form.create()(
  26. React.createClass({
  27. loadData(pageNo) {
  28. this.setState({
  29. loading: true
  30. });
  31. $.ajax({
  32. method: "get",
  33. dataType: "json",
  34. crossDomain: false,
  35. url: globalConfig.context + "/api/admin/orderChange/orderChangeList",
  36. data: {
  37. pageNo: pageNo || this.state.page || 1,
  38. pageSize: this.state.pagination.pageSize,
  39. userName: this.state.searchData.userNameSearch,
  40. orderNo: this.state.searchData.orderNoSearch,
  41. contractNo: this.state.searchData.contractNoSearch,
  42. processState: this.props.processState,
  43. timeType: this.state.searchData.timeTypeSearch,
  44. startTime: this.state.searchData.releaseDate[0],
  45. endTime: this.state.searchData.releaseDate[1],
  46. salesmanName: this.state.searchData.salesmanNameSearch,
  47. complete: this.state.searchData.completeSearch || 1,
  48. depId: this.state.searchData.depIdSearch,
  49. type: this.state.searchData.changeSearch
  50. },
  51. success: function (data) {
  52. ShowModal(this);
  53. let theArr = [];
  54. if (data.error.length || data.data.list == "") {
  55. if (data.error && data.error.length) {
  56. message.warning(data.error[0].message);
  57. }
  58. } else {
  59. for (let i = 0; i < data.data.list.length; i++) {
  60. let thisdata = data.data.list[i];
  61. theArr.push({
  62. key: i,
  63. orderNo: thisdata.orderNo,
  64. createTimes: thisdata.createTimes,
  65. nickname: thisdata.nickname,
  66. orderType: thisdata.orderType,
  67. establishTimes: thisdata.establishTimes,
  68. orderStatus: thisdata.orderStatus,
  69. totalAmount: thisdata.totalAmount,
  70. settlementAmount: thisdata.settlementAmount,
  71. arrears: thisdata.arrears,
  72. salesmanName: thisdata.salesmanName,
  73. depName: thisdata.depName,
  74. processState: thisdata.processState,
  75. type: thisdata.type,
  76. status: thisdata.status,
  77. id: thisdata.id,
  78. contractNo: thisdata.contractNo,
  79. processStateText: getProcessStatusNew(
  80. thisdata.processState,
  81. thisdata.status
  82. )
  83. });
  84. }
  85. this.state.pagination.total = data.data.totalCount;
  86. this.state.pagination.current = data.data.pageNo;
  87. }
  88. if (data.data && data.data.list && !data.data.list.length) {
  89. this.state.pagination.total = 0;
  90. }
  91. this.setState({
  92. dataSource: theArr,
  93. pageNo: pageNo,
  94. pagination: this.state.pagination
  95. });
  96. }.bind(this)
  97. }).always(
  98. function () {
  99. this.setState({
  100. loading: false
  101. });
  102. }.bind(this)
  103. );
  104. },
  105. getInitialState() {
  106. return {
  107. page: 1,
  108. searchData: {
  109. releaseDate: []
  110. },
  111. primaryOrderData: {}, //原订单数据
  112. orderData: {}, //现订单数据
  113. pictureUrl: [],
  114. voucherUrl: [],
  115. attachment:[],
  116. declarationBatch: 1,
  117. dataInfor: {},
  118. attachmentUrl: [],
  119. contractData: {},
  120. additionalOrderData: {},
  121. paginations: false,
  122. activeKey: "a",
  123. confirmLoading: false,
  124. aloading: false,
  125. pagination: {
  126. defaultCurrent: 1,
  127. defaultPageSize: 10,
  128. showQuickJumper: true,
  129. pageSize: 10,
  130. onChange: function (page) {
  131. this.loadData(page);
  132. this.setState({
  133. page
  134. });
  135. }.bind(this),
  136. showTotal: function (total) {
  137. return "共" + total + "条数据";
  138. }
  139. },
  140. columns: [
  141. {
  142. title: "合同编号",
  143. dataIndex: "contractNo",
  144. key: "contractNo"
  145. },
  146. {
  147. title: "订单编号",
  148. dataIndex: "orderNo",
  149. key: "orderNo"
  150. },
  151. {
  152. title: "客户名称",
  153. dataIndex: "nickname",
  154. key: "nickname",
  155. width: 150,
  156. render: (text) => {
  157. return (
  158. <Tooltip title={text}>
  159. <div style={{
  160. maxWidth:'150px',
  161. overflow:'hidden',
  162. textOverflow: "ellipsis",
  163. whiteSpace:'nowrap',
  164. }}>{text}</div>
  165. </Tooltip>
  166. )
  167. },
  168. },
  169. {
  170. title: "订单部门",
  171. dataIndex: "depName",
  172. key: "depName"
  173. },
  174. {
  175. title: "订单类型",
  176. dataIndex: "orderType",
  177. key: "orderType",
  178. render: text => {
  179. return text ? "科技项目" : "认证项目";
  180. }
  181. },
  182. {
  183. title: "下单时间",
  184. dataIndex: "establishTimes",
  185. key: "establishTimes"
  186. },
  187. {
  188. title: "订单状态",
  189. dataIndex: "orderStatus",
  190. key: "orderStatus",
  191. render: text => {
  192. return getNewOrderStatus(text);
  193. }
  194. },
  195. {
  196. title: "合同额(万元)",
  197. dataIndex: "totalAmount",
  198. key: "totalAmount"
  199. },
  200. {
  201. title: "已付额(万元)",
  202. dataIndex: "settlementAmount",
  203. key: "settlementAmount"
  204. },
  205. {
  206. title: "欠款(万元)",
  207. dataIndex: "arrears",
  208. key: "arrears"
  209. },
  210. {
  211. title: "订单负责人",
  212. dataIndex: "salesmanName",
  213. key: "salesmanName"
  214. },
  215. {
  216. title: "变更类型",
  217. dataIndex: "type",
  218. key: "type",
  219. render: text => {
  220. return getType(text);
  221. }
  222. },
  223. {
  224. title: "审核状态",
  225. dataIndex: "processStateText",
  226. key: "processStateText"
  227. },
  228. {
  229. title: "提交时间",
  230. dataIndex: "createTimes",
  231. key: "createTimes"
  232. }
  233. ],
  234. dataSource: [],
  235. // 传递给子组件的
  236. dataProps: [],
  237. columnsX: [
  238. {
  239. title: "业务项目名称",
  240. dataIndex: "commodityName",
  241. key: "commodityName",
  242. render: (text, record) => {
  243. return (
  244. <span>{text}<span style={{ color: "red" }}>{record.patentTypeName}</span></span>
  245. )
  246. }
  247. },
  248. {
  249. title: "项目类别",
  250. dataIndex: "cname",
  251. key: "cname"
  252. },
  253. {
  254. title: "项目数量",
  255. dataIndex: "commodityQuantity",
  256. key: "commodityQuantity"
  257. },
  258. {
  259. title: "金额(万元)",
  260. dataIndex: "commodityPrice",
  261. key: "commodityPrice"
  262. },
  263. {
  264. title: "负责人",
  265. dataIndex: "contacts",
  266. key: "contacts"
  267. },
  268. {
  269. title: "负责人电话",
  270. dataIndex: "contactsMobile",
  271. key: "contactsMobile"
  272. },
  273. {
  274. title: "项目状态",
  275. dataIndex: "projectStatus",
  276. key: "projectStatus",
  277. render: text => {
  278. return getProjectName(text);
  279. }
  280. },
  281. {
  282. title: "主要项目",
  283. dataIndex: "main",
  284. key: "main",
  285. render: text => {
  286. return text ? "是" : "否";
  287. }
  288. },
  289. {
  290. title: "项目说明",
  291. dataIndex: "taskComment",
  292. key: "taskComment",
  293. render: text => {
  294. return text && text.length > 8 ? text.substr(0, 8) + "…" : text;
  295. }
  296. }
  297. ],
  298. columnsrizhi: [
  299. {
  300. title: "流程",
  301. dataIndex: "processName",
  302. key: "processName"
  303. },
  304. {
  305. title: "操作人",
  306. dataIndex: "adminName",
  307. key: "adminName"
  308. },
  309. {
  310. title: "时间",
  311. dataIndex: "createDate",
  312. key: "createDate"
  313. }
  314. ],
  315. dataSourceX: [],
  316. ContactsLists: [
  317. {
  318. title: "催款科目",
  319. dataIndex: "dunSubject",
  320. key: "dunSubject",
  321. render: text => {
  322. return getjiedian(text);
  323. }
  324. },
  325. {
  326. title: "金额(万元)",
  327. dataIndex: "money",
  328. key: "money"
  329. },
  330. {
  331. title: "催款状态",
  332. dataIndex: "dunStatus",
  333. key: "dunStatus",
  334. render: text => {
  335. return getCuikuan(text);
  336. }
  337. }
  338. ]
  339. };
  340. },
  341. //页面加载函数
  342. componentWillMount() {
  343. this.loadData();
  344. },
  345. //整行点击
  346. tableRowClick(record) {
  347. this.setState(
  348. {
  349. visible: true,
  350. type: record.type,
  351. status: record.status,
  352. buttonStatus: true,
  353. orderStatus: record.orderStatus,
  354. processStateText: record.processStateText,
  355. id: record.id,
  356. orderNo: record.orderNo
  357. },
  358. () => {
  359. this.xiangqing(record.orderNo);
  360. this.xiangmu(record.orderNo);
  361. this.jiedian(record.orderNo);
  362. this.jiedianNew(record.orderNo);
  363. this.createTabs();
  364. }
  365. );
  366. },
  367. createTabs() {
  368. $.ajax({
  369. url: globalConfig.context + "/api/admin/orderChange/getOrderChange",
  370. method: "get",
  371. data: {
  372. orderNo: this.state.orderNo
  373. },
  374. success: data => {
  375. if (data.error && data.error.length) {
  376. message.warning(data.error[0].message);
  377. } else {
  378. this.setState({
  379. tabList: data.data
  380. });
  381. }
  382. }
  383. });
  384. },
  385. //点击打卡项目详情
  386. tableRowClickX(record) {
  387. this.setState({
  388. jid: record.id, //项目ID
  389. kid: record.commodityId, //商品ID
  390. commodityName: record.commodityName, //金额
  391. commodityPrice: record.commodityPrice, //金额
  392. commodityQuantity: record.commodityQuantity, //数量
  393. taskComment: record.taskComment, //备注
  394. main: record.main.toString(), //是否为主要
  395. addnextVisible: true,
  396. dataInfor:record,
  397. addState: 0
  398. });
  399. },
  400. //项目详情关闭
  401. nextCancel() {
  402. this.setState({
  403. addnextVisible: false
  404. });
  405. },
  406. // 合同变更详情
  407. ChangeDetail(key) {
  408. let url = window.location.href.substring(7);
  409. $.ajax({
  410. method: "get",
  411. dataType: "json",
  412. crossDomain: false,
  413. url:
  414. globalConfig.context +
  415. "/api/admin/orderChange/orderChangeDetailsById",
  416. data: {
  417. id: key
  418. },
  419. success: function (data) {
  420. if (data.data) {
  421. let thisdata = data.data;
  422. Object.assign(thisdata, {
  423. processStateText: this.state.processStateText,
  424. userName: this.state.userName,
  425. contractNo: this.state.contractNo
  426. });
  427. this.setState({
  428. contractData: thisdata,
  429. voucherUrl: thisdata.voucherUrl
  430. ? splitUrl(
  431. thisdata.voucherUrl,
  432. ",",
  433. globalConfig.avatarHost + "/upload",
  434. url
  435. )
  436. : [],
  437. attachment: thisdata.attachmentUrl
  438. ? splitUrl(
  439. thisdata.attachmentUrl,
  440. ",",
  441. globalConfig.avatarHost + "/upload",
  442. url
  443. )
  444. : []
  445. });
  446. }
  447. }.bind(this)
  448. });
  449. },
  450. //订单详情
  451. xiangqing(orderNos) {
  452. $.ajax({
  453. method: "get",
  454. dataType: "json",
  455. crossDomain: false,
  456. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  457. data: {
  458. orderNo: orderNos
  459. },
  460. success: function (data) {
  461. if (data.error.length || data.data.list == "") {
  462. if (data.error && data.error.length) {
  463. message.warning(data.error[0].message);
  464. }
  465. } else {
  466. let thisdata = data.data;
  467. this.setState({
  468. orderUid: thisdata.uid,
  469. userName: thisdata.userName,
  470. primaryOrderNo: thisdata.primaryOrder,
  471. additionalOrder: thisdata.additionalOrder,
  472. contractNo: thisdata.contractNo,
  473. // arrears: thisdata.arrears,
  474. orderData: thisdata,
  475. isAddition: thisdata.additionalOrder ? true : false,
  476. deleteSign:thisdata.deleteSign,
  477. });
  478. }
  479. }.bind(this)
  480. });
  481. },
  482. // 原订单数据
  483. primaryOrder(primaryOrder) {
  484. $.ajax({
  485. method: "get",
  486. dataType: "json",
  487. crossDomain: false,
  488. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  489. data: {
  490. orderNo: primaryOrder
  491. },
  492. success: function (data) {
  493. if (data.error.length || data.data.list == "") {
  494. if (data.error && data.error.length) {
  495. message.warning(data.error[0].message);
  496. }
  497. } else {
  498. let thisdata = data.data;
  499. this.setState({
  500. primaryOrderData: thisdata
  501. });
  502. }
  503. }.bind(this)
  504. });
  505. },
  506. // 附加订单数据
  507. additionalOrder(additionalOrder) {
  508. $.ajax({
  509. method: "get",
  510. dataType: "json",
  511. crossDomain: false,
  512. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  513. data: {
  514. orderNo: additionalOrder
  515. },
  516. success: function (data) {
  517. if (data.error.length || data.data.list == "") {
  518. if (data.error && data.error.length) {
  519. message.warning(data.error[0].message);
  520. }
  521. } else {
  522. let thisdata = data.data;
  523. this.setState({
  524. additionalOrderData: thisdata
  525. });
  526. }
  527. }.bind(this)
  528. });
  529. },
  530. //项目列表
  531. xiangmu(orderNos) {
  532. $.ajax({
  533. method: "get",
  534. dataType: "json",
  535. crossDomain: false,
  536. url: globalConfig.context + "/api/admin/newOrder/getOrderTask",
  537. data: {
  538. orderNo: orderNos
  539. },
  540. success: function (data) {
  541. let theArr = [];
  542. if (data.error.length || data.data.list == "") {
  543. if (data.error && data.error.length) {
  544. message.warning(data.error[0].message);
  545. }
  546. } else {
  547. for (let i = 0; i < data.data.length; i++) {
  548. let thisdata = data.data[i];
  549. thisdata.key = i;
  550. thisdata.sort = thisdata.cSort;
  551. theArr.push(thisdata);
  552. }
  553. }
  554. this.setState({
  555. dataSourceX: theArr
  556. });
  557. }.bind(this)
  558. });
  559. },
  560. search(obj) {
  561. this.setState(
  562. {
  563. searchData: obj
  564. },
  565. () => {
  566. this.loadData(1);
  567. }
  568. );
  569. },
  570. rizhi(orderNo) {
  571. $.ajax({
  572. method: "get",
  573. dataType: "json",
  574. crossDomain: false,
  575. url: "/api/admin/newOrder/selectOrderLog",
  576. data: {
  577. orderNo: orderNo
  578. },
  579. success: function (data) {
  580. let theArr = [];
  581. let thisData = data.data;
  582. if (!thisData.length) {
  583. if (data.error && data.error.length) {
  584. message.warning(data.error[0].message);
  585. }
  586. thisData = {};
  587. } else {
  588. for (let i = 0; i < data.data.length; i++) {
  589. let thisdata = data.data[i];
  590. theArr.push({
  591. processName: thisdata.processName,
  592. adminName: thisdata.adminName,
  593. createDate: thisdata.createDate,
  594. remarks: thisdata.remarks
  595. });
  596. }
  597. }
  598. this.setState({
  599. dataSourcerizhi: theArr
  600. });
  601. }.bind(this)
  602. });
  603. },
  604. getOrderLog(orderNo) {
  605. this.setState({
  606. rizhivisible: true
  607. });
  608. this.rizhi(orderNo);
  609. },
  610. closeOrderLog() {
  611. this.setState({
  612. rizhivisible: false
  613. });
  614. },
  615. //节点列表
  616. jiedian(orderNos) {
  617. $.ajax({
  618. method: "get",
  619. dataType: "json",
  620. crossDomain: false,
  621. url: globalConfig.context + "/api/admin/newOrder/selectOrderDun",
  622. data: {
  623. orderNo: orderNos
  624. },
  625. success: function (data) {
  626. let theArr = [];
  627. let thisData = [];
  628. if (data.error.length || data.data.list == "") {
  629. if (data.error && data.error.length) {
  630. message.warning(data.error[0].message);
  631. }
  632. } else {
  633. for (let i = 0; i < data.data.length; i++) {
  634. thisData = data.data[i];
  635. theArr.push({
  636. key: i,
  637. dunSubject: thisData.dunSubject
  638. ? thisData.dunSubject.toString()
  639. : "", //催款科目
  640. id: thisData.id, //节点Id
  641. money: thisData.money, //催款金额
  642. dunStatus: thisData.dunStatus //催款状态
  643. });
  644. }
  645. this.setState({
  646. contactList: theArr
  647. });
  648. }
  649. }.bind(this)
  650. });
  651. },
  652. jiedianNew(orderNos) {
  653. $.ajax({
  654. method: "get",
  655. dataType: "json",
  656. crossDomain: false,
  657. url:
  658. globalConfig.context + "/api/admin/newOrderDun/selectListNewOrderDun",
  659. data: {
  660. orderNo: orderNos
  661. },
  662. success: function (data) {
  663. if (data.error && data.error.length) {
  664. message.warning(data.error[0].message);
  665. } else {
  666. let theArr = [];
  667. let thisData = [];
  668. let arr = data.data || [];
  669. let totalCui = 0;
  670. for (let i = 0; i < arr.length; i++) {
  671. thisData = arr[i];
  672. totalCui += +thisData.money;
  673. theArr.push({
  674. key: i,
  675. dunSubject: thisData.dunSubject
  676. ? thisData.dunSubject.toString()
  677. : "", //催款科目
  678. id: thisData.id, //节点Id
  679. money: thisData.money, //催款金额
  680. // orderNo: record ? record.orderNo : this.props.datauser.orderNo,
  681. commodityName: thisData.commodityName,
  682. projectType: thisData.projectType,
  683. dunTypeName: thisData.dunTypeName,
  684. status: thisData.status,
  685. waitDay: thisData.waitDay,
  686. effectiveCount: thisData.effectiveCount,
  687. startDate: thisData.startDate,
  688. dunType: thisData.dunType,
  689. appropriationRatio: thisData.appropriationRatio,
  690. customizeName: thisData.customizeName,
  691. customizeTimes: thisData.customizeTimes,
  692. tid: thisData.tid,
  693. });
  694. }
  695. if (!totalCui) {
  696. totalCui = 0;
  697. }
  698. totalCui = (Math.round(totalCui * 1000000) / 1000000).toFixed(6);
  699. this.setState({
  700. contactListNew: theArr,
  701. totalCui
  702. });
  703. }
  704. }.bind(this)
  705. }).always(
  706. function () {
  707. this.setState({
  708. loading: false
  709. });
  710. }.bind(this)
  711. );
  712. },
  713. //审核通过
  714. examOk() {
  715. $.ajax({
  716. method: "post",
  717. dataType: "json",
  718. crossDomain: false,
  719. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  720. data: {
  721. orderNo: this.state.orderNo,
  722. orderStatus: 2
  723. },
  724. success: function (data) {
  725. if (data.error.length || data.data.list == "") {
  726. if (data.error && data.error.length) {
  727. message.warning(data.error[0].message);
  728. }
  729. } else {
  730. message.success("该订单已通过审核~");
  731. this.setState({
  732. visible: false
  733. });
  734. this.reset();
  735. }
  736. }.bind(this)
  737. }).always(
  738. function () {
  739. this.setState({
  740. loading: false
  741. });
  742. }.bind(this)
  743. );
  744. },
  745. //通过发给外包
  746. outsourcing() {
  747. $.ajax({
  748. method: "post",
  749. dataType: "json",
  750. crossDomain: false,
  751. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  752. data: {
  753. orderNo: this.state.orderNo,
  754. orderStatus: 2,
  755. outsource: 1
  756. },
  757. success: function (data) {
  758. if (data.error.length || data.data.list == "") {
  759. if (data.error && data.error.length) {
  760. message.warning(data.error[0].message);
  761. }
  762. } else {
  763. message.success("该订单已通过审核~");
  764. this.setState({
  765. visible: false
  766. });
  767. this.reset();
  768. }
  769. }.bind(this)
  770. }).always(
  771. function () {
  772. this.setState({
  773. loading: false
  774. });
  775. }.bind(this)
  776. );
  777. },
  778. //审核不通过
  779. examOks() {
  780. this.setState({
  781. aloading: true
  782. });
  783. $.ajax({
  784. method: "post",
  785. dataType: "json",
  786. crossDomain: false,
  787. url: globalConfig.context + "/api/admin/newOrder/auditOrderNew",
  788. data: {
  789. orderNo: this.state.orderNo,
  790. orderStatus: 3,
  791. reason: this.state.reason
  792. },
  793. success: function (data) {
  794. if (data.error.length || data.data.list == "") {
  795. if (data.error && data.error.length) {
  796. message.warning(data.error[0].message);
  797. this.setState({
  798. aloading: true
  799. });
  800. }
  801. } else {
  802. message.success("该订单已被拒绝~");
  803. this.setState({
  804. visible: false,
  805. aloading: false,
  806. noVisible: false,
  807. reason: ""
  808. });
  809. this.reset();
  810. }
  811. }.bind(this)
  812. }).always(
  813. function () {
  814. this.setState({
  815. loading: false
  816. });
  817. }.bind(this)
  818. );
  819. },
  820. //点击拒绝
  821. examNo() {
  822. this.setState({
  823. noVisible: true
  824. });
  825. },
  826. loadDataChange(key) {
  827. $.ajax({
  828. method: "get",
  829. dataType: "json",
  830. async: false,
  831. crossDomain: false,
  832. url: globalConfig.context + "/api/admin/orderChange/orderChangeLogList",
  833. data: {
  834. changeId: key
  835. },
  836. success: function (data) {
  837. if (data.error.length || data.data.list == "") {
  838. if (data.error && data.error.length) {
  839. message.warning(data.error[0].message);
  840. }
  841. } else {
  842. // console.log("拿到历史", data.data);
  843. this.setState({
  844. dataProps: data.data
  845. });
  846. }
  847. }.bind(this)
  848. });
  849. },
  850. callback(key) {
  851. this.setState(
  852. {
  853. activeKey: key
  854. },
  855. () => {
  856. if (key != "a" && key != "c" && key.length < 10) {
  857. this.ChangeDetail(key);
  858. this.loadDataChange(key);
  859. } else if (key != "a" && key != "c" && key.length > 10) {
  860. this.primaryOrder(key);
  861. this.xiangmu(key);
  862. this.jiedian(key);
  863. this.jiedianNew(key);
  864. this.loadDataChange(key);
  865. }
  866. }
  867. );
  868. if (key === "a") {
  869. this.xiangmu(this.state.orderNo);
  870. this.jiedian(this.state.orderNo);
  871. this.jiedianNew(this.state.orderNo);
  872. }
  873. // if (key === "2") {
  874. // this.ChangeDetail(this.state.orderNo);
  875. // this.loadDataChange();
  876. // }
  877. // if (key === "3") {
  878. // this.primaryOrder(this.state.primaryOrderNo);
  879. // this.xiangmu(this.state.primaryOrderNo);
  880. // this.jiedian(this.state.primaryOrderNo);
  881. // this.jiedianNew(this.state.primaryOrderNo);
  882. // }
  883. if (key === "c") {
  884. this.additionalOrder(this.state.additionalOrder);
  885. this.xiangmu(this.state.additionalOrder);
  886. this.jiedian(this.state.additionalOrder);
  887. this.jiedianNew(this.state.additionalOrder);
  888. this.setState({
  889. buttonStatusA: false
  890. });
  891. } else {
  892. this.setState({
  893. buttonStatusA: true
  894. });
  895. }
  896. },
  897. closeDesc(e, s) {
  898. this.state.activeKey = "a";
  899. this.state.userDetaile = false;
  900. this.state.signBillVisible = false;
  901. this.state.visible = e;
  902. if (s) {
  903. this.loadData(this.state.pageNo);
  904. }
  905. },
  906. // 获取原订单编号
  907. getPrimaryOrder(value) {
  908. this.setState({
  909. primaryOrder: value
  910. });
  911. },
  912. getAdditionalOrder(value) {
  913. this.setState({
  914. additionalOrder: value
  915. });
  916. },
  917. getUrl(url) {
  918. let theorgCodeUrl = [];
  919. if (url.length) {
  920. let picArr = [];
  921. url.map(function (item) {
  922. if (
  923. item.response &&
  924. item.response.data &&
  925. item.response.data.length
  926. ) {
  927. picArr.push(item.response.data);
  928. }
  929. });
  930. theorgCodeUrl = picArr.join(",");
  931. }
  932. return theorgCodeUrl;
  933. },
  934. sureOut() {
  935. if (!this.state.companyName) {
  936. message.warning("公司名称不能为空");
  937. return;
  938. }
  939. if (!this.state.unitPrice) {
  940. message.warning("单价不能为空");
  941. return;
  942. }
  943. if (!this.state.unitNumber) {
  944. message.warning("数量不能为空");
  945. return;
  946. }
  947. if (!this.state.amount) {
  948. message.warning("总金额不能为空");
  949. return;
  950. }
  951. if (!this.state.outsourceRemarks) {
  952. message.warning("备注不能为空");
  953. return;
  954. }
  955. if (this.state.pictureUrl.length === 0) {
  956. message.warning("合同扫描件不能为空");
  957. return;
  958. }
  959. $.ajax({
  960. method: "POST",
  961. dataType: "json",
  962. crossDomain: false,
  963. url: globalConfig.context + "/api/admin/outsourceOrg/auditOutsource",
  964. data: {
  965. id: this.state.id,
  966. orderNo: this.state.orderNo,
  967. companyName: this.state.companyName,
  968. amount: this.state.amount,
  969. outsourceRemarks: this.state.outsourceRemarks,
  970. unitNumber: this.state.unitNumber,
  971. unitPrice: this.state.unitPrice,
  972. attachmentUrl: this.getUrl(this.state.attachmentUrl).length
  973. ? this.getUrl(this.state.attachmentUrl)
  974. : "",
  975. orderStatus: 2,
  976. pictureUrl: this.getUrl(this.state.pictureUrl).length
  977. ? this.getUrl(this.state.pictureUrl)
  978. : ""
  979. }
  980. }).done(
  981. function (data) {
  982. this.setState({
  983. loading: false
  984. });
  985. if (!data.error.length) {
  986. message.success("发起成功!");
  987. this.outReset();
  988. this.visitCancel();
  989. } else {
  990. message.warning(data.error[0].message);
  991. }
  992. }.bind(this)
  993. );
  994. },
  995. //关闭输入理由框
  996. noCancel() {
  997. this.setState({
  998. noVisible: false,
  999. aloading: false,
  1000. reason: ""
  1001. });
  1002. },
  1003. //重置
  1004. reset() {
  1005. this.setState({
  1006. signBillVisible: false
  1007. });
  1008. this.state.orderNo = "";
  1009. this.state.customerName = "";
  1010. this.state.releaseDate[0] = undefined;
  1011. this.state.releaseDate[1] = undefined;
  1012. this.state.approval = undefined;
  1013. this.loadData(1);
  1014. },
  1015. outReset() {
  1016. this.setState({
  1017. companyName: "",
  1018. amount: "",
  1019. unitPrice: "",
  1020. unitNumber: "",
  1021. outsourceRemarks: "",
  1022. attachmentUrl: [],
  1023. pictureUrl: []
  1024. });
  1025. },
  1026. getOrgCodeUrl(e) {
  1027. this.setState({ pictureUrl: e });
  1028. },
  1029. //关闭详情
  1030. visitCancel() {
  1031. this.setState(
  1032. {
  1033. visible: false,
  1034. activeKey: "a"
  1035. },
  1036. () => {
  1037. this.setState({
  1038. activeKey: "a"
  1039. });
  1040. }
  1041. );
  1042. this.loadData(this.state.pageNo);
  1043. },
  1044. visitOk() {
  1045. this.setState({
  1046. visible: false
  1047. });
  1048. },
  1049. changeList(arr) {
  1050. const newArr = [];
  1051. this.state.columns.forEach(item => {
  1052. arr.forEach(val => {
  1053. if (val === item.title) {
  1054. newArr.push(item);
  1055. }
  1056. });
  1057. });
  1058. this.setState({
  1059. changeList: newArr
  1060. });
  1061. },
  1062. render() {
  1063. const tabList = this.state.tabList || [];
  1064. const formItemLayout = {
  1065. labelCol: { span: 8 },
  1066. wrapperCol: { span: 14 }
  1067. };
  1068. const FormItem = Form.Item;
  1069. const { TabPane } = Tabs;
  1070. return (
  1071. <div className="user-content">
  1072. <ShowModalDiv ShowModal={this.state.showModal} />
  1073. <div className="content-title" style={{ marginBottom: 10 }}>
  1074. <span style={{ fontWeight: 900, fontSize: 16 }}>
  1075. 合同变更审核订单
  1076. </span>
  1077. </div>
  1078. <div className="user-search">
  1079. <Tabs
  1080. defaultActiveKey="1"
  1081. onChange={this.callback}
  1082. className="test">
  1083. <TabPane tab="搜索" key="1">
  1084. <div style={{ marginLeft: 10 }}>
  1085. <SearchInput search={this.search} />
  1086. </div>
  1087. </TabPane>
  1088. <TabPane tab="更改表格显示数据" key="2">
  1089. <div style={{ marginLeft: 10 }}>
  1090. <ChooseList
  1091. columns={this.state.columns}
  1092. changeFn={this.changeList}
  1093. changeList={this.state.changeList}
  1094. top={55}
  1095. margin={11}
  1096. />
  1097. </div>
  1098. </TabPane>
  1099. </Tabs>
  1100. <div className="patent-table">
  1101. <Spin spinning={this.state.loading}>
  1102. <Table
  1103. size="small"
  1104. bordered
  1105. columns={
  1106. this.state.changeList
  1107. ? this.state.changeList
  1108. : this.state.columns
  1109. }
  1110. dataSource={this.state.dataSource}
  1111. pagination={this.state.pagination}
  1112. onRowClick={this.tableRowClick}
  1113. />
  1114. </Spin>
  1115. </div>
  1116. <Modal
  1117. className="customeDetails"
  1118. footer=""
  1119. maskClosable={false}
  1120. width="900px"
  1121. visible={this.state.visible}
  1122. onOk={this.visitOk}
  1123. onCancel={this.visitCancel}
  1124. >
  1125. <Tabs
  1126. activeKey={this.state.activeKey}
  1127. onChange={this.callback}
  1128. type="card"
  1129. tabBarExtraContent={
  1130. <div style={{fontWeight:'bold',paddingRight:'15px'}}>
  1131. <OrderItemStatus deleteSign={this.state.deleteSign}/>
  1132. </div>
  1133. }
  1134. >
  1135. <TabPane tab="订单详情" key="a">
  1136. <Form
  1137. layout="horizontal"
  1138. onSubmit={this.handleSubmit}
  1139. id="demand-form"
  1140. style={{ paddingBottom: "40px" }}
  1141. >
  1142. <Spin spinning={this.state.loading}>
  1143. <OrderDetail
  1144. domId='orderDetail2'
  1145. orderUid={this.state.orderUid}
  1146. processState={this.props.processState}
  1147. orderData={this.state.orderData}
  1148. getOrderLog={this.getOrderLog}
  1149. dataSourceX={this.state.dataSourceX}
  1150. contactList={this.state.contactList}
  1151. orderNo={this.state.orderNo}
  1152. totalCui={this.state.totalCui}
  1153. contactListNew={this.state.contactListNew}
  1154. />
  1155. </Spin>
  1156. </Form>
  1157. </TabPane>
  1158. {tabList.map((item, index) => {
  1159. return (
  1160. <TabPane tab={"合同变更记录" + (index + 1)} key={item.id}>
  1161. <ChangeDetail
  1162. id={item.id}
  1163. domId={'hetongbiangenjilu' + (index + 1)}
  1164. orderUid={this.state.orderUid}
  1165. data={this.state.contractData}
  1166. pictureUrl={this.state.voucherUrl}
  1167. attachment={this.state.attachment}
  1168. processState={this.props.processState}
  1169. loadData={this.callback}
  1170. reset={this.state.visible}
  1171. dataSource={this.state.dataProps}
  1172. onCancel={this.visitCancel}
  1173. />
  1174. </TabPane>
  1175. );
  1176. })}
  1177. {tabList.map((item, index) => {
  1178. if (item.usedOrder) {
  1179. return (
  1180. <TabPane
  1181. tab={"原订单" + (index + 1)}
  1182. key={item.usedOrder}
  1183. >
  1184. <Form
  1185. layout="horizontal"
  1186. onSubmit={this.handleSubmit}
  1187. id="demand-form"
  1188. style={{ paddingBottom: "40px" }}
  1189. >
  1190. <Spin spinning={this.state.loading}>
  1191. <OrderDetail
  1192. domId={'yuandingdan' + (index + 1)}
  1193. orderUid={this.state.orderUid}
  1194. processState={this.props.processState}
  1195. orderData={this.state.primaryOrderData}
  1196. getOrderLog={this.getOrderLog}
  1197. dataSourceX={this.state.dataSourceX}
  1198. contactList={this.state.contactList}
  1199. orderNo={this.state.primaryOrderNo}
  1200. totalCui={this.state.totalCui}
  1201. contactListNew={this.state.contactListNew}
  1202. />
  1203. </Spin>
  1204. </Form>
  1205. </TabPane>
  1206. );
  1207. } else {
  1208. return "";
  1209. }
  1210. })}
  1211. {/* {this.state.status === 4 ? (
  1212. <TabPane tab="原订单" key="3">
  1213. <Form
  1214. layout="horizontal"
  1215. onSubmit={this.handleSubmit}
  1216. id="demand-form"
  1217. style={{ paddingBottom: "40px" }}
  1218. >
  1219. <Spin spinning={this.state.loading}>
  1220. <OrderDetail
  1221. processState={this.props.processState}
  1222. orderData={this.state.primaryOrderData}
  1223. getOrderLog={this.getOrderLog}
  1224. dataSourceX={this.state.dataSourceX}
  1225. contactList={this.state.contactList}
  1226. orderNo={this.state.primaryOrderNo}
  1227. totalCui={this.state.totalCui}
  1228. contactListNew={this.state.contactListNew}
  1229. />
  1230. </Spin>
  1231. </Form>
  1232. </TabPane>
  1233. ) : (
  1234. ""
  1235. )} */}
  1236. {this.state.status === 4 && this.state.isAddition ? (
  1237. this.state.type === 4 || this.state.type === 5 ? (
  1238. <TabPane tab="附加订单" key="c">
  1239. <OrderDetail
  1240. domId='fujiadingdan'
  1241. orderUid={this.state.orderUid}
  1242. processState={this.props.processState}
  1243. orderData={this.state.additionalOrderData}
  1244. getOrderLog={this.getOrderLog}
  1245. dataSourceX={this.state.dataSourceX}
  1246. contactList={this.state.contactList}
  1247. orderNo={this.state.additionalOrder}
  1248. totalCui={this.state.totalCui}
  1249. contactListNew={this.state.contactListNew}
  1250. />
  1251. </TabPane>
  1252. ) : (
  1253. ""
  1254. )
  1255. ) : (
  1256. ""
  1257. )}
  1258. </Tabs>
  1259. </Modal>
  1260. <Modal
  1261. maskClosable={false}
  1262. visible={this.state.noVisible}
  1263. onOk={this.handleOk}
  1264. onCancel={this.noCancel}
  1265. width="400px"
  1266. title={"拒绝理由"}
  1267. footer=""
  1268. className="admin-desc-content"
  1269. confirmLoading={this.state.confirmLoading}
  1270. >
  1271. <Form layout="horizontal" id="demand-form">
  1272. <Spin spinning={this.state.loading}>
  1273. <div className="clearfix">
  1274. <FormItem
  1275. labelCol={{ span: 4 }}
  1276. wrapperCol={{ span: 16 }}
  1277. label="拒绝理由"
  1278. >
  1279. <Input
  1280. type="textarea"
  1281. placeholder="请输入拒绝理由"
  1282. rows={4}
  1283. value={this.state.reason}
  1284. onChange={e => {
  1285. this.setState({ reason: e.target.value });
  1286. }}
  1287. />
  1288. </FormItem>
  1289. </div>
  1290. <div className="clearfix">
  1291. <Button
  1292. className="cancel"
  1293. type="primary"
  1294. onClick={this.examOks}
  1295. style={{ marginLeft: "50px" }}
  1296. htmlType="submit"
  1297. loading={this.state.aloading}
  1298. >
  1299. 确定
  1300. </Button>
  1301. <Button
  1302. className="cancel"
  1303. type="ghost"
  1304. onClick={this.noCancel}
  1305. style={{ marginLeft: "50px" }}
  1306. >
  1307. 取消
  1308. </Button>
  1309. </div>
  1310. </Spin>
  1311. </Form>
  1312. </Modal>
  1313. {/* <Modal
  1314. visible={this.state.rizhivisible}
  1315. className="admin-desc-content"
  1316. width="800px"
  1317. maskClosable={false}
  1318. title="订单日志"
  1319. footer={null}
  1320. onCancel={this.closeOrderLog}
  1321. >
  1322. <div className="patent-table">
  1323. <Spin spinning={this.state.loading}>
  1324. <Table
  1325. bordered
  1326. columns={this.state.columnsrizhi}
  1327. dataSource={this.state.dataSourcerizhi}
  1328. pagination={false}
  1329. />
  1330. </Spin>
  1331. </div>
  1332. </Modal> */}
  1333. <OrderRiZi
  1334. dataSourcerizhi={this.state.dataSourcerizhi}
  1335. closeOrderLog={this.closeOrderLog}
  1336. visible={this.state.rizhivisible}
  1337. loading={this.state.loading}
  1338. />
  1339. </div>
  1340. {this.state.addnextVisible && <ProjectDetailsReadOnly
  1341. infor={this.state.dataInfor}
  1342. visible={this.state.addnextVisible}
  1343. onCancel={this.nextCancel}
  1344. />}
  1345. </div>
  1346. );
  1347. }
  1348. })
  1349. );
  1350. export default contractChange;