newEditProject.jsx 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330
  1. import React, { Component } from "react";
  2. import { AutoComplete, Button, Icon, Form, Input, message, Modal, Radio, Select, Spin, Tag, DatePicker } from "antd";
  3. import { boutique } from "../../dataDic";
  4. import $ from "jquery";
  5. import { getboutique, splitUrl } from "../../tools";
  6. import moment from "moment";
  7. import { vipYear } from "../../dataDic";
  8. import ImgList from "../imgList";
  9. const FormItem = Form.Item;
  10. const Option = Select.Option;
  11. const RadioGroup = Radio.Group;
  12. const confirm = Modal.confirm;
  13. const formItemLayout = {
  14. labelCol: { span: 8 },
  15. wrapperCol: { span: 14 },
  16. };
  17. /**
  18. * 编辑项目 和 查看项目详情
  19. */
  20. class newEditProject extends Component {
  21. constructor(props) {
  22. super(props);
  23. this.state = {
  24. commodityName: '',
  25. commodityQuantity: '',
  26. patentType: 0,
  27. officialCost: '',
  28. costReduction: '',
  29. commodityPrice: '',
  30. main: '',
  31. taskComment: '',
  32. declarationBatch: '',
  33. ifCertificationFee: '',
  34. displayFees: "none",
  35. customerArr: [],
  36. patentTypeList: [],
  37. loading: false,
  38. orgCodeUrl: [],
  39. patentTransfer: props.dataInfor ? props.dataInfor.patentTransfer : 0, //收否为专利转让 0 否 1 是
  40. serviceLife: [],
  41. isVip: undefined,
  42. histYear: [],
  43. contractTerm: [],//合同期
  44. addyear: undefined,//
  45. isGive: undefined,//是否赠送
  46. splitList: [],//子集
  47. addFrom: false,
  48. isMedit: 0,
  49. }
  50. this.getpatentTypeList = this.getpatentTypeList.bind(this);
  51. this.setValue = this.setValue.bind(this);
  52. }
  53. componentDidMount() {
  54. this.getpatentTypeList();
  55. this.setValue();
  56. }
  57. setValue() {
  58. const { dataInfor, children = "splitList", type = "", readOnly } = this.props;
  59. if (!(dataInfor && Object.keys(dataInfor).length > 0)) { return; }
  60. if (type == "change") {
  61. // 变更编辑 taskType 0通用 1专利 2软著 3审计 4双软 5高新 6商标
  62. if (dataInfor.taskType === 1) {
  63. this.setState({
  64. displayFees: "block",
  65. costReduction: dataInfor.costReduction,
  66. officialCost: dataInfor.officialCost,
  67. patentType: dataInfor.patentType ? dataInfor.patentType : 0,
  68. });
  69. } else {
  70. this.setState({
  71. displayFees: "none",
  72. });
  73. }
  74. } else {
  75. // 正常编辑 type 0通用 1专利 2软著 3审计 4双软 5高新 6商标
  76. if (dataInfor.type === 1) {
  77. this.setState({
  78. displayFees: "block",
  79. costReduction: dataInfor.costReduction,
  80. officialCost: dataInfor.officialCost,
  81. patentType: dataInfor.patentType ? dataInfor.patentType : 0,
  82. });
  83. } else {
  84. this.setState({
  85. displayFees: "none",
  86. });
  87. }
  88. }
  89. let llist = []
  90. if (dataInfor[children] && dataInfor[children].length > 0) {
  91. for (var i = 0; i < dataInfor[children].length; i++) {
  92. // if (dataInfor.splitList[i].commodityId == dataInfor.commodityId) {
  93. // llist.push(dataInfor.splitList[i].serviceYear != dataInfor.serviceYear && dataInfor.splitList[i].serviceYear)
  94. // }
  95. if (dataInfor[children][i].type != 3) {
  96. llist.push(dataInfor[children][i].serviceYear)
  97. }
  98. }
  99. }
  100. this.setState({
  101. jid: dataInfor.id, //项目ID
  102. kid: dataInfor.commodityId, //商品ID
  103. commodityName: dataInfor.commodityName, //项目名称
  104. commodityPrice: dataInfor.commodityPrice, //金额
  105. commodityQuantity: dataInfor.commodityQuantity, //数量
  106. patentTypeName: dataInfor.patentTypeName,//专利类型名称
  107. taskComment: dataInfor.cSort == 6 ? undefined : dataInfor.taskComment, //备注
  108. main: dataInfor.main.toString(), //是否为主要
  109. addState: 0,
  110. addnextVisible: true,
  111. addProjectType: type == "change" ? dataInfor.taskType : dataInfor.type,
  112. declarationBatch: dataInfor.declarationBatch || 1,//申报批次(只有高新有)
  113. ifCertificationFee: isNaN(parseInt(dataInfor.ifCertificationFee)) ? '' : dataInfor.ifCertificationFee,//是否包含认证费
  114. isIso: dataInfor.commodityName.indexOf("贯标") !== -1,
  115. orgCodeUrl: dataInfor.pictureUrl
  116. ? splitUrl(
  117. dataInfor.pictureUrl,
  118. ",",
  119. globalConfig.avatarHost + "/upload"
  120. )
  121. : [],
  122. isVip: dataInfor.cSort,
  123. yearSum: dataInfor.yearSum,//会员总服务年限
  124. serviceLife: !dataInfor.serviceLife ? [] : JSON.parse(dataInfor.serviceLife), // 会员服务年限
  125. contractTerm: (!dataInfor.contractTerm || (dataInfor.contractTerm.indexOf("-") == -1)) ? [] : JSON.parse(dataInfor.contractTerm), // 合同期
  126. serviceYear: dataInfor.cSort == 6 ? undefined : dataInfor.serviceYear,//本次派单
  127. histYear: llist, // 本次已派单
  128. splitList: dataInfor[children] || [],
  129. tid: dataInfor.id, // 父级项目id
  130. isMedit: readOnly ? 3 : dataInfor.cSort == 6 ? 0 : 1,// 会员项目默认0不可编辑 普通项目默认1可编辑
  131. });
  132. }
  133. onChange(text) {
  134. const { type = "", dataInfor } = this.props
  135. if (isNaN(parseFloat(this.state.commodityPrice))) {
  136. message.warning("请输入正确的金额!");
  137. return false;
  138. }
  139. let reg = /^([0]|[1-9][0-9]*)$/;
  140. if (
  141. !this.state.commodityQuantity ||
  142. !reg.test(this.state.commodityQuantity)
  143. ) {
  144. message.warning("请输入正确服务数量!");
  145. return false;
  146. }
  147. // 审计
  148. if (this.state.addProjectType == "3") {
  149. if (this.state.serviceLife.length === 0) {
  150. message.warning("请选择服务年限!");
  151. return
  152. }
  153. if (this.state.serviceLife.length != this.state.commodityQuantity) {
  154. message.warning("服务数量与服务年限不符!");
  155. return
  156. }
  157. }
  158. if (!this.state.main) {
  159. message.warning("请选择是否为主要项目!");
  160. return false;
  161. }
  162. if (this.state.addProjectType === 5) {// 5高新
  163. if (!this.state.declarationBatch) {
  164. message.warning("请选择企业要求申报批次!");
  165. return
  166. }
  167. if (!this.state.serviceYear) {
  168. message.warning("请选择申报年份!");
  169. return
  170. }
  171. }
  172. if (this.state.isVip == 6) {
  173. // if (this.state.yearSum === undefined) {
  174. // message.warning("请选择会员总服务年限!");
  175. // return
  176. // }
  177. if (this.state.serviceLife.length === 0) {
  178. message.warning("请添加会员服务年限!");
  179. return
  180. }
  181. // if (this.state.serviceLife.length != this.state.yearSum) {
  182. // message.warning("会员服务年限与总年限不符合!");
  183. // return
  184. // }
  185. // if (this.state.serviceYear === undefined) {
  186. // message.warning("请选择本次派单年份!");
  187. // return
  188. // }
  189. if (this.state.contractTerm.length === 0 || this.state.contractTerm[1] == "") {
  190. message.warning("请填写合同期!");
  191. return
  192. }
  193. }
  194. this.setState({
  195. loading: true,
  196. });
  197. let infor = {
  198. id: this.state.jid, //项目ID
  199. commodityId: this.state.kid, //商品ID
  200. orderNo: this.props.orderNo, //订单编号
  201. main: this.state.main, //是否为主要
  202. commodityPrice: this.state.commodityPrice, //金额
  203. commodityQuantity: this.state.commodityQuantity, //数量
  204. taskComment: this.state.taskComment, //备注
  205. }
  206. if (this.state.displayFees === 'block') {
  207. infor.officialCost = this.state.officialCost //是否有官费
  208. infor.costReduction = (this.state.patentType === 0 || this.state.patentType === 2) ? (this.state.officialCost === 1 ? this.state.costReduction : 0) : 0//是否有费减
  209. infor.patentType = this.state.patentType //专利类型
  210. }
  211. if (this.state.isIso) {
  212. infor.ifCertificationFee = this.state.ifCertificationFee || undefined;//是否包含认证费用
  213. }
  214. if (this.state.addProjectType == "3") {//审计
  215. infor.serviceLife = JSON.stringify(this.state.serviceLife) //服务年限
  216. }
  217. if (this.state.addProjectType == "5") {//高新
  218. infor.declarationBatch = this.state.declarationBatch || undefined//申报批次
  219. infor.serviceYear = this.state.serviceYear //申报年份
  220. }
  221. if (this.state.isVip == 6) {//会员
  222. infor.yearSum = this.state.yearSum //会员总服务年限
  223. infor.serviceLife = JSON.stringify(this.state.serviceLife) //会员服务年限
  224. // infor.serviceYear = this.state.serviceYear //本次派单年份
  225. infor.contractTerm = JSON.stringify(this.state.contractTerm)//合同期
  226. }
  227. // 新开单与签单项目变更 -- 编辑项目
  228. if (type == "change") {
  229. infor.id = dataInfor.id
  230. infor.type = dataInfor.tid ? 2 : 1
  231. infor.tid = dataInfor.tid
  232. }
  233. $.ajax({
  234. method: "POST",
  235. dataType: "json",
  236. crossDomain: false,
  237. url: globalConfig.context + type == "change"
  238. ? "/api/admin/orderChange/updateChangeTask"
  239. : "/api/admin/newOrder/updateOrderTask",
  240. data: infor,
  241. }).done(
  242. function (data) {
  243. this.setState({
  244. loading: false,
  245. });
  246. if (!data.error.length) {
  247. message.success("保存成功!");
  248. if (this.state.isVip == 6) {
  249. text == "submit" &&
  250. this.setState({
  251. isMedit: 0
  252. })
  253. } else {
  254. this.props.onCancel();
  255. }
  256. } else {
  257. message.warning(data.error[0].message);
  258. }
  259. }.bind(this)
  260. );
  261. }
  262. getpatentTypeList() {
  263. $.ajax({
  264. method: "get",
  265. dataType: "json",
  266. crossDomain: false,
  267. url: globalConfig.context + '/api/admin/orderProject/getPatentType',
  268. success: function (data) {
  269. if (data.error.length === 0) {
  270. this.setState({
  271. patentTypeList: data.data
  272. })
  273. } else {
  274. message.warning(data.error[0].message);
  275. };
  276. }.bind(this)
  277. });
  278. }
  279. // 删除子项目
  280. deleteMemberSonProject(id) {
  281. const { splitList, histYear } = this.state
  282. $.ajax({
  283. method: "POST",
  284. dataType: "json",
  285. crossDomain: false,
  286. url: globalConfig.context +
  287. this.props.type == "change"
  288. ? '/api/admin/orderChange/deleteMemberSonProject'
  289. : '/api/admin/orderProject/deleteMemberSonProject',
  290. data: {
  291. id,
  292. },
  293. success: function (data) {
  294. if (data.error.length === 0) {
  295. // this.onChange()
  296. let splList = splitList
  297. let hlist = []
  298. for (var i = 0; i < splitList.length; i++) {
  299. if (id == splitList[i].id) {
  300. //如果是 type==1 新增 就彻底删除 否则 改为type==3
  301. if (splList[i].type == 0 || splList[i].type == 2) {
  302. splList[i].type = 3
  303. } else {
  304. splList.splice(i, 1)
  305. }
  306. // hlist.splice(i, 1)
  307. }
  308. }
  309. for (var j = 0; j < splList.length; j++) {
  310. splList[j].type != 3 && hlist.push(splList[j].serviceYear)
  311. }
  312. this.setState({
  313. splitList: splList,
  314. histYear: hlist,
  315. })
  316. message.success("操作成功!")
  317. } else {
  318. message.warning(data.error[0].message);
  319. };
  320. }.bind(this)
  321. });
  322. }
  323. // 恢复子项目
  324. updateMemberSonProject(id, taskComment) {
  325. const { splitList, histYear, serviceYear } = this.state
  326. $.ajax({
  327. method: "POST",
  328. dataType: "json",
  329. crossDomain: false,
  330. url: globalConfig.context + '/api/admin/orderChange/updateMemberSonProject',
  331. data: {
  332. id,
  333. taskComment,
  334. },
  335. success: function (data) {
  336. if (data.error.length === 0) {
  337. this.onChange()
  338. let splList = splitList
  339. let histList = histYear
  340. for (var i = 0; i < splList.length; i++) {
  341. if (splList[i].id == data.data.id) {
  342. splList[i].type = data.data.type
  343. splList[i].taskComment = data.data.taskComment
  344. }
  345. }
  346. histList.push(serviceYear)
  347. this.setState({
  348. addFrom: false,
  349. splitList: splList,
  350. histYear: histList,
  351. serviceYear: undefined,
  352. taskComment: undefined,
  353. isMedit: 0,
  354. })
  355. message.success("保存成功!")
  356. } else {
  357. message.warning(data.error[0].message);
  358. };
  359. }.bind(this)
  360. });
  361. }
  362. handleClose(removedTag) {
  363. let serviceLife = this.state.serviceLife.filter(tag => { return tag !== removedTag });
  364. this.setState({
  365. serviceLife,
  366. commodityQuantity: serviceLife.length == 0 ? undefined : serviceLife.length,
  367. yearSum: serviceLife.length == 0 ? undefined : serviceLife.length.toString(),
  368. serviceYear: undefined
  369. });
  370. }
  371. aGain() {
  372. const { serviceLife } = this.state
  373. this.setState({
  374. serviceLife: serviceLife,
  375. commodityQuantity: serviceLife.length == 0 ? undefined : serviceLife.length,
  376. yearSum: serviceLife.length == 0 ? undefined : serviceLife.length.toString(),
  377. })
  378. }
  379. tagClose(tag) {
  380. const _this = this
  381. let serviceLife = this.state.serviceLife.filter(t => { return t !== tag });
  382. let delid = ""
  383. const { splitList = [], } = this.state
  384. if (serviceLife.length < 1) {
  385. Modal.error({
  386. title: '提示',
  387. content: (
  388. <div>
  389. <p style={{ color: "red" }}>会员服务年限必须保留一个</p>
  390. </div>
  391. ),
  392. onOk() { },
  393. });
  394. return
  395. }
  396. for (var i = 0; i < splitList.length; i++) {
  397. if (tag == splitList[i].serviceYear && splitList[i].type != 3) {
  398. delid = splitList[i].id
  399. }
  400. }
  401. if (delid != "") {
  402. confirm({
  403. title: '确定要删除吗',
  404. content: '会员子项目也会一并删除',
  405. okText: '确定',
  406. okType: 'danger',
  407. cancelText: '取消',
  408. onOk() {
  409. _this.setState({
  410. serviceLife: serviceLife,
  411. commodityQuantity: serviceLife.length == 0 ? undefined : serviceLife.length,
  412. yearSum: serviceLife.length == 0 ? undefined : serviceLife.length.toString(),
  413. serviceYear: undefined
  414. });
  415. _this.deleteMemberSonProject(delid)
  416. },
  417. onCancel() {
  418. _this.aGain()
  419. },
  420. });
  421. } else {
  422. this.setState({
  423. serviceLife,
  424. commodityQuantity: serviceLife.length == 0 ? undefined : serviceLife.length,
  425. yearSum: serviceLife.length == 0 ? undefined : serviceLife.length.toString(),
  426. serviceYear: undefined
  427. }, () => {
  428. this.onChange()
  429. });
  430. }
  431. }
  432. // 添加会员子项目
  433. addMemberFirstSonProject() {
  434. if (!this.state.serviceYear) {
  435. message.warning("请选择本次派单年份!");
  436. return
  437. }
  438. this.setState({
  439. loading: true,
  440. });
  441. let info = {
  442. tid: this.state.tid,
  443. serviceYear: this.state.serviceYear,
  444. taskComment: this.state.taskComment,
  445. }
  446. let changeInfo = {
  447. id: this.state.tid,
  448. serviceYear: this.state.serviceYear,
  449. taskComment: this.state.taskComment,
  450. }
  451. if (this.state.recoveryId != "") {
  452. this.updateMemberSonProject(this.state.recoveryId, this.state.taskComment)
  453. return
  454. }
  455. $.ajax({
  456. method: "POST",
  457. dataType: "json",
  458. crossDomain: false,
  459. url: globalConfig.context +
  460. this.props.type == "change"
  461. ? "/api/admin/orderChange/addMemberSonProject"
  462. : "/api/admin/orderProject/addMemberFirstSonProject",
  463. data: this.props.type == "change" ? changeInfo : info,
  464. }).done(
  465. function (data) {
  466. this.setState({
  467. loading: false,
  468. });
  469. if (!data.error.length) {
  470. message.success("添加成功!");
  471. let list = this.state.splitList
  472. let histList = this.state.histYear
  473. list.push(data.data)
  474. histList.push(data.data.serviceYear)
  475. this.setState({
  476. addFrom: false,
  477. splitList: list,
  478. histYear: histList,
  479. serviceYear: undefined,
  480. taskComment: undefined,
  481. isMedit: 0,
  482. })
  483. } else {
  484. message.warning(data.error[0].message);
  485. }
  486. }.bind(this)
  487. );
  488. }
  489. render() {
  490. let children = vipYear.map(its => (
  491. <Option key={its}>{its}</Option>
  492. ));
  493. const { RangePicker } = DatePicker;
  494. const { readOnly } = this.props;
  495. const { isVip, histYear, isMedit } = this.state
  496. return (
  497. <Modal
  498. maskClosable={false}
  499. visible={this.props.visible}
  500. onOk={this.props.onCancel}
  501. onCancel={this.props.onCancel}
  502. width="900px"
  503. title={readOnly ? "项目任务详情" : "编辑项目任务"}
  504. footer=""
  505. className="admin-desc-content"
  506. >
  507. <Form
  508. layout="horizontal"
  509. >
  510. <Spin spinning={this.state.loading}>
  511. <div>
  512. <div className="clearfix">
  513. <FormItem
  514. className="half-item"
  515. {...formItemLayout}
  516. label="服务名称"
  517. >
  518. {this.state.commodityName}
  519. </FormItem>
  520. {
  521. isVip != 6 &&
  522. <FormItem
  523. className="half-item"
  524. {...formItemLayout}
  525. label="服务数量"
  526. >
  527. {readOnly ? this.state.commodityQuantity :
  528. <Input
  529. placeholder="请输入服务数量"
  530. disabled={isVip == 6}
  531. value={this.state.commodityQuantity}
  532. style={{ width: "200px" }}
  533. onChange={(e) => {
  534. this.setState({ commodityQuantity: e.target.value });
  535. }}
  536. ref="commodityQuantity"
  537. />}
  538. {!readOnly && <span className="mandatory">*</span>}
  539. </FormItem>
  540. }
  541. </div>
  542. <FormItem
  543. className="half-item"
  544. {...formItemLayout}
  545. label="实签价格(万元)"
  546. >
  547. {readOnly ? this.state.commodityPrice :
  548. <Input
  549. type='number'
  550. placeholder="请输入实签价格"
  551. disabled={isMedit != 1}
  552. value={this.state.commodityPrice}
  553. style={{ width: "200px" }}
  554. onChange={(e) => {
  555. this.setState({ commodityPrice: e.target.value });
  556. }}
  557. ref="commodityPrice"
  558. />}
  559. {!readOnly && <span className="mandatory">*</span>}
  560. </FormItem>
  561. <FormItem
  562. className="half-item"
  563. {...formItemLayout}
  564. label="主要业务"
  565. >
  566. {readOnly ? getboutique(this.state.main) :
  567. <Select
  568. placeholder="选择是否为主要业务"
  569. disabled={isMedit != 1}
  570. style={{ width: "200px" }}
  571. value={this.state.main}
  572. onChange={(e) => {
  573. this.setState({ main: e });
  574. }}
  575. >
  576. {boutique.map(function (item) {
  577. return (
  578. <Select.Option key={item.value}>
  579. {item.key}
  580. </Select.Option>
  581. );
  582. })}
  583. </Select>}
  584. {!readOnly && <span className="mandatory">*</span>}
  585. </FormItem>
  586. {
  587. !this.state.patentTransfer &&
  588. <FormItem
  589. className="half-item"
  590. labelCol={{ span: 4 }}
  591. wrapperCol={{ span: 14 }}
  592. label="专利类型:"
  593. style={{
  594. display: this.state.displayFees,
  595. marginLeft: "63px",
  596. }}
  597. >
  598. {readOnly ? this.state.patentTypeName :
  599. <Select
  600. placeholder="请选择专利类型"
  601. style={{ width: "200px" }}
  602. value={this.state.patentType}
  603. onChange={(e) => {
  604. this.setState({ patentType: e });
  605. if (e !== 0 && e !== 2) {
  606. this.setState({
  607. costReduction: ''
  608. })
  609. }
  610. }}
  611. >
  612. {this.state.patentTypeList.map(function (v, k) {
  613. return (
  614. <Select.Option key={k} value={v.id}>{v.name}</Select.Option>
  615. );
  616. })}
  617. </Select>}
  618. <span style={{ color: "red", marginLeft: "8px" }}>
  619. *
  620. </span>
  621. </FormItem>
  622. }
  623. <FormItem
  624. className="half-item"
  625. labelCol={{ span: 3 }}
  626. wrapperCol={{ span: 14 }}
  627. label="官费:"
  628. style={{
  629. display: this.state.displayFees,
  630. marginLeft: "63px",
  631. }}
  632. >
  633. {readOnly
  634. ? (this.state.officialCost === 1 ? '含官费' : this.state.officialCost === 0 ? '不含官费' : '')
  635. : <Radio.Group
  636. value={this.state.officialCost}
  637. onChange={(e) => {
  638. this.setState({ officialCost: e.target.value });
  639. if (e.target.value === 0) {
  640. this.setState({
  641. costReduction: ''
  642. })
  643. }
  644. }}
  645. >
  646. <Radio value={1}>含官费</Radio>
  647. <Radio value={0}>不含官费</Radio>
  648. </Radio.Group>}
  649. <span style={{ color: "red", marginLeft: "8px" }}>
  650. *
  651. </span>
  652. </FormItem>
  653. {
  654. readOnly ?
  655. <FormItem
  656. className="half-item"
  657. labelCol={{ span: 3 }}
  658. wrapperCol={{ span: 14 }}
  659. label="费减:"
  660. style={{
  661. display: this.state.displayFees,
  662. marginLeft: "63px",
  663. }}
  664. >
  665. {this.state.costReduction === 1 ? '有费减' : this.state.costReduction === 0 ? '无费减' : ''}
  666. <span style={{ color: "red", marginLeft: "8px" }}>
  667. *
  668. </span>
  669. </FormItem>
  670. :
  671. (this.state.patentType === 0 || this.state.patentType === 2) && this.state.officialCost === 1 &&
  672. <FormItem
  673. className="half-item"
  674. labelCol={{ span: 3 }}
  675. wrapperCol={{ span: 14 }}
  676. label="费减:"
  677. style={{
  678. display: this.state.displayFees,
  679. marginLeft: "63px",
  680. }}
  681. >
  682. {/*不含官费或者专利类型不为复审或者申请时置灰*/}
  683. <Radio.Group
  684. disabled={this.state.officialCost === 0 || (this.state.patentType !== 0 && this.state.patentType !== 2)}
  685. value={this.state.costReduction}
  686. onChange={(e) => {
  687. this.setState({ costReduction: e.target.value });
  688. }}
  689. >
  690. <Radio value={1}>有费减</Radio>
  691. <Radio value={0}>无费减</Radio>
  692. </Radio.Group>
  693. <span style={{ color: "red", marginLeft: "8px" }}>
  694. *
  695. </span>
  696. </FormItem>
  697. }
  698. {
  699. //审计
  700. this.state.addProjectType == "3" &&
  701. <FormItem
  702. className="half-item"
  703. {...formItemLayout}
  704. label="服务年限"
  705. >
  706. {
  707. readOnly ?
  708. !!this.state.serviceLife ? this.state.serviceLife.toString() : "" :
  709. <Select
  710. mode="multiple"
  711. style={{ width: '200px' }}
  712. placeholder="请选择服务年限"
  713. value={this.state.serviceLife}
  714. onChange={(e) => {
  715. this.setState({
  716. serviceLife: e,
  717. })
  718. }}
  719. >
  720. {children}
  721. </Select>
  722. }
  723. {!readOnly && <span className="mandatory">*</span>}
  724. </FormItem>
  725. }
  726. {
  727. isVip == 6 &&
  728. <FormItem
  729. className="half-item"
  730. {...formItemLayout}
  731. label="会员服务年限"
  732. >
  733. {
  734. readOnly ?
  735. !!this.state.serviceLife ? this.state.serviceLife.toString() : "" :
  736. <div>
  737. {
  738. this.state.serviceLife.map((tag) =>
  739. <Tag
  740. key={tag}
  741. // closable={!isEdit}
  742. // afterClose={() => this.handleClose(tag)}
  743. // onClose={() => this.tagClose(tag)}
  744. onClick={() => isMedit == 1 && this.tagClose(tag)}
  745. >{tag + " "}{isMedit == 1 && <Icon type="close" />}</Tag>
  746. )
  747. }
  748. {
  749. isMedit == 1 && (this.state.serviceLife.length < 5) &&
  750. <Button
  751. size="small"
  752. type="primary"
  753. onClick={() => {
  754. this.setState({
  755. addYears: true,
  756. addyear: undefined,
  757. isGive: undefined,
  758. })
  759. }}>
  760. + 添加服务年限
  761. </Button>
  762. }
  763. </div>
  764. }
  765. </FormItem>
  766. }
  767. {
  768. isVip == 6 &&
  769. <FormItem
  770. className="half-item"
  771. {...formItemLayout}
  772. label="会员总服务年限"
  773. >
  774. {
  775. !this.state.yearSum ? "" :
  776. [
  777. { value: "0", key: "" },
  778. { value: "1", key: "一年" },
  779. { value: "2", key: "二年" },
  780. { value: "3", key: "三年" },
  781. { value: "4", key: "四年" },
  782. { value: "5", key: "五年" },
  783. ][this.state.yearSum]["key"]
  784. }
  785. </FormItem>
  786. }
  787. {
  788. isVip == 6 &&
  789. <div className="clearfix">
  790. <FormItem
  791. className="half-item"
  792. {...formItemLayout}
  793. >
  794. </FormItem>
  795. <FormItem
  796. className="half-item"
  797. {...formItemLayout}
  798. label="合同期"
  799. >
  800. {
  801. readOnly ?
  802. !!this.state.contractTerm ? this.state.contractTerm.toString().replace(",", "至") : "" :
  803. <RangePicker
  804. style={{ width: 200 }}
  805. disabled={isMedit != 1}
  806. value={[
  807. this.state.contractTerm[0]
  808. ? moment(this.state.contractTerm[0])
  809. : null,
  810. this.state.contractTerm[1]
  811. ? moment(this.state.contractTerm[1])
  812. : null,
  813. ]}
  814. onChange={(data, dataString) => {
  815. this.setState({ contractTerm: dataString });
  816. }}
  817. />
  818. // <Select
  819. // mode="multiple"
  820. // style={{ width: '200px' }}
  821. // placeholder="请选择合同期"
  822. // disabled={isMedit != 1}
  823. // value={this.state.contractTerm}
  824. // onChange={e => {
  825. // this.setState({
  826. // contractTerm: e,
  827. // })
  828. // }}
  829. // >
  830. // {children}
  831. // </Select>
  832. }
  833. {!readOnly && <span className="mandatory">*</span>}
  834. </FormItem>
  835. </div>
  836. }
  837. {
  838. // 普通项目说明
  839. isVip != 6 &&
  840. <div className="clearfix">
  841. <FormItem
  842. labelCol={{ span: 4 }}
  843. wrapperCol={{ span: 16 }}
  844. label="项目说明"
  845. >
  846. {readOnly ? this.state.taskComment :
  847. <Input
  848. type="textarea"
  849. placeholder=""
  850. autosize={{ minRows: 4 }}
  851. value={this.state.taskComment}
  852. onChange={(e) => {
  853. this.setState({ taskComment: e.target.value });
  854. }}
  855. />}
  856. </FormItem>
  857. </div>
  858. }
  859. {/*0通用 1专利 2软著 3审计 4双软 5高新 6商标*/}
  860. {
  861. this.state.addProjectType === 5 &&
  862. <div className="clearfix">
  863. <FormItem
  864. className="half-item"
  865. {...formItemLayout}
  866. label="企业要求申报批次"
  867. >
  868. {readOnly ? (
  869. this.state.declarationBatch === 1 ? '第一批' :
  870. this.state.declarationBatch === 2 ? '第二批' :
  871. this.state.declarationBatch === 3 ? '第三批' :
  872. this.state.declarationBatch === 4 ? '第四批' : '未知'
  873. ) :
  874. <Select
  875. placeholder="请选择企业要求申报批次"
  876. style={{ width: "200px" }}
  877. value={this.state.declarationBatch}
  878. onChange={(e) => {
  879. this.setState({ declarationBatch: e });
  880. }}
  881. >
  882. <Select.Option value={1}>
  883. 第一批
  884. </Select.Option>
  885. <Select.Option value={2}>
  886. 第二批
  887. </Select.Option>
  888. <Select.Option value={3}>
  889. 第三批
  890. </Select.Option>
  891. <Select.Option value={4}>
  892. 第四批
  893. </Select.Option>
  894. </Select>}
  895. {!readOnly && <span className="mandatory">*</span>}
  896. </FormItem>
  897. <FormItem
  898. className="half-item"
  899. {...formItemLayout}
  900. label="申报年份"
  901. >
  902. {
  903. readOnly ? this.state.serviceYear :
  904. <Select
  905. style={{ width: '200px' }}
  906. placeholder="请选择申报年份"
  907. value={this.state.serviceYear}
  908. onChange={e => {
  909. this.setState({
  910. serviceYear: e,
  911. })
  912. }}
  913. >
  914. {
  915. vipYear.map(its => (
  916. <Option key={its}>{its}</Option>
  917. ))
  918. }
  919. </Select>
  920. }
  921. {!readOnly && <span className="mandatory">*</span>}
  922. </FormItem>
  923. </div>
  924. }
  925. {
  926. this.props.isIso || this.state.isIso ?
  927. <div className="clearfix">
  928. <FormItem
  929. className="half-item"
  930. {...formItemLayout}
  931. label="是否包含认证费用"
  932. >
  933. {readOnly ? (
  934. this.state.ifCertificationFee == "1" ? '包含' :
  935. this.state.ifCertificationFee == "0" ? '不包含' : '未知'
  936. ) : <Select
  937. placeholder="请选择是否包含认证费用"
  938. style={{ width: "200px" }}
  939. value={this.state.ifCertificationFee}
  940. onChange={(e) => {
  941. this.setState({ ifCertificationFee: e });
  942. }}
  943. >
  944. <Select.Option value={"0"}>否</Select.Option>
  945. <Select.Option value={"1"}>是</Select.Option>
  946. </Select>}
  947. {!readOnly && <span className="mandatory">*</span>}
  948. </FormItem>
  949. </div> : null
  950. }
  951. {
  952. isMedit == 0 && isVip == 6 &&
  953. <div className="clearfix">
  954. <FormItem
  955. wrapperCol={{ span: 12, offset: 10 }}
  956. className="half-middle"
  957. >
  958. <Button
  959. className="submitSave"
  960. type="primary"
  961. onClick={() => {
  962. this.setState({
  963. isMedit: 1
  964. })
  965. }}
  966. >
  967. 我要编辑
  968. </Button>
  969. </FormItem>
  970. </div>
  971. }
  972. {
  973. ((!readOnly && isVip != 6) || (isVip == 6 && isMedit == 1)) &&
  974. <div className="clearfix">
  975. <FormItem
  976. wrapperCol={{ span: 12, offset: 8 }}
  977. className="half-middle"
  978. >
  979. <Button
  980. className="submitSave"
  981. type="primary"
  982. onClick={() => {
  983. this.onChange("submit");
  984. }}
  985. >
  986. 保存
  987. </Button>
  988. <Button
  989. className="submitSave"
  990. type="ghost"
  991. onClick={() => {
  992. isVip == 6
  993. ? this.setState({
  994. isMedit: 0
  995. })
  996. : this.props.onCancel()
  997. }}
  998. >
  999. 取消
  1000. </Button>
  1001. </FormItem>
  1002. </div>
  1003. }
  1004. {
  1005. // 会员项目子集列表
  1006. !!this.state.splitList && this.state.splitList.length > 0 &&
  1007. this.state.splitList.map((item) =>
  1008. // 标识为 3=删 不显示
  1009. item.type != 3 &&
  1010. <div
  1011. key={item.id}
  1012. className="clearfix"
  1013. style={{
  1014. width: "100%",
  1015. borderTop: "1px dashed #000000",
  1016. padding: "10px 0"
  1017. }}
  1018. >
  1019. <FormItem
  1020. className="half-item"
  1021. {...formItemLayout}
  1022. label="本次派单"
  1023. >
  1024. {item.serviceYear}
  1025. </FormItem>
  1026. <FormItem
  1027. className="half-item"
  1028. {...formItemLayout}
  1029. label="服务数量"
  1030. >
  1031. {item.commodityQuantity}
  1032. </FormItem>
  1033. {
  1034. (item.memberType == "0" || item.memberType == "1" || item.memberType == "2") &&
  1035. <FormItem
  1036. className="half-item"
  1037. {...formItemLayout}
  1038. label="付款情况"
  1039. >
  1040. {item.memberType == "0"
  1041. ? "已付会员节点全款" : item.memberType == "1"
  1042. ? "已付部分期款,需特批" : item.memberType == "2"
  1043. ? "未付款,需特批" : ""}
  1044. </FormItem>
  1045. }
  1046. {
  1047. (item.memberType == "1" || item.memberType == "2") &&
  1048. <div className="clearfix">
  1049. <FormItem
  1050. labelCol={{ span: 4 }}
  1051. wrapperCol={{ span: 16 }}
  1052. label="附件"
  1053. >
  1054. {item.pictureUrl ?
  1055. <div>
  1056. <ImgList fileList={splitUrl(item.pictureUrl, ",", globalConfig.avatarHost + "/upload")} ItemWidth={'96px'} />
  1057. </div> : <div />}
  1058. </FormItem>
  1059. </div>
  1060. }
  1061. <div className="clearfix">
  1062. <FormItem
  1063. labelCol={{ span: 4 }}
  1064. wrapperCol={{ span: 16 }}
  1065. label="项目说明"
  1066. >
  1067. {item.taskComment}
  1068. </FormItem>
  1069. </div>
  1070. {/* {
  1071. (isMedit == 0 || isMedit == 2) &&
  1072. <div className="clearfix">
  1073. <FormItem
  1074. wrapperCol={{ span: 12, offset: 10 }}
  1075. className="half-middle"
  1076. >
  1077. <Button type="danger"
  1078. onClick={() => {
  1079. const _this = this
  1080. confirm({
  1081. title: '确定要删除吗',
  1082. content: '确定删除本次派单吗',
  1083. okText: '确定',
  1084. okType: 'danger',
  1085. cancelText: '取消',
  1086. onOk() {
  1087. _this.deleteMemberSonProject(item.id)
  1088. },
  1089. onCancel() { },
  1090. });
  1091. }}
  1092. >删除</Button>
  1093. </FormItem>
  1094. </div>
  1095. } */}
  1096. </div>
  1097. )
  1098. }
  1099. {
  1100. (isMedit == 0 || isMedit == 2) &&
  1101. this.state.splitList.filter((item) => { return item.type != 3 }).length < this.state.yearSum &&
  1102. <div
  1103. className="clearfix"
  1104. style={{
  1105. width: "100%",
  1106. borderTop: "1px dashed #000000",
  1107. padding: "30px 0 10px 0"
  1108. }}
  1109. >
  1110. {
  1111. !this.state.addFrom &&
  1112. // this.state.splitList.length < this.state.yearSum &&
  1113. this.state.splitList.filter((item) => { return item.type != 3 }).length < this.state.yearSum &&
  1114. <div className="clearfix">
  1115. <Button
  1116. type="primary"
  1117. onClick={() => {
  1118. this.setState({
  1119. addFrom: true,
  1120. })
  1121. }}
  1122. >
  1123. + 本次派单
  1124. </Button>
  1125. </div>
  1126. }
  1127. {
  1128. this.state.addFrom &&
  1129. <div>
  1130. <FormItem
  1131. className="half-item"
  1132. {...formItemLayout}
  1133. label="本次派单"
  1134. >
  1135. <Select
  1136. placeholder="请选择本次派单年份"
  1137. style={{ width: "200px" }}
  1138. value={this.state.serviceYear}
  1139. onChange={(e) => {
  1140. let addId = ""
  1141. let addtext = ""
  1142. if (!!this.state.splitList) {
  1143. for (var i = 0; i < this.state.splitList.length; i++) {
  1144. if (this.state.splitList[i].serviceYear == e && this.state.splitList[i].type == 3) {
  1145. addId = this.state.splitList[i].id
  1146. addtext = this.state.splitList[i].taskComment
  1147. }
  1148. }
  1149. }
  1150. this.setState({
  1151. serviceYear: e,
  1152. recoveryId: addId,
  1153. taskComment: addtext,
  1154. });
  1155. }}
  1156. >
  1157. {this.state.serviceLife.length > 0 && this.state.serviceLife.map(function (item) {
  1158. return (
  1159. <Select.Option key={item} disabled={histYear.includes(item)}>
  1160. {item}
  1161. </Select.Option>
  1162. );
  1163. })}
  1164. </Select>
  1165. {<span className="mandatory">*</span>}
  1166. </FormItem>
  1167. <FormItem
  1168. className="half-item"
  1169. {...formItemLayout}
  1170. label="服务数量"
  1171. >
  1172. <Input
  1173. placeholder="请输入服务数量"
  1174. disabled={isVip == 6}
  1175. value={1}
  1176. style={{ width: "200px" }}
  1177. ref="commodityQuantity"
  1178. />
  1179. {<span className="mandatory">*</span>}
  1180. </FormItem>
  1181. <div className="clearfix">
  1182. <FormItem
  1183. labelCol={{ span: 4 }}
  1184. wrapperCol={{ span: 16 }}
  1185. label="项目说明"
  1186. >
  1187. <Input
  1188. type="textarea"
  1189. placeholder=""
  1190. autosize={{ minRows: 2 }}
  1191. value={this.state.taskComment}
  1192. onChange={(e) => {
  1193. this.setState({ taskComment: e.target.value });
  1194. }}
  1195. />
  1196. </FormItem>
  1197. </div>
  1198. <div className="clearfix">
  1199. <FormItem
  1200. wrapperCol={{ span: 12, offset: 8 }}
  1201. className="half-middle"
  1202. >
  1203. <Button
  1204. className="submitSave"
  1205. type="primary"
  1206. onClick={() => {
  1207. this.addMemberFirstSonProject()
  1208. }}
  1209. >
  1210. 保存
  1211. </Button>
  1212. <Button
  1213. className="submitSave"
  1214. type="ghost"
  1215. onClick={() => {
  1216. this.setState({
  1217. addFrom: false
  1218. })
  1219. }}
  1220. >
  1221. 取消
  1222. </Button>
  1223. </FormItem>
  1224. </div>
  1225. </div>
  1226. }
  1227. </div>
  1228. }
  1229. </div>
  1230. </Spin>
  1231. </Form>
  1232. {
  1233. this.state.addYears &&
  1234. <Modal
  1235. title="添加服务年限"
  1236. visible={this.state.addYears}
  1237. okText="添加"
  1238. onOk={() => {
  1239. if (!this.state.addyear) {
  1240. message.warn("请选择年份!")
  1241. return
  1242. }
  1243. if (this.state.isGive == undefined) {
  1244. message.warn("请选择是否赠送!")
  1245. return
  1246. }
  1247. let slist = this.state.serviceLife
  1248. let newYear = this.state.addyear
  1249. if (this.state.isGive == 0) {
  1250. newYear = newYear
  1251. } else if (this.state.isGive == 1) {
  1252. newYear = newYear + "(赠)"
  1253. }
  1254. slist.push(newYear)
  1255. this.setState({
  1256. serviceLife: slist,
  1257. commodityQuantity: slist.length,
  1258. yearSum: slist.length.toString(),
  1259. addYears: false
  1260. }, () => {
  1261. // let addId = ""
  1262. // if (!!this.state.splitList) {
  1263. // for (var i = 0; i < this.state.splitList.length; i++) {
  1264. // if (this.state.splitList[i].serviceYear == newYear && this.state.splitList[i].type == 3) {
  1265. // addId = this.state.splitList[i].id
  1266. // }
  1267. // }
  1268. // }
  1269. // addId == ""
  1270. // ? this.onChange()
  1271. // : this.updateMemberSonProject(addId)
  1272. })
  1273. }}
  1274. onCancel={() => {
  1275. this.setState({
  1276. addYears: false
  1277. })
  1278. }}
  1279. >
  1280. <Select
  1281. style={{ width: '200px', marginRight: 50 }}
  1282. placeholder="请选择年份"
  1283. onChange={e => {
  1284. this.setState({
  1285. addyear: e,
  1286. })
  1287. }}
  1288. >
  1289. {
  1290. vipYear.map(its => (
  1291. <Option
  1292. key={its}
  1293. disabled={this.state.serviceLife.toString().includes(its)}
  1294. >{its}</Option>
  1295. ))
  1296. }
  1297. </Select>
  1298. <RadioGroup
  1299. onChange={e => {
  1300. this.setState({
  1301. isGive: e.target.value
  1302. })
  1303. }}
  1304. value={this.state.isGive}
  1305. >
  1306. <Radio value={0}>非赠送</Radio>
  1307. <Radio value={1}>赠送</Radio>
  1308. </RadioGroup>
  1309. </Modal>
  1310. }
  1311. </Modal >
  1312. )
  1313. }
  1314. }
  1315. export default newEditProject;