index.jsx 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  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">
  282. <span style={{ fontWeight: 900, fontSize: 16 }}>核对专利</span>
  283. <Tabs
  284. defaultActiveKey="1"
  285. className="test"
  286. >
  287. <TabPane tab="搜索" key="1">
  288. <div className="user-search" style={{ marginLeft: 10 }}>
  289. <Input
  290. placeholder="客户名称"
  291. value={this.state.nameSearch}
  292. onChange={(e) => {
  293. this.setState({ nameSearch: e.target.value })
  294. }}
  295. />
  296. <Input
  297. placeholder="订单编号"
  298. value={this.state.orderNoSearch}
  299. onChange={(e) => {
  300. this.setState({ orderNoSearch: e.target.value })
  301. }}
  302. />
  303. <Input
  304. placeholder="合同编号"
  305. value={this.state.contractNoSearch}
  306. onChange={(e) => {
  307. this.setState({ contractNoSearch: e.target.value })
  308. }}
  309. />
  310. <Input
  311. placeholder="项目编号"
  312. value={this.state.taskNoSearch}
  313. onChange={(e) => {
  314. this.setState({ taskNoSearch: e.target.value })
  315. }}
  316. />
  317. <Select
  318. placeholder="选择部门"
  319. style={{ width: 150, marginRight: '10px' }}
  320. value={this.state.departmenttSearch}
  321. onChange={(e) => {
  322. this.setState({ departmenttSearch: e })
  323. }}
  324. >
  325. {this.state.departmentArr.map(function (item) {
  326. return (
  327. <Select.Option key={item.id}>{item.name}</Select.Option>
  328. )
  329. })}
  330. </Select>
  331. <Cascader
  332. placeholder="项目状态"
  333. style={{ width: 150, marginRight: '10px' }}
  334. options={projectStatusCascader}
  335. value={this.state.projectStatusSearch}
  336. onChange={(e)=>{
  337. this.setState({
  338. projectStatusSearch: e
  339. })
  340. }}
  341. />
  342. <Select
  343. placeholder="特批状态"
  344. style={{ width: 150, marginRight: '10px' }}
  345. value={this.state.approvalSearch}
  346. onChange={(e) => {
  347. this.setState({ approvalSearch: e })
  348. }}
  349. >
  350. <Select.Option key={0}>非特批</Select.Option>
  351. <Select.Option key={1}>特批</Select.Option>
  352. </Select>
  353. <Select
  354. placeholder="外包状态"
  355. style={{ width: 150, marginRight: '10px' }}
  356. value={this.state.outsourceStatusSearch}
  357. onChange={(e) => {
  358. this.setState({ outsourceStatusSearch: e })
  359. }}
  360. >
  361. <Select.Option key={0}>外包待审核</Select.Option>
  362. <Select.Option key={2}>外包审核驳回</Select.Option>
  363. <Select.Option key={999}>全部</Select.Option>
  364. </Select>
  365. <Button type="primary" onClick={()=>{
  366. this.loadData();
  367. }}>
  368. 搜索
  369. </Button>
  370. <Button
  371. onClick={(e) => {
  372. this.reset(true)
  373. }}
  374. >
  375. 重置
  376. </Button>
  377. </div>
  378. </TabPane>
  379. <TabPane tab="更改表格显示数据" key="2">
  380. <div style={{ marginLeft: 10 }}>
  381. <ChooseList
  382. columns={this.state.columns}
  383. changeFn={this.changeList}
  384. changeList={this.state.changeList}
  385. top={55}
  386. margin={11}
  387. />
  388. </div>
  389. </TabPane>
  390. </Tabs>
  391. <div className="patent-table">
  392. <Spin spinning={this.state.loading}>
  393. <Table
  394. size="middle"
  395. columns={
  396. this.state.changeList.length !== 0
  397. ? this.state.changeList
  398. : this.state.columns
  399. }
  400. dataSource={this.state.dataSource}
  401. pagination={this.state.pagination}
  402. onRowClick={(record)=>{
  403. this.setState({
  404. orderVisible:true,
  405. orderNo:record.orderNo
  406. })
  407. }}
  408. />
  409. </Spin>
  410. </div>
  411. </div>
  412. {this.state.visible ? <CheckInfor
  413. visible={this.state.visible}
  414. infor={this.state.infor}
  415. onCancel={()=>{
  416. this.setState({
  417. visible:false,
  418. infor:{}
  419. })
  420. this.loadData(this.state.pageNo);
  421. }}
  422. /> : null}
  423. {this.state.orderVisible ? <OrderInfor
  424. visible={this.state.orderVisible}
  425. orderNo={this.state.orderNo}
  426. onCancel={()=>{
  427. this.setState({
  428. orderVisible:false,
  429. orderNo:''
  430. })
  431. }}
  432. /> : null}
  433. </div>
  434. )
  435. }
  436. }
  437. export default BusinessManagement;