index.jsx 18 KB

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