unlimited.jsx 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. import React from 'react';
  2. import {
  3. DatePicker,
  4. Tooltip,
  5. Button,
  6. AutoComplete,
  7. Input,
  8. Select,
  9. Spin,
  10. Table,
  11. message,
  12. Form,
  13. Tabs,
  14. Switch
  15. } from 'antd';
  16. import $ from 'jquery/src/ajax';
  17. import moment from 'moment';
  18. import { ShowModal, getApprovedType } from "@/tools.js";
  19. import { } from "@/dataDic";
  20. import ShowModalDiv from "@/showModal.jsx";
  21. import { ChooseList } from "../../order/orderNew/chooseList";
  22. import './index.less';
  23. const TabPane = Tabs.TabPane;
  24. const { RangePicker, } = DatePicker;
  25. const Unlimited = Form.create()(React.createClass({
  26. getInitialState() {
  27. return {
  28. searchValues: {},
  29. loading: false,
  30. exportPendingLoading: false,
  31. changeList: undefined,
  32. dataSource: [],
  33. pagination: {
  34. defaultCurrent: 1,
  35. defaultPageSize: 10,
  36. showQuickJumper: true,
  37. pageSize: 10,
  38. onChange: function (page) {
  39. this.loadData(page);
  40. }.bind(this),
  41. showTotal: function (total) {
  42. return '共' + total + '条数据';
  43. }
  44. },
  45. columns: [
  46. {
  47. title: "特批类型",
  48. dataIndex: "type",
  49. key: "type",
  50. width: 110,
  51. render: (text, record) => {
  52. return (
  53. <span>
  54. {getApprovedType(text ? text.split(",").map(Number) : [], record.typeExplain)}
  55. </span>
  56. );
  57. },
  58. },
  59. {
  60. title: "合同编号",
  61. dataIndex: "contractNo",
  62. key: "contractNo",
  63. },
  64. {
  65. title: '客户名称',
  66. dataIndex: 'userName',
  67. key: 'userName',
  68. render: (text, record) => {
  69. return (
  70. <Tooltip title={text}>
  71. <div style={{ maxWidth: 200 }}>{text}</div>
  72. </Tooltip>
  73. );
  74. }
  75. },
  76. {
  77. title: "订单部门",
  78. dataIndex: "depName",
  79. key: "depName",
  80. width: 100,
  81. },
  82. {
  83. title: "订单负责人",
  84. dataIndex: "salesmanName",
  85. key: "salesmanName"
  86. },
  87. {
  88. title: "签单日期",
  89. dataIndex: "time",
  90. key: "time",
  91. },
  92. {
  93. title: "下单时间",
  94. dataIndex: "createDate",
  95. key: "createTime",
  96. width: 80,
  97. render: (text) => {
  98. return <div style={{ textAlign: "center" }}>{text}</div>
  99. },
  100. },
  101. {
  102. title: "签单金额(万元)",
  103. dataIndex: "totalAmount",
  104. key: "totalAmount",
  105. render: (text) => {
  106. return <div style={{ textAlign: "center" }}>{text}</div>
  107. },
  108. },
  109. {
  110. title: "开票金额(万元)",
  111. dataIndex: "invoiceAmount",
  112. key: "invoiceAmount",
  113. render: (text) => {
  114. return <div style={{ textAlign: "center" }}>{text}</div>
  115. },
  116. },
  117. {
  118. title: "已收款(万元)",
  119. dataIndex: "settlementAmount",
  120. key: "settlementAmount",
  121. render: (text) => {
  122. return <div style={{ textAlign: "center" }}>{text}</div>
  123. },
  124. },
  125. {
  126. title: "应收款(万元)",
  127. dataIndex: "orderReceivables",
  128. key: "orderReceivables",
  129. render: (text) => {
  130. return <div style={{ textAlign: "center" }}>{text}</div>
  131. },
  132. },
  133. {
  134. title: "欠款(万元)",
  135. dataIndex: "orderArrears",
  136. key: "orderArrears",
  137. render: (text) => {
  138. return <div style={{ textAlign: "center" }}>{text}</div>
  139. },
  140. },
  141. {
  142. title: "总成本/实付",
  143. dataIndex: "costAmount",
  144. key: "costAmount",
  145. render: (text) => {
  146. return <div style={{ textAlign: "center" }}>{text}</div>
  147. },
  148. },
  149. {
  150. title: "公出时长(时)",
  151. dataIndex: "duration",
  152. key: "duration",
  153. },
  154. ],
  155. dataSource: [],
  156. departmentArr: [],
  157. };
  158. },
  159. componentWillMount() {
  160. // this.departmentList();
  161. // this.selectSuperId();
  162. this.loadData();
  163. },
  164. loadData(pageNo) {
  165. const { searchValues, pagination } = this.state;
  166. this.setState({
  167. loading: true,
  168. });
  169. let datas = Object.assign(searchValues, {
  170. pageNo: pageNo || 1,
  171. pageSize: pagination.pageSize,
  172. });
  173. $.ajax({
  174. method: "get",
  175. dataType: "json",
  176. crossDomain: false,
  177. url: globalConfig.context + "/api/admin/statistis/orderProject",
  178. data: datas,
  179. success: function (data) {
  180. ShowModal(this);
  181. this.setState({
  182. loading: false,
  183. });
  184. if (data.error && data.error.length === 0) {
  185. if (data.data.list) {
  186. pagination.current = data.data.pageNo;
  187. pagination.total = data.data.totalCount;
  188. if (data.data && data.data.list && !data.data.list.length) {
  189. pagination.current = 0;
  190. pagination.total = 0;
  191. }
  192. this.setState({
  193. dataSource: data.data.list,
  194. pagination: this.state.pagination,
  195. pageNo: data.data.pageNo,
  196. });
  197. } else {
  198. this.setState({
  199. dataSource: data.data,
  200. pagination: false,
  201. });
  202. }
  203. } else {
  204. message.warning(data.error[0].message);
  205. }
  206. }.bind(this),
  207. }).always(
  208. function () {
  209. this.setState({
  210. loading: false,
  211. });
  212. }.bind(this)
  213. );
  214. },
  215. // 部门
  216. departmentList() {
  217. this.setState({
  218. loading: true,
  219. });
  220. $.ajax({
  221. method: "get",
  222. dataType: "json",
  223. crossDomain: false,
  224. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  225. data: {},
  226. success: function (data) {
  227. let thedata = data.data;
  228. let theArr = [];
  229. if (!thedata) {
  230. if (data.error && data.error.length) {
  231. message.warning(data.error[0].message);
  232. }
  233. thedata = {};
  234. } else {
  235. thedata.map(function (item, index) {
  236. theArr.push({
  237. key: index,
  238. name: item.name,
  239. id: item.id,
  240. });
  241. });
  242. }
  243. this.setState({
  244. departmentArr: theArr,
  245. });
  246. }.bind(this),
  247. }).always(
  248. function () {
  249. this.setState({
  250. loading: false,
  251. });
  252. }.bind(this)
  253. );
  254. },
  255. // 项目类别
  256. selectSuperId() {
  257. $.ajax({
  258. method: "get",
  259. dataType: "json",
  260. crossDomain: false,
  261. url: globalConfig.context + "/api/admin/ProjectSize/getAllCname",
  262. data: {
  263. flag: 0
  264. },
  265. success: function (data) {
  266. let theArr = [];
  267. let thedata = data.data;
  268. if (!thedata) {
  269. if (data.error && data.error.length) {
  270. message.warning(data.error[0].message);
  271. }
  272. }
  273. for (let i = 0; i < data.data.length; i++) {
  274. let theData = data.data[i];
  275. theArr.push(
  276. <Select.Option value={theData.id} key={theData.cname}>
  277. {theData.cname}
  278. </Select.Option>
  279. );
  280. }
  281. this.setState({
  282. contactsOption: theArr,
  283. contactsOptionData: data.data,
  284. });
  285. }.bind(this)
  286. }).always(
  287. );
  288. },
  289. changeList(arr) {
  290. const newArr = [];
  291. let list = this.state.columns
  292. list.forEach((item) => {
  293. arr.forEach((val) => {
  294. if (val === item.title) {
  295. newArr.push(item);
  296. }
  297. });
  298. });
  299. this.setState({
  300. changeList: newArr,
  301. });
  302. },
  303. search() {
  304. this.loadData();
  305. },
  306. reset() {
  307. this.setState({
  308. searchValues: JSON.parse(JSON.stringify({})),
  309. }, () => {
  310. this.loadData();
  311. })
  312. },
  313. render() {
  314. const { searchValues } = this.state
  315. let departmentArr = this.state.departmentArr || [];
  316. return (
  317. <div className="user-content">
  318. <ShowModalDiv ShowModal={this.state.showModal} onClose={() => { this.setState({ showModal: false }) }} />
  319. <div className="content-title" style={{ marginBottom: 10 }}>
  320. <span style={{ fontWeight: 900, fontSize: 16 }}>无限制公出管理</span>
  321. </div>
  322. <div className="user-search">
  323. <Tabs
  324. defaultActiveKey="1"
  325. className="test">
  326. <TabPane tab="搜索" key="1">
  327. <div
  328. className="user-search"
  329. style={{
  330. marginTop: "10px",
  331. marginLeft: "10px",
  332. marginRight: "10px",
  333. }}
  334. >
  335. <Input
  336. placeholder="合同编号"
  337. style={{
  338. width: 220,
  339. marginRight: "10px",
  340. }}
  341. value={searchValues["contractNo"]
  342. ? searchValues["contractNo"]
  343. : ""}
  344. onChange={(e) => {
  345. searchValues["contractNo"] = e.target.value;
  346. this.setState({
  347. searchValues: searchValues,
  348. });
  349. }}
  350. />
  351. <Input
  352. placeholder="客户名称"
  353. style={{
  354. width: 220,
  355. marginRight: "10px",
  356. }}
  357. value={searchValues["userName"]
  358. ? searchValues["userName"]
  359. : ""}
  360. onChange={(e) => {
  361. searchValues["userName"] = e.target.value;
  362. this.setState({
  363. searchValues: searchValues,
  364. });
  365. }}
  366. />
  367. <Input
  368. placeholder="项目名称"
  369. value={searchValues["projectName"]
  370. ? searchValues["projectName"]
  371. : ""}
  372. style={{ width: 220, marginRight: 10 }}
  373. onChange={e => {
  374. searchValues["projectName"] = e.target.value
  375. this.setState({
  376. searchValues: searchValues,
  377. });
  378. }}
  379. />
  380. <Button type="primary" onClick={this.search} style={{ marginRight: 10 }}>
  381. 搜索
  382. </Button>
  383. <Button onClick={this.reset}>重置</Button>
  384. </div>
  385. </TabPane>
  386. <TabPane tab="更改表格显示数据" key="2">
  387. <div style={{ marginLeft: 10 }}>
  388. <ChooseList
  389. columns={this.state.columns}
  390. changeFn={this.changeList}
  391. changeList={this.state.changeList}
  392. top={55}
  393. margin={11}
  394. />
  395. </div>
  396. </TabPane>
  397. </Tabs>
  398. </div>
  399. <div className="patent-table">
  400. <Spin spinning={this.state.loading}>
  401. <Table
  402. columns={this.state.changeList
  403. ? this.state.changeList
  404. : this.state.columns}
  405. dataSource={this.state.dataSource}
  406. pagination={this.state.pagination}
  407. bordered
  408. />
  409. </Spin>
  410. </div>
  411. </div >
  412. );
  413. }
  414. }));
  415. export default Unlimited;