index.jsx 14 KB

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