comPatentChange.jsx 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. import React from 'react';
  2. import { Icon, Modal, message, Spin, Input, Select, DatePicker, Button, Row, Col, Table, Form } from 'antd';
  3. import './comprehensive.less';
  4. import ajax from 'jquery/src/ajax/xhr.js';
  5. import $ from 'jquery/src/ajax';
  6. import { copyrightStateList } from '../../../dataDic.js';
  7. import { getCopyrightState, getTime } from '../../../tools.js';
  8. const CopyrightDescForm = Form.create()(React.createClass({
  9. getInitialState() {
  10. return {
  11. visible: false,
  12. loading: false,
  13. stateOption: [],
  14. stateTable: [],
  15. contactsOption: [],
  16. stateColumns: [{
  17. title: '申请状态',
  18. dataIndex: 'status',
  19. key: 'status',
  20. render: (text) => { return getCopyrightState(text) }
  21. }, {
  22. title: '处理时间',
  23. dataIndex: 'recordTimeFormattedDate',
  24. key: 'recordTimeFormattedDate',
  25. }, {
  26. title: '负责人',
  27. dataIndex: 'principal',
  28. key: 'principal',
  29. }, {
  30. title: '操作人',
  31. dataIndex: 'operator',
  32. key: 'operator',
  33. }, {
  34. title: '备注',
  35. dataIndex: 'comment',
  36. key: 'comment',
  37. }]
  38. };
  39. },
  40. componentWillMount() {
  41. let _me = this;
  42. copyrightStateList.map(function (item) {
  43. _me.state.stateOption.push(
  44. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  45. )
  46. });
  47. this.loadData();
  48. },
  49. loadData(uid, id) {
  50. this.setState({
  51. loading: true
  52. });
  53. $.when($.ajax({
  54. method: "get",
  55. dataType: "json",
  56. crossDomain: false,
  57. cache: false,
  58. url: globalConfig.context + "/api/admin/copyright/logs",
  59. data: {
  60. id: id || this.props.data.id
  61. }
  62. }), $.ajax({
  63. method: "post",
  64. dataType: "json",
  65. crossDomain: false,
  66. cache: false,
  67. url: globalConfig.context + "/api/admin/getContacts",
  68. data: {
  69. uid: uid || this.props.data.uid
  70. }
  71. }), $.ajax({
  72. method: "get",
  73. dataType: "json",
  74. crossDomain: false,
  75. cache: false,
  76. url: globalConfig.context + "/api/admin/copyright/detail",
  77. data: {
  78. id: id || this.props.data.id
  79. }
  80. })).done((data1, data2, data3) => {
  81. let _me = this;
  82. //状态流转table
  83. if (data1[0].error && data1[0].error.length) {
  84. message.warning(data1[0].error[0].message);
  85. return;
  86. };
  87. this.state.stateTable = [];
  88. data1[0].data.map(function (item, i) {
  89. _me.state.stateTable.push({
  90. key: i,
  91. recordTimeFormattedDate: item.recordTimeFormattedDate,
  92. status: item.status,
  93. principal: item.principal,
  94. operator: item.operator,
  95. comment: item.comment
  96. });
  97. });
  98. //获取联系人
  99. if (data2[0].error && data2[0].error.length) {
  100. message.warning(data2[0].error[0].message);
  101. return;
  102. };
  103. this.state.contactsOption = [];
  104. for (let item in data2[0].data) {
  105. let theData = data2[0].data[item];
  106. _me.state.contactsOption.push(
  107. <Select.Option value={item} key={theData}>{theData}</Select.Option>
  108. );
  109. };
  110. //获取详细数据
  111. if (!data3[0].data && data3[0].error && data3[0].error.length) {
  112. message.warning(data3[0].error[0].message);
  113. return;
  114. };
  115. let detailData = data3[0].data;
  116. this.setState({
  117. id: detailData.id,
  118. province: detailData.province,
  119. unitName: detailData.unitName,
  120. serialNumber: detailData.serialNumber,
  121. createTime: detailData.createTime,
  122. acceptTime: detailData.acceptTime,
  123. principal: detailData.principal,
  124. contact: detailData.contact,
  125. copyrightName: detailData.copyrightName,
  126. status: detailData.status,
  127. comment: detailData.comment,
  128. workIssue: detailData.workIssue,
  129. outsource: detailData.outsource,
  130. inUrgent: detailData.inUrgent,
  131. authorizedDate: detailData.authorizedDate,
  132. fisrtContact: detailData.fisrtContact,
  133. secondContact: detailData.secondContact,
  134. thirdContact: detailData.thirdContact,
  135. city: detailData.city,
  136. area: detailData.area,
  137. postcode: detailData.postcode,
  138. certificateUrl: detailData.certificateUrl,
  139. applicationUrl: detailData.applicationUrl,
  140. certificateUrlDownloadFileName: detailData.certificateUrlDownloadFileName,
  141. applicationUrlDownloadFileName: detailData.applicationUrlDownloadFileName,
  142. authorizedDateFormattedDate: detailData.authorizedDateFormattedDate,
  143. createTimeFormattedDate: detailData.createTimeFormattedDate,
  144. acceptTimeFormattedDate: detailData.acceptTimeFormattedDate,
  145. });
  146. }).always(function () {
  147. this.setState({
  148. loading: false
  149. });
  150. }.bind(this));
  151. },
  152. componentWillReceiveProps(nextProps) {
  153. if (!this.props.visible && nextProps.visible) {
  154. this.loadData(nextProps.data.uid, nextProps.data.id);
  155. };
  156. },
  157. handleSubmit(e) {
  158. e.preventDefault();
  159. this.props.form.validateFields((err, values) => {
  160. if (values.state || values.principal || values.recordTime || values.comment) {
  161. if (!values.state && !values.principal && !values.recordTime) {
  162. message.warning("请填写完整的状态流转信息!");
  163. return;
  164. };
  165. };
  166. if (!err) {
  167. this.props.spinState(true);
  168. $.ajax({
  169. method: "POST",
  170. dataType: "json",
  171. crossDomain: false,
  172. url: globalConfig.context + "/api/admin/copyright/modify",
  173. data: {
  174. "id": this.props.data.id,
  175. "contact": values.contact, // 联系人, 1,2,3
  176. //"copyrightInfo": values.copyrightInfo, // 软著简介,size 0-255
  177. "copyrightName": values.copyrightName, // 软著名称, size 0-60
  178. "outsource": values.outsource, // 外包公司, size 0-60
  179. "workIssue": values.workIssue, // 派单信息, size 0-128
  180. "inUrgent": values.inUrgent, // 加急天数,
  181. "status": values.status, // 状态
  182. "comment": values.comment, // 备注 size 0-128
  183. "recordTime": values.recordTime ? values.recordTime.format("YYYY-MM-DD HH:mm:ss") : undefined, // 状态修改时间 yyyy-MM-dd HH:mm:ss
  184. "principal": values.principal // 负责人id
  185. }
  186. }).done(function (data) {
  187. if (!data.error.length) {
  188. message.success('保存成功!');
  189. this.props.clickOk();
  190. this.props.form.resetFields();
  191. this.props.spinState(false);
  192. } else {
  193. message.warning(data.error[0].message);
  194. this.props.spinState(false);
  195. }
  196. }.bind(this));
  197. }
  198. });
  199. },
  200. render() {
  201. const FormItem = Form.Item;
  202. const { getFieldDecorator } = this.props.form;
  203. const theData = this.state;
  204. const formItemLayout = {
  205. labelCol: { span: 6 },
  206. wrapperCol: { span: 12 },
  207. };
  208. const _me = this;
  209. return (
  210. <Form onSubmit={this.handleSubmit} id="CopyrightDesc-form">
  211. <Row className="express-desc-row">
  212. <Col span={4}>公司名称</Col>
  213. <Col span={4}>{theData.unitName}</Col>
  214. <Col span={4}>公司组织机构代码</Col>
  215. <Col span={4}>{theData.unitNumber}</Col>
  216. </Row>
  217. <Row className="express-desc-row">
  218. <Col span={4}>公司地址</Col>
  219. <Col span={4}>{theData.province}/{theData.city}/{theData.area}</Col>
  220. <Col span={4}>联系人</Col>
  221. <Col span={4}>
  222. {getFieldDecorator('contact', {
  223. rules: [{ required: true, message: '此项为必填项!' }],
  224. initialValue: theData.contact
  225. })(
  226. <Select
  227. style={{ display: 'inline-block', width: '200px' }}
  228. placeholder='选择一个联系人'>
  229. {this.state.contactsOption}
  230. </Select>
  231. )}
  232. </Col>
  233. </Row>
  234. <Row className="express-desc-row">
  235. <Col span={4}>编号</Col>
  236. <Col span={4}>{theData.serialNumber}</Col>
  237. <Col span={4}>外包公司</Col>
  238. <Col span={4}>
  239. {getFieldDecorator('outsource', {
  240. initialValue: theData.outsource
  241. })(
  242. <Input placeholder="请输入外包公司" />
  243. )}
  244. </Col>
  245. </Row>
  246. <Row className="express-desc-row">
  247. <Col span={3}>派单详情</Col>
  248. <Col span={16}>
  249. {getFieldDecorator('workIssue', {
  250. initialValue: theData.workIssue
  251. })(
  252. <Input type="textarea"
  253. placeholder="多行输入"
  254. rows={6} />
  255. )}
  256. </Col>
  257. </Row>
  258. <Row className="express-desc-row">
  259. <Col span={3}>软著名称</Col>
  260. <Col span={6}>
  261. {getFieldDecorator('copyrightName', {
  262. initialValue: theData.copyrightName
  263. })(
  264. <Input placeholder="请输入软著名称" />
  265. )}
  266. </Col>
  267. </Row>
  268. <Row className="express-desc-row">
  269. <Col span={3}>加急天数</Col>
  270. <Col span={6}>
  271. {getFieldDecorator('inUrgent', {
  272. initialValue: theData.inUrgent ? String(theData.inUrgent) : undefined
  273. })(
  274. <Select
  275. placeholder="请选择加急时间"
  276. style={{ width: 120 }}>
  277. <Select.Option value="0">不加急</Select.Option>
  278. <Select.Option value="3">3天</Select.Option>
  279. <Select.Option value="5">5天</Select.Option>
  280. <Select.Option value="10">10天</Select.Option>
  281. <Select.Option value="20">20天</Select.Option>
  282. </Select>
  283. )}
  284. </Col>
  285. </Row>
  286. {theData.authorizedDateFormattedDate ? <Row className="express-desc-row">
  287. <Col span={3}>下证时间</Col>
  288. <Col span={6}>{theData.authorizedDateFormattedDate}</Col>
  289. </Row> :
  290. <Row className="express-desc-row">
  291. <Col span={3}>下证时间(预计)</Col>
  292. <Col span={6}>{theData.authorizedDateFormattedDate}</Col>
  293. </Row>}
  294. <p>状态流转记录: </p>
  295. <Table style={{ margin: '10px 0' }}
  296. pagination={false}
  297. dataSource={this.state.stateTable}
  298. columns={this.state.stateColumns} />
  299. <div className="clearfix">
  300. <FormItem className="third-item"
  301. {...formItemLayout}
  302. label="状态流转"
  303. >
  304. {getFieldDecorator('status')(
  305. <Select placeholder="选择一个状态">{this.state.stateOption}</Select>
  306. )}
  307. </FormItem>
  308. <FormItem className="third-item"
  309. labelCol={{ span: 6 }}
  310. wrapperCol={{ span: 12 }}
  311. label="处理时间"
  312. >
  313. {getFieldDecorator('recordTime')(
  314. <DatePicker />
  315. )}
  316. </FormItem>
  317. <FormItem className="third-item"
  318. {...formItemLayout}
  319. label="负责人"
  320. >
  321. {getFieldDecorator('principal')(
  322. <Select placeholder="选择负责人">{this.props.authorOption}</Select>
  323. )}
  324. </FormItem>
  325. </div>
  326. <FormItem
  327. labelCol={{ span: 2 }}
  328. wrapperCol={{ span: 12 }}
  329. label="备注"
  330. >
  331. {getFieldDecorator('comment')(
  332. <Input />
  333. )}
  334. </FormItem>
  335. <FormItem style={{ marginTop: '20px' }}>
  336. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  337. <Button type="ghost" style={{ marginLeft: '20px' }} onClick={this.props.closeModal}>取消</Button>
  338. </FormItem>
  339. </Form>
  340. );
  341. }
  342. }));
  343. const CopyrightDesc = React.createClass({
  344. getInitialState() {
  345. return {
  346. visible: false,
  347. loading: false
  348. };
  349. },
  350. componentWillReceiveProps(nextProps) {
  351. this.state.visible = nextProps.showDesc
  352. },
  353. showModal() {
  354. this.setState({
  355. visible: true,
  356. });
  357. },
  358. handleOk() {
  359. this.setState({
  360. visible: false,
  361. });
  362. this.props.closeDesc(false, true);
  363. },
  364. handleCancel(e) {
  365. this.setState({
  366. visible: false,
  367. });
  368. this.props.closeDesc(false);
  369. },
  370. spinChange(e) {
  371. this.setState({
  372. loading: e
  373. });
  374. },
  375. render() {
  376. return (
  377. <div className="patent-addNew">
  378. <Spin spinning={this.state.loading} className='spin-box'>
  379. <Modal title="软著详情" visible={this.state.visible}
  380. onOk={this.handleOk} onCancel={this.handleCancel}
  381. width='800px'
  382. footer=''
  383. >
  384. <CopyrightDescForm
  385. visible={this.state.visible}
  386. authorOption={this.props.authorOption}
  387. data={this.props.data}
  388. spinState={this.spinChange}
  389. closeModal={this.handleCancel}
  390. clickOk={this.handleOk} />
  391. </Modal>
  392. </Spin>
  393. </div>
  394. );
  395. }
  396. });
  397. export default CopyrightDesc;