contractJsy.js 40 KB

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