index.jsx 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. import React, { Component } from "react";
  2. import { Button, Cascader, Input, message, Select, Spin, Table, Tabs, Tooltip } from "antd";
  3. import $ from "jquery/src/ajax";
  4. import { ChooseList } from "../../../order/orderNew/chooseList";
  5. import { projectStatusCascader } from '@/dataDic.js';
  6. import CheckInfor from './checkInfor';
  7. import OrderInfor from "./orderInfor";
  8. import Cascaders from "../../../../common/cascaders"
  9. const TabPane = Tabs.TabPane;
  10. class BusinessManagement extends Component {
  11. constructor(props) {
  12. super(props);
  13. this.state = {
  14. changeList: [],
  15. pageNo: 1,
  16. columns: [
  17. {
  18. title: '项目编号',
  19. dataIndex: 'id',
  20. key: 'id',
  21. // fixed: 'left',
  22. render: (text, record) => {
  23. if (record.splitStatus == 2) {
  24. return <span>{record.splitSuper + '-' + record.splitId}</span>
  25. } else {
  26. return text
  27. }
  28. },
  29. },
  30. {
  31. title: '项目名称',
  32. dataIndex: 'commodityName',
  33. key: 'commodityName',
  34. // fixed: 'left',
  35. width: 100,
  36. render: text => {
  37. return (
  38. <Tooltip title={text}>
  39. <div style={{
  40. maxWidth: '100px',
  41. overflow: 'hidden',
  42. textOverflow: "ellipsis",
  43. whiteSpace: 'nowrap',
  44. }}>{text}</div>
  45. </Tooltip>
  46. )
  47. }
  48. },
  49. {
  50. title: '项目数量',
  51. dataIndex: 'commodityQuantity',
  52. key: 'commodityQuantity',
  53. width: 50,
  54. },
  55. {
  56. title: '订单编号',
  57. dataIndex: 'orderNo',
  58. key: 'orderNo',
  59. },
  60. {
  61. title: '合同编号',
  62. dataIndex: 'contractNo',
  63. key: 'contractNo',
  64. },
  65. {
  66. title: '客户名称',
  67. dataIndex: 'userName',
  68. key: 'userName',
  69. className: 'userName',
  70. render: text => {
  71. return (
  72. <Tooltip title={text}>
  73. <div style={{
  74. maxWidth: '100px',
  75. overflow: 'hidden',
  76. textOverflow: "ellipsis",
  77. whiteSpace: 'nowrap',
  78. }}>{text}</div>
  79. </Tooltip>
  80. )
  81. }
  82. },
  83. {
  84. title: '业务类别',
  85. dataIndex: 'cname',
  86. key: 'cname',
  87. },
  88. {
  89. title: '分配时间',
  90. dataIndex: 'taskDistributionTime',
  91. key: 'taskDistributionTime',
  92. },
  93. {
  94. title: '订单部门',
  95. dataIndex: 'depName',
  96. key: 'depName',
  97. },
  98. {
  99. title: '操作',
  100. dataIndex: 'operation',
  101. key: 'operation',
  102. render: (text, record) => {
  103. return (
  104. <Button
  105. type="primary"
  106. style={{ margin: '0 10px' }}
  107. onClick={(e) => {
  108. e.stopPropagation();
  109. this.setState({
  110. visible: true,
  111. infor: record
  112. })
  113. }}
  114. >
  115. 核对专利
  116. </Button>
  117. )
  118. }
  119. },
  120. ],
  121. dataSource: [],
  122. infor: {},
  123. nameSearch: '',
  124. orderNoSearch: '',
  125. contractNoSearch: undefined,
  126. taskNoSearch: '',
  127. departmenttSearch: undefined,
  128. projectStatusSearch: [], //项目状态
  129. approvalSearch: undefined,
  130. outsourceStatusSearch: [],
  131. pagination: {
  132. defaultCurrent: 1,
  133. defaultPageSize: 10,
  134. showQuickJumper: true,
  135. pageSize: 10,
  136. onChange: function (page) {
  137. this.loadData(page)
  138. }.bind(this),
  139. showTotal: function (total) {
  140. return '共' + total + '条数据'
  141. },
  142. },
  143. departmentArr: []
  144. }
  145. this.loadData = this.loadData.bind(this);
  146. this.changeList = this.changeList.bind(this);
  147. this.departmentList = this.departmentList.bind(this);
  148. this.reset = this.reset.bind(this);
  149. }
  150. componentDidMount() {
  151. this.loadData();
  152. this.departmentList();
  153. }
  154. loadData(pageNo) {
  155. this.setState({
  156. loading: true,
  157. });
  158. $.ajax({
  159. method: "get",
  160. dataType: "json",
  161. crossDomain: false,
  162. url: globalConfig.context + "/api/admin/orderProject/selectProjectCheck",
  163. data: {
  164. pageNo: pageNo || 1,
  165. pageSize: this.state.pagination.pageSize,
  166. name: this.state.nameSearch || undefined, //客户名称
  167. deps: this.state.departmenttSearch, //订单部门
  168. orderNo: this.state.orderNoSearch || undefined, //订单编号
  169. contractNo: this.state.contractNoSearch, //合同编号
  170. taskId: this.state.taskNoSearch || undefined, //项目编号
  171. taskStatus: this.state.taskStatuSearch, //项目状态
  172. projectStatus: this.state.projectStatusSearch && this.state.projectStatusSearch.length > 0 ?
  173. (typeof this.state.projectStatusSearch[0] === 'string' ? this.state.projectStatusSearch[1] : this.state.projectStatusSearch[0]) : undefined, //项目状态
  174. adminName: this.state.adminName, //项目受理人
  175. approval: this.state.approvalSearch, //特批状态搜索
  176. outsourceStatus:
  177. this.state.outsourceStatusSearch >= 999
  178. ? undefined
  179. : this.state.outsourceStatusSearch, //外包状态搜索
  180. },
  181. success: function (data) {
  182. let theArr = []
  183. if (data.error.length === 0) {
  184. for (let i = 0; i < data.data.list.length; i++) {
  185. let thisdata = data.data.list[i];
  186. thisdata.key = i;
  187. theArr.push(thisdata)
  188. }
  189. this.state.pagination.current = data.data.pageNo
  190. this.state.pagination.total = data.data.totalCount
  191. if (data.data && data.data.list && !data.data.list.length) {
  192. this.state.pagination.current = 0
  193. this.state.pagination.total = 0
  194. }
  195. this.setState({
  196. dataSource: theArr,
  197. pagination: this.state.pagination,
  198. pageNo: data.data.pageNo
  199. })
  200. } else {
  201. message.warning(data.error[0].message)
  202. }
  203. }.bind(this),
  204. }).always(
  205. function () {
  206. this.setState({
  207. loading: false,
  208. });
  209. }.bind(this)
  210. );
  211. }
  212. changeList(arr) {
  213. const newArr = [];
  214. this.state.columns.forEach(item => {
  215. arr.forEach(val => {
  216. if (val === item.title) {
  217. newArr.push(item);
  218. }
  219. });
  220. });
  221. this.setState({
  222. changeList: newArr
  223. });
  224. }
  225. //部门
  226. departmentList() {
  227. this.setState({
  228. loading: true,
  229. })
  230. $.ajax({
  231. method: 'get',
  232. dataType: 'json',
  233. crossDomain: false,
  234. url: globalConfig.context + '/api/admin/organization/selectSuperId',
  235. data: {},
  236. success: function (data) {
  237. let thedata = data.data
  238. let theArr = []
  239. if (!thedata) {
  240. if (data.error && data.error.length) {
  241. message.warning(data.error[0].message)
  242. }
  243. thedata = {}
  244. } else {
  245. thedata.map(function (item, index) {
  246. theArr.push({
  247. key: index,
  248. name: item.name,
  249. id: item.id,
  250. })
  251. })
  252. }
  253. this.setState({
  254. departmentArr: theArr,
  255. })
  256. }.bind(this),
  257. }).always(
  258. function () {
  259. this.setState({
  260. loading: false,
  261. })
  262. }.bind(this)
  263. )
  264. }
  265. reset() {
  266. this.setState({
  267. nameSearch: '',
  268. orderNoSearch: '',
  269. contractNoSearch: undefined,
  270. taskNoSearch: '',
  271. departmenttSearch: undefined,
  272. projectStatusSearch: [], //项目状态
  273. approvalSearch: undefined,
  274. outsourceStatusSearch: [],
  275. }, () => {
  276. this.Cascaders.empty();
  277. this.loadData();
  278. })
  279. }
  280. render() {
  281. return (
  282. <div className="user-content">
  283. <div className="content-title" style={{ marginBottom: 10 }}>
  284. <span style={{ fontWeight: 900, fontSize: 16 }}>核对专利</span>
  285. </div>
  286. <div className="user-search">
  287. <Tabs
  288. defaultActiveKey="1"
  289. className="test"
  290. >
  291. <TabPane tab="搜索" key="1">
  292. <div className="user-search" style={{ marginLeft: 10 }}>
  293. <Input
  294. placeholder="客户名称"
  295. value={this.state.nameSearch}
  296. onChange={(e) => {
  297. this.setState({ nameSearch: e.target.value })
  298. }}
  299. />
  300. <Input
  301. placeholder="订单编号"
  302. value={this.state.orderNoSearch}
  303. onChange={(e) => {
  304. this.setState({ orderNoSearch: e.target.value })
  305. }}
  306. />
  307. <Input
  308. placeholder="合同编号"
  309. value={this.state.contractNoSearch}
  310. onChange={(e) => {
  311. this.setState({ contractNoSearch: e.target.value })
  312. }}
  313. />
  314. <Input
  315. placeholder="项目编号"
  316. value={this.state.taskNoSearch}
  317. onChange={(e) => {
  318. this.setState({ taskNoSearch: e.target.value })
  319. }}
  320. />
  321. <Cascaders
  322. ref={node => this.Cascaders = node}
  323. placeholder="选择部门"
  324. id="id"
  325. name="name"
  326. children="list"
  327. height={28}
  328. onSel={(e) => {
  329. this.setState({
  330. departmenttSearch: JSON.stringify(e),
  331. });
  332. }}
  333. />
  334. {/* <Select
  335. placeholder="选择部门"
  336. style={{ width: 200, marginRight: '10px' }}
  337. value={this.state.departmenttSearch}
  338. onChange={(e) => {
  339. this.setState({ departmenttSearch: e })
  340. }}
  341. >
  342. {this.state.departmentArr.map(function (item) {
  343. return (
  344. <Select.Option key={item.id}>{item.name}</Select.Option>
  345. )
  346. })}
  347. </Select> */}
  348. <Cascader
  349. placeholder="项目状态"
  350. style={{ width: 150, marginRight: '10px' }}
  351. options={projectStatusCascader}
  352. value={this.state.projectStatusSearch}
  353. onChange={(e) => {
  354. this.setState({
  355. projectStatusSearch: e
  356. })
  357. }}
  358. />
  359. <Select
  360. placeholder="特批状态"
  361. style={{ width: 150, marginRight: '10px' }}
  362. value={this.state.approvalSearch}
  363. onChange={(e) => {
  364. this.setState({ approvalSearch: e })
  365. }}
  366. >
  367. <Select.Option key={0}>非特批</Select.Option>
  368. <Select.Option key={1}>特批</Select.Option>
  369. </Select>
  370. <Select
  371. placeholder="外包状态"
  372. style={{ width: 150, marginRight: '10px' }}
  373. value={this.state.outsourceStatusSearch}
  374. onChange={(e) => {
  375. this.setState({ outsourceStatusSearch: e })
  376. }}
  377. >
  378. <Select.Option key={0}>外包待审核</Select.Option>
  379. <Select.Option key={2}>外包审核驳回</Select.Option>
  380. <Select.Option key={999}>全部</Select.Option>
  381. </Select>
  382. <Button type="primary" onClick={() => {
  383. this.loadData();
  384. }}>
  385. 搜索
  386. </Button>
  387. <Button
  388. onClick={(e) => {
  389. this.reset(true)
  390. }}
  391. >
  392. 重置
  393. </Button>
  394. </div>
  395. </TabPane>
  396. <TabPane tab="更改表格显示数据" key="2">
  397. <div style={{ marginLeft: 10 }}>
  398. <ChooseList
  399. columns={this.state.columns}
  400. changeFn={this.changeList}
  401. changeList={this.state.changeList}
  402. top={55}
  403. margin={11}
  404. />
  405. </div>
  406. </TabPane>
  407. </Tabs>
  408. </div>
  409. <div className="patent-table">
  410. <Spin spinning={this.state.loading}>
  411. <Table
  412. size="middle"
  413. columns={
  414. this.state.changeList.length !== 0
  415. ? this.state.changeList
  416. : this.state.columns
  417. }
  418. dataSource={this.state.dataSource}
  419. pagination={this.state.pagination}
  420. onRowClick={(record) => {
  421. this.setState({
  422. orderVisible: true,
  423. orderNo: record.orderNo
  424. })
  425. }}
  426. />
  427. </Spin>
  428. </div>
  429. {this.state.visible ? <CheckInfor
  430. visible={this.state.visible}
  431. infor={this.state.infor}
  432. onCancel={() => {
  433. this.setState({
  434. visible: false,
  435. infor: {}
  436. })
  437. this.loadData(this.state.pageNo);
  438. }}
  439. /> : null}
  440. {this.state.orderVisible ? <OrderInfor
  441. visible={this.state.orderVisible}
  442. orderNo={this.state.orderNo}
  443. onCancel={() => {
  444. this.setState({
  445. orderVisible: false,
  446. orderNo: ''
  447. })
  448. }}
  449. /> : null}
  450. </div>
  451. )
  452. }
  453. }
  454. export default BusinessManagement;