contractJsy.js 41 KB

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