approvedvipproject.jsx 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837
  1. import React from "react";
  2. import $ from "jquery/src/ajax";
  3. import { AutoComplete, Button, Input, Spin, Table, Select, message, Tabs, Tag, Tooltip, Modal } from "antd";
  4. // import OrderDesc from "../orderDetail/orderDesc";
  5. import ResolutionDetail from "@/resolutionDetail";
  6. import { ChooseList } from "../../order/orderNew/chooseList"
  7. import ReactToPrint from "react-to-print";
  8. import OrderItemStatus from "../../../common/orderItemStatus";
  9. const { TabPane } = Tabs;
  10. //总裁特批会员项目
  11. const ApprovedVipProject = React.createClass({
  12. //
  13. getInitialState() {
  14. return {
  15. dvisible: false,
  16. pageNo: 1,
  17. totalPage: 0,
  18. searchValues: {
  19. status: "2"
  20. },//查询条件
  21. loading: false,
  22. changeList: undefined,// 子组件改变的表格title数组
  23. pagination: {
  24. defaultCurrent: 1,
  25. defaultPageSize: 10,
  26. showQuickJumper: true,
  27. pageSize: 10,
  28. onChange: function (page) {
  29. this.setState({
  30. pageNo: page,
  31. });
  32. this.loadData(page);
  33. }.bind(this),
  34. showTotal: function (total) {
  35. return "共" + total + "条数据";
  36. },
  37. },
  38. columns: [
  39. // {
  40. // title: "销售类型",
  41. // dataIndex: "salesType",
  42. // key: "salesType",
  43. // render: (text, record) => {
  44. // return (
  45. // <Tooltip
  46. // title={salesList[text] + ((text == 3 || text == 4 || text == 5) ? (!record.other ? "" : "," + record.other) : "")}
  47. // >
  48. // <span>
  49. // {salesList[text]}
  50. // </span>
  51. // </Tooltip>
  52. // );
  53. // },
  54. // },
  55. {
  56. title: "合同编号",
  57. dataIndex: "contractNo",
  58. key: "contractNo",
  59. width: 160,
  60. render: (text, record) => {
  61. return (
  62. <Tooltip
  63. title={
  64. <Button
  65. type="primary"
  66. onClick={(e) => {
  67. e.stopPropagation();
  68. let input = document.getElementById("copyText");
  69. input.value = text;
  70. input.select();
  71. document.execCommand("copy");
  72. message.success("复制成功");
  73. }}
  74. >
  75. 复制
  76. </Button>
  77. }
  78. >
  79. <div>
  80. {text}
  81. <div style={{ display: "flex" }}>
  82. {/* <OrderItemStatus deleteSign={record.deleteSign} /> */}
  83. {
  84. record.approval == 1
  85. ? <Tag color="#faa755">特批待审</Tag> :
  86. record.approval == 2 && <Tag color="#ff0000">特批通过</Tag>
  87. }
  88. </div>
  89. </div>
  90. </Tooltip>
  91. );
  92. },
  93. },
  94. {
  95. title: "客户名称",
  96. dataIndex: "userName",
  97. key: "userName",
  98. width: 200,
  99. render: text => {
  100. return (
  101. <Tooltip title={text}>
  102. <div>{text}</div>
  103. </Tooltip>
  104. )
  105. }
  106. },
  107. {
  108. title: "订单编号",
  109. dataIndex: "orderNo",
  110. key: "orderNo",
  111. width: 140,
  112. render: (text, record) => {
  113. return (
  114. <Tooltip
  115. title={
  116. <Button
  117. type="primary"
  118. onClick={(e) => {
  119. e.stopPropagation();
  120. let input = document.getElementById("copyText");
  121. input.value = text;
  122. input.select();
  123. document.execCommand("copy");
  124. message.success("复制成功");
  125. }}
  126. >
  127. 复制
  128. </Button>
  129. }
  130. >
  131. <div>
  132. {text}
  133. <div>
  134. {record.signTotalAmount >= 10 && <Tag color="#ef7207">大客户</Tag>}
  135. {record.projectType == 1 && <Tag color="rgb(22, 155, 213)">会员</Tag>}
  136. </div>
  137. </div>
  138. </Tooltip>
  139. );
  140. },
  141. },
  142. {
  143. title: "订单部门",
  144. dataIndex: "depName",
  145. key: "depName",
  146. className: "title-table",
  147. },
  148. {
  149. title: "订单负责人",
  150. dataIndex: "salesmanName",
  151. key: "salesmanName",
  152. className: "title-table",
  153. },
  154. {
  155. title: "财务负责人",
  156. dataIndex: "financeName",
  157. key: "financeName",
  158. className: "title-table",
  159. },
  160. {
  161. title: "会员项目",
  162. dataIndex: "projectName",
  163. key: "projectName",
  164. className: "title-table",
  165. },
  166. {
  167. title: "项目说明",
  168. dataIndex: "projectComment",
  169. key: "projectComment",
  170. className: "title-table",
  171. width: 200,
  172. },
  173. {
  174. title: "状态",
  175. dataIndex: "status",
  176. key: "status",
  177. className: "title-table",
  178. render: (text) => {
  179. return (
  180. <div>
  181. {["", "财务审核", "特批审核", "通过", "驳回"][text]}
  182. </div>
  183. );
  184. }
  185. },
  186. {
  187. title: "操作",
  188. dataIndex: "caozuo",
  189. key: "caouzo",
  190. className: "title-table",
  191. width: 150,
  192. render: (text, recard) => {
  193. return (
  194. <div>
  195. {
  196. recard.status == 2 &&
  197. <Button
  198. type="primary"
  199. onClick={(e) => {
  200. e.stopPropagation(),
  201. this.checkRemark(recard, 1);
  202. }}
  203. >
  204. 通过
  205. </Button>
  206. }
  207. {
  208. recard.status == 2 &&
  209. <Button
  210. type="danger"
  211. style={{ marginLeft: "5px", }}
  212. onClick={(e) => {
  213. e.stopPropagation(),
  214. this.checkRemark(recard, 0);
  215. }}
  216. >
  217. 驳回
  218. </Button>
  219. }
  220. </div>
  221. );
  222. },
  223. },
  224. ],
  225. dataSource: [],
  226. fjlist: [],// 营销员列表
  227. checkOrderNo: "",//操作订单编号
  228. checkData: "",//操作描述
  229. checkVisible: "",//审核弹窗开关
  230. checkId: "",//会员项目编号
  231. result: -1,//1同意 0驳回
  232. };
  233. },
  234. componentWillMount() {
  235. this.loadData();
  236. this.departmentList();
  237. },
  238. // 获取订单部门
  239. departmentList() {
  240. $.ajax({
  241. method: "get",
  242. dataType: "json",
  243. crossDomain: false,
  244. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  245. data: {},
  246. success: function (data) {
  247. let thedata = data.data;
  248. let theArr = [];
  249. if (!thedata) {
  250. if (data.error && data.error.length) {
  251. message.warning(data.error[0].message);
  252. }
  253. } else {
  254. thedata.map(function (item, index) {
  255. theArr.push({
  256. key: index,
  257. name: item.name,
  258. id: item.id,
  259. });
  260. });
  261. }
  262. this.setState({
  263. departmentArr: theArr,
  264. });
  265. }.bind(this),
  266. }).always(
  267. function () {
  268. }.bind(this)
  269. );
  270. },
  271. // 列表数据
  272. loadData(pageNo, pageSize) {
  273. const { searchValues, pagination } = this.state
  274. this.setState({
  275. loading: true,
  276. });
  277. let datas = Object.assign(searchValues, {
  278. pageNo: pageNo || 1,
  279. pageSize: pageSize || 10,
  280. shiroType: 3, //特批审核
  281. });
  282. $.ajax({
  283. method: "get",
  284. dataType: "json",
  285. crossDomain: false,
  286. url: globalConfig.context + "/api/admin/orderProject/memberList",
  287. data: datas,
  288. success: function (data) {
  289. this.setState({
  290. loading: false,
  291. });
  292. if (data.error && data.error.length === 0) {
  293. if (data.data.list) {
  294. pagination.current = data.data.pageNo;
  295. pagination.total = data.data.totalCount;
  296. if (data.data && data.data.list && !data.data.list.length) {
  297. pagination.current = 0;
  298. pagination.total = 0;
  299. }
  300. this.setState({
  301. dataSource: data.data.list,
  302. pagination: this.state.pagination,
  303. pageNo: data.data.pageNo,
  304. totalPage: data.data.totalPage,
  305. });
  306. } else {
  307. this.setState({
  308. dataSource: data.data,
  309. pagination: false,
  310. });
  311. }
  312. } else {
  313. message.warning(data.error[0].message);
  314. }
  315. }.bind(this),
  316. }).always(
  317. function () {
  318. this.setState({
  319. loading: false,
  320. });
  321. }.bind(this)
  322. );
  323. },
  324. // 点击行
  325. tableRowClick(record) {
  326. this.state.RowData = record;
  327. this.setState({
  328. showDesc: true,
  329. });
  330. },
  331. // 关闭
  332. closeDesc(e, s) {
  333. this.state.showDesc = e;
  334. if (s) {
  335. this.loadData(this.state.page);
  336. }
  337. },
  338. // 搜索
  339. search() {
  340. this.setState({
  341. selectedRowKeys: []
  342. })
  343. this.loadData();
  344. },
  345. // 重置
  346. reset() {
  347. this.setState({
  348. searchValues: JSON.parse(JSON.stringify({})),
  349. }, () => {
  350. this.loadData();
  351. })
  352. },
  353. // 点击审核
  354. checkRemark(record, nmb) {
  355. this.setState({
  356. checkVisible: true,
  357. checkId: record.id,
  358. result: nmb
  359. });
  360. },
  361. // 审核
  362. toExamine() {
  363. if (!this.state.checkData) {
  364. message.warning("请填写审核说明~");
  365. return;
  366. }
  367. this.setState({
  368. loading: true,
  369. });
  370. $.ajax({
  371. method: "POST",
  372. dataType: "json",
  373. crossDomain: false,
  374. url: globalConfig.context + "/api/admin/orderProject/examineMemberProject",
  375. data: {
  376. id: this.state.checkId,
  377. remarks: this.state.content,
  378. result: this.state.result, //1同意 0驳回
  379. type: 1, //0财务审核 1特批审核
  380. },
  381. }).done(
  382. function (data) {
  383. if (!data.error.length) {
  384. message.success("审核成功!");
  385. this.setState({
  386. loading: false,
  387. checkVisible: false,
  388. checkData: '',
  389. });
  390. this.loadData()
  391. } else {
  392. message.warning(data.error[0].message);
  393. }
  394. }.bind(this)
  395. );
  396. },
  397. // 更改表格显示数据
  398. changeList(arr) {
  399. const newArr = [];
  400. this.state.columns.forEach((item) => {
  401. arr.forEach((val) => {
  402. if (val === item.title) {
  403. newArr.push(item);
  404. }
  405. });
  406. });
  407. this.setState({
  408. changeList: newArr,
  409. });
  410. },
  411. // 导出当前列表
  412. exportAll() {
  413. message.config({
  414. duration: 20,
  415. });
  416. let loading = message.loading("下载中...");
  417. this.setState({
  418. exportPendingLoading: true,
  419. });
  420. let data = {
  421. shiroType: 3, //特批审核
  422. };
  423. let obj1 = JSON.parse(JSON.stringify(this.state.searchValues));
  424. data = Object.assign(data, obj1);
  425. $.ajax({
  426. method: "get",
  427. dataType: "json",
  428. crossDomain: false,
  429. url: "/api/admin/orderProject/memberList/export",
  430. data,
  431. success: function (data) {
  432. if (data.error.length === 0) {
  433. this.download(data.data);
  434. } else {
  435. message.warning(data.error[0].message);
  436. }
  437. }.bind(this),
  438. }).always(
  439. function () {
  440. loading();
  441. this.setState({
  442. exportPendingLoading: false,
  443. });
  444. }.bind(this)
  445. );
  446. },
  447. // 打印
  448. printAll() {
  449. this.setState({
  450. dvisible: true,
  451. });
  452. this.loadData(1, 9999999);
  453. },
  454. // 下载
  455. download(fileName) {
  456. window.location.href =
  457. globalConfig.context + "/open/download?fileName=" + fileName;
  458. },
  459. // 查询订单负责人列表
  460. followUp(e) {
  461. const { searchValues } = this.state;
  462. this.setState({
  463. searchValues: Object.assign(searchValues, {
  464. aname: e,
  465. }),
  466. });
  467. $.ajax({
  468. method: "get",
  469. dataType: "json",
  470. crossDomain: false,
  471. url: globalConfig.context + "/api/admin/customer/listAdminByName",
  472. data: {
  473. adminName: e,
  474. },
  475. success: function (data) {
  476. let thedata = data.data;
  477. if (!thedata) {
  478. if (data.error && data.error.length) {
  479. message.warning(data.error[0].message);
  480. }
  481. thedata = {};
  482. }
  483. this.setState({
  484. fjlist: thedata,
  485. });
  486. }.bind(this),
  487. }).always(
  488. function () {
  489. this.setState({
  490. loading: false,
  491. });
  492. }.bind(this)
  493. );
  494. },
  495. // 选中订单负责人
  496. selectF(value) {
  497. const { searchValues, fjlist } = this.state;
  498. const newdataSources = JSON.stringify(fjlist) == "{}" ? [] : fjlist;
  499. this.setState({
  500. searchValues: Object.assign(searchValues, {
  501. salesmanId: newdataSources.find((item) => item.name == value).id,
  502. }),
  503. });
  504. },
  505. // 失去焦点
  506. blurChange(e) {
  507. let theType = "";
  508. let contactLists = this.state.customerArr || [];
  509. if (e) {
  510. contactLists.map(function (item) {
  511. if (item.name == e.toString()) {
  512. theType = item.id;
  513. }
  514. });
  515. }
  516. this.setState({
  517. theTypes: theType,
  518. });
  519. },
  520. // 删除数组最后一项(删除操作列)
  521. truncate(arr) {
  522. return arr.filter(function (v, i, ar) {
  523. return i !== ar.length - 1
  524. })
  525. },
  526. render() {
  527. const { TextArea } = Input
  528. const { searchValues, departmentArr = [] } = this.state
  529. const dataSources = this.state.fjlist || [];
  530. const options = dataSources.map((group) => (
  531. <Select.Option key={group.id} value={group.name}>
  532. {group.name}
  533. </Select.Option>
  534. ));
  535. return (
  536. <div className="user-content">
  537. <div className="content-title" style={{ marginBottom: 10 }}>
  538. <span style={{ fontWeight: 900, fontSize: 16 }}>会员项目审核</span>
  539. </div>
  540. <Tabs defaultActiveKey="2" onChange={this.callback} className="test">
  541. <TabPane tab="更改表格显示数据" key="1">
  542. <div style={{ marginLeft: 10 }}>
  543. <ChooseList
  544. columns={this.state.columns}
  545. changeFn={this.changeList}
  546. changeList={this.state.changeList}
  547. top={55}
  548. margin={11}
  549. />
  550. </div>
  551. </TabPane>
  552. <TabPane tab="搜索" key="2">
  553. <div className="user-search" style={{ marginLeft: 10 }}>
  554. <Input
  555. placeholder="订单编号"
  556. value={searchValues["orderNo"]
  557. ? searchValues["orderNo"]
  558. : ""}
  559. onChange={(e) => {
  560. searchValues["orderNo"] = e.target.value;
  561. this.setState({
  562. searchValues: searchValues,
  563. });
  564. }}
  565. />
  566. <Input
  567. placeholder="客户名称"
  568. value={searchValues["userName"]
  569. ? searchValues["userName"]
  570. : ""}
  571. onChange={(e) => {
  572. searchValues["userName"] = e.target.value;
  573. this.setState({
  574. searchValues: searchValues,
  575. });
  576. }}
  577. />
  578. <Select
  579. placeholder="订单部门"
  580. style={{ width: 190, marginRight: 10 }}
  581. value={searchValues["depId"]
  582. ? searchValues["depId"]
  583. : undefined}
  584. onChange={(e) => {
  585. searchValues["depId"] = e;
  586. this.setState({
  587. searchValues: searchValues,
  588. });
  589. }}
  590. >
  591. {departmentArr.map(function (item) {
  592. return (
  593. <Select.Option key={item.id}>{item.name}</Select.Option>
  594. );
  595. })}
  596. </Select>
  597. <Input
  598. placeholder="合同编号"
  599. value={searchValues["contractNo"]
  600. ? searchValues["contractNo"]
  601. : ""}
  602. onChange={(e) => {
  603. searchValues["contractNo"] = e.target.value;
  604. this.setState({
  605. searchValues: searchValues,
  606. });
  607. }}
  608. />
  609. <AutoComplete
  610. className="certain-category-search"
  611. dropdownClassName="certain-category-search-dropdown"
  612. dropdownMatchSelectWidth={false}
  613. style={{ width: "120px" }}
  614. dataSource={options}
  615. placeholder="订单负责人"
  616. value={searchValues.aname || undefined}
  617. onChange={this.followUp.bind(this)}
  618. filterOption={true}
  619. onSelect={this.selectF.bind(this)}
  620. >
  621. <Input />
  622. </AutoComplete>
  623. <Input
  624. placeholder="项目名称"
  625. value={searchValues["projectName"]
  626. ? searchValues["projectName"]
  627. : ""}
  628. onChange={(e) => {
  629. searchValues["projectName"] = e.target.value;
  630. this.setState({
  631. searchValues: searchValues,
  632. });
  633. }}
  634. />
  635. <Select
  636. style={{ width: 120 }}
  637. placeholder="签单金额"
  638. value={searchValues["amountStatus"]
  639. ? searchValues["amountStatus"]
  640. : undefined}
  641. onChange={(e) => {
  642. searchValues["amountStatus"] = e;
  643. this.setState({
  644. searchValues: searchValues,
  645. });
  646. }}
  647. >
  648. <Option value="0">10万元以下</Option>
  649. <Option value="1">10~20万元</Option>
  650. <Option value="2">20~30万元</Option>
  651. <Option value="3">30~40万元</Option>
  652. <Option value="4">40万元以上</Option>
  653. </Select>
  654. <Select
  655. style={{ width: 120 }}
  656. placeholder="特批状态"
  657. value={searchValues["approval"]
  658. ? searchValues["approval"]
  659. : undefined}
  660. onChange={(e) => {
  661. searchValues["approval"] = e;
  662. this.setState({
  663. searchValues: searchValues,
  664. });
  665. }}
  666. >
  667. <Option value="0">非特批</Option>
  668. <Option value="1">特批待审</Option>
  669. <Option value="2">特批通过</Option>
  670. <Option value="4">全部特批</Option>
  671. </Select>
  672. <Select
  673. style={{ width: 120 }}
  674. placeholder="审核状态"
  675. value={searchValues["status"]
  676. ? searchValues["status"]
  677. : undefined}
  678. onChange={(e) => {
  679. searchValues["status"] = e;
  680. this.setState({
  681. searchValues: searchValues,
  682. });
  683. }}
  684. >
  685. <Option value="1">财务审核</Option>
  686. <Option value="2">特批审核</Option>
  687. <Option value="3">通过</Option>
  688. <Option value="5">全部</Option>
  689. </Select>
  690. <Button
  691. type="primary"
  692. onClick={this.search}
  693. style={{ marginLeft: 10 }}
  694. disabled={this.state.loading ? true : false}
  695. >
  696. 搜索
  697. </Button>
  698. <Button onClick={this.reset}>重置</Button>
  699. </div>
  700. </TabPane>
  701. <TabPane tab="打印" key="3">
  702. <Button
  703. type="primary"
  704. style={{ margin: "11px 0px 10px 10px" }}
  705. onClick={this.printAll}
  706. >
  707. 打印当前列表
  708. </Button>
  709. </TabPane>
  710. <TabPane tab="导出Excel" key="4">
  711. <Button
  712. type="primary"
  713. style={{ margin: "11px 0px 10px 10px" }}
  714. onClick={this.exportAll}
  715. >
  716. 导出当前列表
  717. </Button>
  718. </TabPane>
  719. </Tabs>
  720. <div className="patent-table">
  721. <Spin spinning={this.state.loading}>
  722. <Table
  723. bordered
  724. columns={
  725. this.state.changeList == undefined
  726. ? this.state.columns
  727. : this.state.changeList
  728. }
  729. dataSource={this.state.dataSource}
  730. pagination={this.state.pagination}
  731. onRowDoubleClick={this.tableRowClick.bind(this)}
  732. size="small"
  733. />
  734. </Spin>
  735. </div>
  736. {/* 订单详情 */}
  737. {/* <OrderDesc
  738. data={this.state.RowData}
  739. showDesc={this.state.showDesc}
  740. closeDesc={this.closeDesc.bind(this)}
  741. /> */}
  742. {
  743. //打印预览
  744. this.state.dvisible &&
  745. <Modal
  746. visible={this.state.dvisible}
  747. footer=""
  748. title="所有列表信息"
  749. className="admin-desc-content"
  750. width="1300px"
  751. onCancel={() => {
  752. this.loadData();
  753. this.setState({
  754. dvisible: false,
  755. });
  756. }}
  757. >
  758. <Spin spinning={this.state.loading}>
  759. <div
  760. className="patent-table"
  761. style={{
  762. padding: "25px 0 30px 30px",
  763. }}
  764. ref={(e) => {
  765. this.refs.all = e;
  766. }}
  767. >
  768. <Table
  769. columns={this.truncate(this.state.columns)}
  770. dataSource={this.state.dataSource}
  771. pagination={false}
  772. bordered
  773. size="small"
  774. />
  775. </div>
  776. </Spin>
  777. <ReactToPrint
  778. trigger={() => (
  779. <Button
  780. type="primary"
  781. style={{
  782. float: "right",
  783. marginTop: 10,
  784. position: "absolute",
  785. top: 0,
  786. right: 30,
  787. }}
  788. >
  789. 打印
  790. </Button>
  791. )}
  792. content={() => this.refs.all}
  793. />
  794. </Modal>
  795. }
  796. {
  797. //审核弹窗
  798. this.state.checkVisible &&
  799. <Modal
  800. maskClosable={false}
  801. title="审核订单"
  802. confirmLoading={this.state.loading}
  803. visible={this.state.checkVisible}
  804. onOk={this.toExamine}
  805. okText={this.state.result == 1 ? "通过" : this.state.result == 0 && "驳回"}
  806. onCancel={() => {
  807. this.loadData()
  808. this.setState({
  809. checkVisible: false,
  810. checkData: '',
  811. })
  812. }}
  813. >
  814. <TextArea
  815. value={this.state.checkData}
  816. onChange={(e) => {
  817. this.setState({
  818. checkData: e.target.value,
  819. })
  820. }}
  821. placeholder="请填写审核内容"
  822. />
  823. </Modal>
  824. }
  825. </div>
  826. );
  827. },
  828. });
  829. export default ApprovedVipProject;