index.jsx 18 KB

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