contractJsy.js 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365
  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" style={{ marginBottom: 10 }}>
  1069. <span style={{ fontWeight: 900, fontSize: 16 }}>
  1070. 合同变更审核订单
  1071. </span>
  1072. </div>
  1073. <div className="user-search">
  1074. <Tabs
  1075. defaultActiveKey="1"
  1076. onChange={this.callback}
  1077. className="test">
  1078. <TabPane tab="搜索" key="1">
  1079. <div style={{ marginLeft: 10 }}>
  1080. <SearchInput search={this.search} />
  1081. </div>
  1082. </TabPane>
  1083. <TabPane tab="更改表格显示数据" key="2">
  1084. <div style={{ marginLeft: 10 }}>
  1085. <ChooseList
  1086. columns={this.state.columns}
  1087. changeFn={this.changeList}
  1088. changeList={this.state.changeList}
  1089. top={55}
  1090. margin={11}
  1091. />
  1092. </div>
  1093. </TabPane>
  1094. </Tabs>
  1095. <div className="patent-table">
  1096. <Spin spinning={this.state.loading}>
  1097. <Table
  1098. size="small"
  1099. bordered
  1100. columns={
  1101. this.state.changeList
  1102. ? this.state.changeList
  1103. : this.state.columns
  1104. }
  1105. dataSource={this.state.dataSource}
  1106. pagination={this.state.pagination}
  1107. onRowClick={this.tableRowClick}
  1108. />
  1109. </Spin>
  1110. </div>
  1111. <Modal
  1112. className="customeDetails"
  1113. footer=""
  1114. maskClosable={false}
  1115. width="900px"
  1116. visible={this.state.visible}
  1117. onOk={this.visitOk}
  1118. onCancel={this.visitCancel}
  1119. >
  1120. <Tabs
  1121. activeKey={this.state.activeKey}
  1122. onChange={this.callback}
  1123. type="card"
  1124. tabBarExtraContent={
  1125. <div style={{fontWeight:'bold',paddingRight:'15px'}}>
  1126. <OrderItemStatus deleteSign={this.state.deleteSign}/>
  1127. </div>
  1128. }
  1129. >
  1130. <TabPane tab="订单详情" key="a">
  1131. <Form
  1132. layout="horizontal"
  1133. onSubmit={this.handleSubmit}
  1134. id="demand-form"
  1135. style={{ paddingBottom: "40px" }}
  1136. >
  1137. <Spin spinning={this.state.loading}>
  1138. <OrderDetail
  1139. domId='orderDetail2'
  1140. orderUid={this.state.orderUid}
  1141. processState={this.props.processState}
  1142. orderData={this.state.orderData}
  1143. getOrderLog={this.getOrderLog}
  1144. dataSourceX={this.state.dataSourceX}
  1145. contactList={this.state.contactList}
  1146. orderNo={this.state.orderNo}
  1147. totalCui={this.state.totalCui}
  1148. contactListNew={this.state.contactListNew}
  1149. />
  1150. </Spin>
  1151. </Form>
  1152. </TabPane>
  1153. {tabList.map((item, index) => {
  1154. return (
  1155. <TabPane tab={"合同变更记录" + (index + 1)} key={item.id}>
  1156. <ChangeDetail
  1157. id={item.id}
  1158. domId={'hetongbiangenjilu' + (index + 1)}
  1159. orderUid={this.state.orderUid}
  1160. data={this.state.contractData}
  1161. pictureUrl={this.state.voucherUrl}
  1162. attachment={this.state.attachment}
  1163. processState={this.props.processState}
  1164. loadData={this.callback}
  1165. reset={this.state.visible}
  1166. dataSource={this.state.dataProps}
  1167. onCancel={this.visitCancel}
  1168. />
  1169. </TabPane>
  1170. );
  1171. })}
  1172. {tabList.map((item, index) => {
  1173. if (item.usedOrder) {
  1174. return (
  1175. <TabPane
  1176. tab={"原订单" + (index + 1)}
  1177. key={item.usedOrder}
  1178. >
  1179. <Form
  1180. layout="horizontal"
  1181. onSubmit={this.handleSubmit}
  1182. id="demand-form"
  1183. style={{ paddingBottom: "40px" }}
  1184. >
  1185. <Spin spinning={this.state.loading}>
  1186. <OrderDetail
  1187. domId={'yuandingdan' + (index + 1)}
  1188. orderUid={this.state.orderUid}
  1189. processState={this.props.processState}
  1190. orderData={this.state.primaryOrderData}
  1191. getOrderLog={this.getOrderLog}
  1192. dataSourceX={this.state.dataSourceX}
  1193. contactList={this.state.contactList}
  1194. orderNo={this.state.primaryOrderNo}
  1195. totalCui={this.state.totalCui}
  1196. contactListNew={this.state.contactListNew}
  1197. />
  1198. </Spin>
  1199. </Form>
  1200. </TabPane>
  1201. );
  1202. } else {
  1203. return "";
  1204. }
  1205. })}
  1206. {/* {this.state.status === 4 ? (
  1207. <TabPane tab="原订单" key="3">
  1208. <Form
  1209. layout="horizontal"
  1210. onSubmit={this.handleSubmit}
  1211. id="demand-form"
  1212. style={{ paddingBottom: "40px" }}
  1213. >
  1214. <Spin spinning={this.state.loading}>
  1215. <OrderDetail
  1216. processState={this.props.processState}
  1217. orderData={this.state.primaryOrderData}
  1218. getOrderLog={this.getOrderLog}
  1219. dataSourceX={this.state.dataSourceX}
  1220. contactList={this.state.contactList}
  1221. orderNo={this.state.primaryOrderNo}
  1222. totalCui={this.state.totalCui}
  1223. contactListNew={this.state.contactListNew}
  1224. />
  1225. </Spin>
  1226. </Form>
  1227. </TabPane>
  1228. ) : (
  1229. ""
  1230. )} */}
  1231. {this.state.status === 4 && this.state.isAddition ? (
  1232. this.state.type === 4 || this.state.type === 5 ? (
  1233. <TabPane tab="附加订单" key="c">
  1234. <OrderDetail
  1235. domId='fujiadingdan'
  1236. orderUid={this.state.orderUid}
  1237. processState={this.props.processState}
  1238. orderData={this.state.additionalOrderData}
  1239. getOrderLog={this.getOrderLog}
  1240. dataSourceX={this.state.dataSourceX}
  1241. contactList={this.state.contactList}
  1242. orderNo={this.state.additionalOrder}
  1243. totalCui={this.state.totalCui}
  1244. contactListNew={this.state.contactListNew}
  1245. />
  1246. </TabPane>
  1247. ) : (
  1248. ""
  1249. )
  1250. ) : (
  1251. ""
  1252. )}
  1253. </Tabs>
  1254. </Modal>
  1255. <Modal
  1256. maskClosable={false}
  1257. visible={this.state.noVisible}
  1258. onOk={this.handleOk}
  1259. onCancel={this.noCancel}
  1260. width="400px"
  1261. title={"拒绝理由"}
  1262. footer=""
  1263. className="admin-desc-content"
  1264. confirmLoading={this.state.confirmLoading}
  1265. >
  1266. <Form layout="horizontal" id="demand-form">
  1267. <Spin spinning={this.state.loading}>
  1268. <div className="clearfix">
  1269. <FormItem
  1270. labelCol={{ span: 4 }}
  1271. wrapperCol={{ span: 16 }}
  1272. label="拒绝理由"
  1273. >
  1274. <Input
  1275. type="textarea"
  1276. placeholder="请输入拒绝理由"
  1277. rows={4}
  1278. value={this.state.reason}
  1279. onChange={e => {
  1280. this.setState({ reason: e.target.value });
  1281. }}
  1282. />
  1283. </FormItem>
  1284. </div>
  1285. <div className="clearfix">
  1286. <Button
  1287. className="cancel"
  1288. type="primary"
  1289. onClick={this.examOks}
  1290. style={{ marginLeft: "50px" }}
  1291. htmlType="submit"
  1292. loading={this.state.aloading}
  1293. >
  1294. 确定
  1295. </Button>
  1296. <Button
  1297. className="cancel"
  1298. type="ghost"
  1299. onClick={this.noCancel}
  1300. style={{ marginLeft: "50px" }}
  1301. >
  1302. 取消
  1303. </Button>
  1304. </div>
  1305. </Spin>
  1306. </Form>
  1307. </Modal>
  1308. {/* <Modal
  1309. visible={this.state.rizhivisible}
  1310. className="admin-desc-content"
  1311. width="800px"
  1312. maskClosable={false}
  1313. title="订单日志"
  1314. footer={null}
  1315. onCancel={this.closeOrderLog}
  1316. >
  1317. <div className="patent-table">
  1318. <Spin spinning={this.state.loading}>
  1319. <Table
  1320. bordered
  1321. columns={this.state.columnsrizhi}
  1322. dataSource={this.state.dataSourcerizhi}
  1323. pagination={false}
  1324. />
  1325. </Spin>
  1326. </div>
  1327. </Modal> */}
  1328. <OrderRiZi
  1329. dataSourcerizhi={this.state.dataSourcerizhi}
  1330. closeOrderLog={this.closeOrderLog}
  1331. visible={this.state.rizhivisible}
  1332. loading={this.state.loading}
  1333. />
  1334. </div>
  1335. {this.state.addnextVisible && <ProjectDetailsReadOnly
  1336. infor={this.state.dataInfor}
  1337. visible={this.state.addnextVisible}
  1338. onCancel={this.nextCancel}
  1339. />}
  1340. </div>
  1341. );
  1342. }
  1343. })
  1344. );
  1345. export default contractChange;