projectvipall.jsx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736
  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 ProjectVipAll = React.createClass({
  12. //
  13. getInitialState() {
  14. return {
  15. dvisible: false,
  16. pageNo: 1,
  17. totalPage: 0,
  18. searchValues: {
  19. status: "5"
  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. render: (text, record) => {
  166. return (
  167. <div>
  168. {text}
  169. {(record.memberType == 1 || record.memberType == 2) && <Tag color="#ff0000">特批项目</Tag>}
  170. </div>
  171. )
  172. }
  173. },
  174. {
  175. title: "项目说明",
  176. dataIndex: "taskComment",
  177. key: "taskComment",
  178. className: "title-table",
  179. width: 300,
  180. },
  181. {
  182. title: "状态",
  183. dataIndex: "status",
  184. key: "status",
  185. className: "title-table",
  186. width: 80,
  187. render: (text) => {
  188. return (
  189. <div>
  190. {["", "财务审核", "特批审核", "通过", "驳回"][text]}
  191. </div>
  192. );
  193. }
  194. },
  195. ],
  196. dataSource: [],
  197. fjlist: [],// 营销员列表
  198. checkOrderNo: "",//操作订单编号
  199. checkData: "",//操作描述
  200. checkVisible: "",//审核弹窗开关
  201. checkId: "",//会员项目编号
  202. result: -1,//1同意 0驳回
  203. };
  204. },
  205. componentWillMount() {
  206. this.loadData();
  207. this.departmentList();
  208. },
  209. // 获取订单部门
  210. departmentList() {
  211. $.ajax({
  212. method: "get",
  213. dataType: "json",
  214. crossDomain: false,
  215. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  216. data: {},
  217. success: function (data) {
  218. let thedata = data.data;
  219. let theArr = [];
  220. if (!thedata) {
  221. if (data.error && data.error.length) {
  222. message.warning(data.error[0].message);
  223. }
  224. } else {
  225. thedata.map(function (item, index) {
  226. theArr.push({
  227. key: index,
  228. name: item.name,
  229. id: item.id,
  230. });
  231. });
  232. }
  233. this.setState({
  234. departmentArr: theArr,
  235. });
  236. }.bind(this),
  237. }).always(
  238. function () {
  239. }.bind(this)
  240. );
  241. },
  242. // 列表数据
  243. loadData(pageNo, pageSize) {
  244. const { searchValues, pagination } = this.state
  245. this.setState({
  246. loading: true,
  247. });
  248. let datas = Object.assign(searchValues, {
  249. pageNo: pageNo || 1,
  250. pageSize: pageSize || 10,
  251. shiroType: 0, //所有
  252. });
  253. $.ajax({
  254. method: "get",
  255. dataType: "json",
  256. crossDomain: false,
  257. url: globalConfig.context + "/api/admin/orderProject/memberList",
  258. data: datas,
  259. success: function (data) {
  260. this.setState({
  261. loading: false,
  262. });
  263. if (data.error && data.error.length === 0) {
  264. if (data.data.list) {
  265. pagination.current = data.data.pageNo;
  266. pagination.total = data.data.totalCount;
  267. if (data.data && data.data.list && !data.data.list.length) {
  268. pagination.current = 0;
  269. pagination.total = 0;
  270. }
  271. this.setState({
  272. dataSource: data.data.list,
  273. pagination: this.state.pagination,
  274. pageNo: data.data.pageNo,
  275. totalPage: data.data.totalPage,
  276. });
  277. } else {
  278. this.setState({
  279. dataSource: data.data,
  280. pagination: false,
  281. });
  282. }
  283. } else {
  284. message.warning(data.error[0].message);
  285. }
  286. }.bind(this),
  287. }).always(
  288. function () {
  289. this.setState({
  290. loading: false,
  291. });
  292. }.bind(this)
  293. );
  294. },
  295. // 点击行
  296. tableRowClick(record) {
  297. this.state.RowData = record;
  298. this.setState({
  299. showDesc: true,
  300. });
  301. },
  302. // 关闭
  303. closeDesc(e, s) {
  304. this.state.showDesc = e;
  305. if (s) {
  306. this.loadData(this.state.page);
  307. }
  308. },
  309. // 搜索
  310. search() {
  311. this.setState({
  312. selectedRowKeys: []
  313. })
  314. this.loadData();
  315. },
  316. // 重置
  317. reset() {
  318. this.setState({
  319. searchValues: JSON.parse(JSON.stringify({})),
  320. }, () => {
  321. this.loadData();
  322. })
  323. },
  324. // 更改表格显示数据
  325. changeList(arr) {
  326. const newArr = [];
  327. this.state.columns.forEach((item) => {
  328. arr.forEach((val) => {
  329. if (val === item.title) {
  330. newArr.push(item);
  331. }
  332. });
  333. });
  334. this.setState({
  335. changeList: newArr,
  336. });
  337. },
  338. // 导出当前列表
  339. exportAll() {
  340. message.config({
  341. duration: 20,
  342. });
  343. let loading = message.loading("下载中...");
  344. this.setState({
  345. exportPendingLoading: true,
  346. });
  347. let data = {
  348. shiroType: 0, //所有
  349. };
  350. let obj1 = JSON.parse(JSON.stringify(this.state.searchValues));
  351. data = Object.assign(data, obj1);
  352. $.ajax({
  353. method: "get",
  354. dataType: "json",
  355. crossDomain: false,
  356. url: "/api/admin/orderProject/memberList/export",
  357. data,
  358. success: function (data) {
  359. if (data.error.length === 0) {
  360. this.download(data.data);
  361. } else {
  362. message.warning(data.error[0].message);
  363. }
  364. }.bind(this),
  365. }).always(
  366. function () {
  367. loading();
  368. this.setState({
  369. exportPendingLoading: false,
  370. });
  371. }.bind(this)
  372. );
  373. },
  374. // 打印
  375. printAll() {
  376. this.setState({
  377. dvisible: true,
  378. });
  379. this.loadData(1, 9999999);
  380. },
  381. // 下载
  382. download(fileName) {
  383. window.location.href =
  384. globalConfig.context + "/open/download?fileName=" + fileName;
  385. },
  386. // 查询订单负责人列表
  387. followUp(e) {
  388. const { searchValues } = this.state;
  389. this.setState({
  390. searchValues: Object.assign(searchValues, {
  391. aname: e,
  392. }),
  393. });
  394. $.ajax({
  395. method: "get",
  396. dataType: "json",
  397. crossDomain: false,
  398. url: globalConfig.context + "/api/admin/customer/listAdminByName",
  399. data: {
  400. adminName: e,
  401. },
  402. success: function (data) {
  403. let thedata = data.data;
  404. if (!thedata) {
  405. if (data.error && data.error.length) {
  406. message.warning(data.error[0].message);
  407. }
  408. thedata = {};
  409. }
  410. this.setState({
  411. fjlist: thedata,
  412. });
  413. }.bind(this),
  414. }).always(
  415. function () {
  416. this.setState({
  417. loading: false,
  418. });
  419. }.bind(this)
  420. );
  421. },
  422. // 选中订单负责人
  423. selectF(value) {
  424. const { searchValues, fjlist } = this.state;
  425. const newdataSources = JSON.stringify(fjlist) == "{}" ? [] : fjlist;
  426. this.setState({
  427. searchValues: Object.assign(searchValues, {
  428. salesmanId: newdataSources.find((item) => item.name == value).id,
  429. }),
  430. });
  431. },
  432. // 失去焦点
  433. blurChange(e) {
  434. let theType = "";
  435. let contactLists = this.state.customerArr || [];
  436. if (e) {
  437. contactLists.map(function (item) {
  438. if (item.name == e.toString()) {
  439. theType = item.id;
  440. }
  441. });
  442. }
  443. this.setState({
  444. theTypes: theType,
  445. });
  446. },
  447. // 删除数组最后一项(删除操作列)
  448. truncate(arr) {
  449. return arr.filter(function (v, i, ar) {
  450. return i !== ar.length - 1
  451. })
  452. },
  453. render() {
  454. const { TextArea } = Input
  455. const { searchValues, departmentArr = [] } = this.state
  456. const dataSources = this.state.fjlist || [];
  457. const options = dataSources.map((group) => (
  458. <Select.Option key={group.id} value={group.name}>
  459. {group.name}
  460. </Select.Option>
  461. ));
  462. return (
  463. <div className="user-content">
  464. <div className="content-title" style={{ marginBottom: 10 }}>
  465. <span style={{ fontWeight: 900, fontSize: 16 }}>会员项目(all)</span>
  466. </div>
  467. <Tabs defaultActiveKey="2" onChange={this.callback} className="test">
  468. <TabPane tab="更改表格显示数据" key="1">
  469. <div style={{ marginLeft: 10 }}>
  470. <ChooseList
  471. columns={this.state.columns}
  472. changeFn={this.changeList}
  473. changeList={this.state.changeList}
  474. top={55}
  475. margin={11}
  476. />
  477. </div>
  478. </TabPane>
  479. <TabPane tab="搜索" key="2">
  480. <div className="user-search" style={{ marginLeft: 10 }}>
  481. <Input
  482. placeholder="订单编号"
  483. value={searchValues["orderNo"]
  484. ? searchValues["orderNo"]
  485. : ""}
  486. onChange={(e) => {
  487. searchValues["orderNo"] = e.target.value;
  488. this.setState({
  489. searchValues: searchValues,
  490. });
  491. }}
  492. />
  493. <Input
  494. placeholder="客户名称"
  495. value={searchValues["userName"]
  496. ? searchValues["userName"]
  497. : ""}
  498. onChange={(e) => {
  499. searchValues["userName"] = e.target.value;
  500. this.setState({
  501. searchValues: searchValues,
  502. });
  503. }}
  504. />
  505. <Select
  506. placeholder="订单部门"
  507. style={{ width: 190, marginRight: 10 }}
  508. value={searchValues["depId"]
  509. ? searchValues["depId"]
  510. : undefined}
  511. onChange={(e) => {
  512. searchValues["depId"] = e;
  513. this.setState({
  514. searchValues: searchValues,
  515. });
  516. }}
  517. >
  518. {departmentArr.map(function (item) {
  519. return (
  520. <Select.Option key={item.id}>{item.name}</Select.Option>
  521. );
  522. })}
  523. </Select>
  524. <Input
  525. placeholder="合同编号"
  526. value={searchValues["contractNo"]
  527. ? searchValues["contractNo"]
  528. : ""}
  529. onChange={(e) => {
  530. searchValues["contractNo"] = e.target.value;
  531. this.setState({
  532. searchValues: searchValues,
  533. });
  534. }}
  535. />
  536. <AutoComplete
  537. className="certain-category-search"
  538. dropdownClassName="certain-category-search-dropdown"
  539. dropdownMatchSelectWidth={false}
  540. style={{ width: "120px" }}
  541. dataSource={options}
  542. placeholder="订单负责人"
  543. value={searchValues.aname || undefined}
  544. onChange={this.followUp.bind(this)}
  545. filterOption={true}
  546. onSelect={this.selectF.bind(this)}
  547. >
  548. <Input />
  549. </AutoComplete>
  550. <Input
  551. placeholder="项目名称"
  552. value={searchValues["projectName"]
  553. ? searchValues["projectName"]
  554. : ""}
  555. onChange={(e) => {
  556. searchValues["projectName"] = e.target.value;
  557. this.setState({
  558. searchValues: searchValues,
  559. });
  560. }}
  561. />
  562. <Select
  563. style={{ width: 120 }}
  564. placeholder="签单金额"
  565. value={searchValues["amountStatus"]
  566. ? searchValues["amountStatus"]
  567. : undefined}
  568. onChange={(e) => {
  569. searchValues["amountStatus"] = e;
  570. this.setState({
  571. searchValues: searchValues,
  572. });
  573. }}
  574. >
  575. <Option value="0">10万元以下</Option>
  576. <Option value="1">10~20万元</Option>
  577. <Option value="2">20~30万元</Option>
  578. <Option value="3">30~40万元</Option>
  579. <Option value="4">40万元以上</Option>
  580. </Select>
  581. <Select
  582. style={{ width: 120 }}
  583. placeholder="特批状态"
  584. value={searchValues["approval"]
  585. ? searchValues["approval"]
  586. : undefined}
  587. onChange={(e) => {
  588. searchValues["approval"] = e;
  589. this.setState({
  590. searchValues: searchValues,
  591. });
  592. }}
  593. >
  594. <Option value="0">非特批</Option>
  595. <Option value="1">特批待审</Option>
  596. <Option value="2">特批通过</Option>
  597. <Option value="4">全部特批</Option>
  598. </Select>
  599. <Select
  600. style={{ width: 120 }}
  601. placeholder="审核状态"
  602. value={searchValues["status"]
  603. ? searchValues["status"]
  604. : undefined}
  605. onChange={(e) => {
  606. searchValues["status"] = e;
  607. this.setState({
  608. searchValues: searchValues,
  609. });
  610. }}
  611. >
  612. <Option value="1">财务审核</Option>
  613. <Option value="2">特批审核</Option>
  614. <Option value="3">通过</Option>
  615. <Option value="5">全部</Option>
  616. </Select>
  617. <Button
  618. type="primary"
  619. onClick={this.search}
  620. style={{ marginLeft: 10 }}
  621. disabled={this.state.loading ? true : false}
  622. >
  623. 搜索
  624. </Button>
  625. <Button onClick={this.reset}>重置</Button>
  626. </div>
  627. </TabPane>
  628. <TabPane tab="打印" key="3">
  629. <Button
  630. type="primary"
  631. style={{ margin: "11px 0px 10px 10px" }}
  632. onClick={this.printAll}
  633. >
  634. 打印当前列表
  635. </Button>
  636. </TabPane>
  637. <TabPane tab="导出Excel" key="4">
  638. <Button
  639. type="primary"
  640. style={{ margin: "11px 0px 10px 10px" }}
  641. onClick={this.exportAll}
  642. >
  643. 导出当前列表
  644. </Button>
  645. </TabPane>
  646. </Tabs>
  647. <div className="patent-table">
  648. <Spin spinning={this.state.loading}>
  649. <Table
  650. bordered
  651. columns={
  652. this.state.changeList == undefined
  653. ? this.state.columns
  654. : this.state.changeList
  655. }
  656. dataSource={this.state.dataSource}
  657. pagination={this.state.pagination}
  658. onRowDoubleClick={this.tableRowClick.bind(this)}
  659. size="small"
  660. />
  661. </Spin>
  662. </div>
  663. <textarea id="copyText" style={{ opacity: 0 }} />
  664. {/* 订单详情 */}
  665. <OrderDesc
  666. data={this.state.RowData}
  667. showDesc={this.state.showDesc}
  668. closeDesc={this.closeDesc.bind(this)}
  669. />
  670. {
  671. //打印预览
  672. this.state.dvisible &&
  673. <Modal
  674. visible={this.state.dvisible}
  675. footer=""
  676. title="所有列表信息"
  677. className="admin-desc-content"
  678. width="1300px"
  679. onCancel={() => {
  680. this.loadData();
  681. this.setState({
  682. dvisible: false,
  683. });
  684. }}
  685. >
  686. <Spin spinning={this.state.loading}>
  687. <div
  688. className="patent-table"
  689. style={{
  690. padding: "25px 0 30px 30px",
  691. }}
  692. ref={(e) => {
  693. this.refs.all = e;
  694. }}
  695. >
  696. <Table
  697. columns={this.truncate(this.state.columns)}
  698. dataSource={this.state.dataSource}
  699. pagination={false}
  700. bordered
  701. size="small"
  702. />
  703. </div>
  704. </Spin>
  705. <ReactToPrint
  706. trigger={() => (
  707. <Button
  708. type="primary"
  709. style={{
  710. float: "right",
  711. marginTop: 10,
  712. position: "absolute",
  713. top: 0,
  714. right: 30,
  715. }}
  716. >
  717. 打印
  718. </Button>
  719. )}
  720. content={() => this.refs.all}
  721. />
  722. </Modal>
  723. }
  724. </div>
  725. );
  726. },
  727. });
  728. export default ProjectVipAll;