patentSchedule.jsx 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. import React,{ Component } from 'react';
  2. import {Button, DatePicker, Select, Table, Input, Modal, Spin, message} from "antd";
  3. import moment from "moment";
  4. import $ from "jquery";
  5. const { Option } = Select
  6. class PatentSchedule extends Component{
  7. constructor(props) {
  8. super(props);
  9. this.state={
  10. columns: [
  11. {
  12. title: '批次',
  13. dataIndex: 'key',
  14. key: 'key',
  15. },
  16. {
  17. title: '专利号',
  18. dataIndex: 'patentNo',
  19. key: 'patentNo',
  20. render: (text, record) => {
  21. return !record.isChange ? text : <Input
  22. size={'small'}
  23. style={{
  24. width: '100px'
  25. }}
  26. onChange={(e)=>{
  27. this.changeEvidence(e.target.value,record.key,'patentNo')
  28. }}/>
  29. }
  30. },
  31. {
  32. title: '专利名称',
  33. dataIndex: 'patentName',
  34. key: 'patentName',
  35. render: (text, record) => {
  36. return !record.isChange ? text : <Input style={{
  37. width: '100px'
  38. }} size={'small'} onChange={(e)=>{
  39. this.changeEvidence(e.target.value,record.key,'patentName')
  40. }}/>
  41. }
  42. },
  43. {
  44. title: '受理时间',
  45. dataIndex: 'acceptTimes',
  46. key: 'acceptTimes',
  47. render: (text, record) => {
  48. return !record.isChange ? text : <DatePicker
  49. size={'small'}
  50. style={{
  51. marginTop: '4px',
  52. width: '100px'
  53. }}
  54. showTime
  55. format="YYYY-MM-DD"
  56. onChange={(data, dataString) => {
  57. this.changeEvidence(dataString,record.key,'acceptTimes')
  58. }}
  59. />
  60. }
  61. },
  62. {
  63. title: '授权时间',
  64. dataIndex: 'authorizeTimes',
  65. key: 'authorizeTimes',
  66. render: (text, record) => {
  67. return !record.isChange ? text : <DatePicker
  68. size={'small'}
  69. style={{
  70. marginTop: '4px',
  71. width: '100px'
  72. }}
  73. showTime
  74. format="YYYY-MM-DD"
  75. onChange={(data, dataString) => {
  76. this.changeEvidence(dataString,record.key,'authorizeTimes')
  77. }}
  78. />
  79. }
  80. },
  81. {
  82. title: '下证时间',
  83. dataIndex: 'licenceTimes',
  84. key: 'licenceTimes',
  85. render: (text, record) => {
  86. return !record.isChange ? text : <DatePicker
  87. size={'small'}
  88. style={{
  89. marginTop: '4px',
  90. width: '100px'
  91. }}
  92. showTime
  93. format="YYYY-MM-DD"
  94. onChange={(data, dataString) => {
  95. this.changeEvidence(dataString,record.key,'licenceTimes')
  96. }}
  97. />
  98. }
  99. },
  100. {
  101. title: '通过/驳回',
  102. dataIndex: 'status',
  103. key: 'status',
  104. render: (text, record) => {
  105. return !record.isChange ? text === 1 ? '通过' : '驳回' : <Select size={'small'} onChange={(v)=>{
  106. this.changeEvidence(v,record.key,'status')
  107. }}>
  108. <Option value={1}>通过</Option>
  109. <option value={2}>驳回</option>
  110. </Select>
  111. }
  112. },
  113. {
  114. title: '操作',
  115. dataIndex: 'h',
  116. key: 'h',
  117. render: (text, record) => {
  118. return (
  119. <span>
  120. <Button
  121. size={'small'}
  122. style={{
  123. marginRight:'10px',
  124. color: '#ffffff',
  125. background: '#f00',
  126. border: 'none',
  127. }}
  128. onClick={()=>{
  129. let _this = this;
  130. if(record.isChange){
  131. this.state.dataSource.splice(record.key-1,1)
  132. this.setState({
  133. dataSource: this.state.dataSource
  134. })
  135. }else{
  136. confirm({
  137. title: '提醒',
  138. content: '确定要删除吗?',
  139. onOk() {
  140. _this.delectTaskProgress(record.id)
  141. }
  142. })
  143. }
  144. }}
  145. >
  146. 删除
  147. </Button>
  148. {record.isChange &&<Button size={'small'} type='primary' onClick={()=>{
  149. this.createTaskProgress(record);
  150. console.log(record)
  151. }}>保存</Button> }
  152. </span>
  153. )
  154. }
  155. }
  156. ],
  157. dataSource: [],
  158. visible: false,
  159. columnsA: [
  160. {
  161. title: '时间',
  162. dataIndex: 'h',
  163. key: 'h',
  164. },
  165. {
  166. title: '操作类型',
  167. dataIndex: 'h',
  168. key: 'h',
  169. render: (text, record) => {
  170. return text === 0 ? '新增' : '删除'
  171. }
  172. },
  173. {
  174. title: '专利号',
  175. dataIndex: 'h',
  176. key: 'h',
  177. }
  178. ],
  179. dataSourceA: [],
  180. progressLogLoading: false,
  181. };
  182. this.changeEvidence = this.changeEvidence.bind(this);
  183. this.createTaskProgress = this.createTaskProgress.bind(this);
  184. this.selectTaskProgressLog = this.selectTaskProgressLog.bind(this);
  185. this.delectTaskProgress = this.delectTaskProgress.bind(this);
  186. }
  187. changeEvidence(value,index,key){
  188. this.state.dataSource[index-1][key] = value;
  189. this.setState({
  190. dataSource: this.state.dataSource
  191. })
  192. }
  193. //新增申报进度
  194. createTaskProgress(record) {
  195. delete record.isChange;
  196. delete record.key;
  197. record.taskId = this.props.taskId;
  198. record.alreadyNumber = 1;
  199. $.ajax({
  200. method: 'post',
  201. dataType: 'json',
  202. crossDomain: false,
  203. url: globalConfig.context + '/api/admin/orderProject/createTaskProgress',
  204. data: record,
  205. success: function (data) {
  206. if (data.error.length) {
  207. if (data.error && data.error.length) {
  208. message.warning(data.error[0].message)
  209. }
  210. }else{
  211. message.success('添加成功');
  212. }
  213. }.bind(this),
  214. }).always(
  215. function () {
  216. this.setState({
  217. loading: false,
  218. })
  219. }.bind(this)
  220. )
  221. }
  222. //申报进度日志
  223. selectTaskProgressLog() {
  224. this.setState({
  225. loading: true,
  226. })
  227. $.ajax({
  228. method: 'get',
  229. dataType: 'json',
  230. crossDomain: false,
  231. url: globalConfig.context + '/api/admin/orderProject/selectTaskProgressLog',
  232. data: {
  233. tid: this.props.taskId,
  234. },
  235. success: function (data) {
  236. let theArr = []
  237. if (data.error.length || data.data.list === '') {
  238. if (data.error && data.error.length) {
  239. message.warning(data.error[0].message)
  240. }
  241. } else {
  242. for (let i = 0; i < data.data.length; i++) {
  243. let thisdata = data.data[i];
  244. thisdata.key = i;
  245. theArr.push(thisdata)
  246. }
  247. }
  248. this.setState({
  249. dataSourceA: theArr,
  250. })
  251. }.bind(this),
  252. }).always(
  253. function () {
  254. this.setState({
  255. loading: false,
  256. })
  257. }.bind(this)
  258. )
  259. }
  260. // 删除申报进度
  261. delectTaskProgress(id) {
  262. this.setState({
  263. loading: true,
  264. })
  265. $.ajax({
  266. method: 'post',
  267. dataType: 'json',
  268. crossDomain: false,
  269. url: globalConfig.context + '/api/admin/orderProject/delectTaskProgress',
  270. data: {
  271. id
  272. },
  273. success: function (data) {
  274. if (data.error.length) {
  275. if (data.error && data.error.length) {
  276. message.warning(data.error[0].message)
  277. }
  278. }else{
  279. message.success('删除成功');
  280. }
  281. }.bind(this),
  282. }).always(
  283. function () {
  284. this.setState({
  285. loading: false,
  286. })
  287. }.bind(this)
  288. )
  289. }
  290. componentDidMount() {
  291. }
  292. render() {
  293. return (
  294. <div>
  295. <div style={{
  296. display:'flex',
  297. alignItems:'center',
  298. paddingLeft: '7%',
  299. paddingRight: '10%',
  300. color: '#000',
  301. fontWeight: 400,
  302. }}>
  303. <div style={{paddingRight:'10px'}}>派单项目数:20</div>
  304. <div style={{paddingRight:'10px'}}>受理数:20</div>
  305. <div style={{paddingRight:'10px'}}>下证数(即授权数):20</div>
  306. <div>驳回数:20</div>
  307. <div style={{display:'flex',alignItems:'center',marginLeft:'auto'}}>
  308. <Button
  309. type="primary"
  310. style={{ marginRight: '15px' }}
  311. onClick={()=>{
  312. this.state.dataSource.push({
  313. key: this.state.dataSource.length+1,
  314. isChange: true,
  315. })
  316. this.setState({
  317. dataSource: this.state.dataSource
  318. })
  319. }}
  320. >
  321. 增加专利信息
  322. </Button>
  323. <Button
  324. type="primary"
  325. onClick={()=>{
  326. this.selectTaskProgressLog();
  327. this.setState({
  328. visible: true
  329. })
  330. }}
  331. >
  332. 操作日志
  333. </Button>
  334. </div>
  335. </div>
  336. <div style={{
  337. paddingLeft: '7%',
  338. paddingRight: '10%',
  339. paddingTop:'10px'
  340. }}>
  341. <Spin spinning={this.state.progressLogLoading}>
  342. <Table
  343. columns={this.state.columns}
  344. scroll={{ x: 'max-content', y: 0 }}
  345. dataSource={this.state.dataSource}
  346. pagination={false}
  347. bordered
  348. size={'small'}
  349. />
  350. </Spin>
  351. </div>
  352. {this.state.visible ? <Modal
  353. width="800px"
  354. visible={this.state.visible}
  355. onCancel={()=>{
  356. this.setState({
  357. visible: false
  358. })
  359. }}
  360. title="操作日志"
  361. footer=""
  362. className="admin-desc-content"
  363. >
  364. <div className="patent-table patent-table-center">
  365. <Spin spinning={this.state.loading}>
  366. <Table
  367. columns={this.state.columnsA}
  368. dataSource={this.state.dataSourceA}
  369. pagination={false}
  370. bordered
  371. size="small"
  372. />
  373. </Spin>
  374. </div>
  375. </Modal> : null}
  376. </div>
  377. )
  378. }
  379. }
  380. export default PatentSchedule;