newEditProject.jsx 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329
  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. } else {
  317. message.warning(data.error[0].message);
  318. };
  319. }.bind(this)
  320. });
  321. }
  322. // 恢复子项目
  323. updateMemberSonProject(id, taskComment) {
  324. const { splitList, histYear, serviceYear } = this.state
  325. $.ajax({
  326. method: "POST",
  327. dataType: "json",
  328. crossDomain: false,
  329. url: globalConfig.context + '/api/admin/orderChange/updateMemberSonProject',
  330. data: {
  331. id,
  332. taskComment,
  333. },
  334. success: function (data) {
  335. if (data.error.length === 0) {
  336. // this.onChange()
  337. let splList = splitList
  338. let histList = histYear
  339. for (var i = 0; i < splList.length; i++) {
  340. if (splList[i].id == data.data.id) {
  341. splList[i].type = data.data.type
  342. splList[i].taskComment = data.data.taskComment
  343. }
  344. }
  345. histList.push(serviceYear)
  346. this.setState({
  347. addFrom: false,
  348. splitList: splList,
  349. histYear: histList,
  350. serviceYear: undefined,
  351. taskComment: undefined,
  352. isMedit: 0,
  353. })
  354. message.success("保存成功!")
  355. } else {
  356. message.warning(data.error[0].message);
  357. };
  358. }.bind(this)
  359. });
  360. }
  361. handleClose(removedTag) {
  362. let serviceLife = this.state.serviceLife.filter(tag => { return tag !== removedTag });
  363. this.setState({
  364. serviceLife,
  365. commodityQuantity: serviceLife.length == 0 ? undefined : serviceLife.length,
  366. yearSum: serviceLife.length == 0 ? undefined : serviceLife.length.toString(),
  367. serviceYear: undefined
  368. });
  369. }
  370. aGain() {
  371. const { serviceLife } = this.state
  372. this.setState({
  373. serviceLife: serviceLife,
  374. commodityQuantity: serviceLife.length == 0 ? undefined : serviceLife.length,
  375. yearSum: serviceLife.length == 0 ? undefined : serviceLife.length.toString(),
  376. })
  377. }
  378. tagClose(tag) {
  379. const _this = this
  380. let serviceLife = this.state.serviceLife.filter(t => { return t !== tag });
  381. let delid = ""
  382. const { splitList = [], } = this.state
  383. if (serviceLife.length < 1) {
  384. Modal.error({
  385. title: '提示',
  386. content: (
  387. <div>
  388. <p style={{ color: "red" }}>会员服务年限必须保留一个</p>
  389. </div>
  390. ),
  391. onOk() { },
  392. });
  393. return
  394. }
  395. for (var i = 0; i < splitList.length; i++) {
  396. if (tag == splitList[i].serviceYear && splitList[i].type != 3) {
  397. delid = splitList[i].id
  398. }
  399. }
  400. if (delid != "") {
  401. confirm({
  402. title: '确定要删除吗',
  403. content: '会员子项目也会一并删除',
  404. okText: '确定',
  405. okType: 'danger',
  406. cancelText: '取消',
  407. onOk() {
  408. _this.setState({
  409. serviceLife: serviceLife,
  410. commodityQuantity: serviceLife.length == 0 ? undefined : serviceLife.length,
  411. yearSum: serviceLife.length == 0 ? undefined : serviceLife.length.toString(),
  412. serviceYear: undefined
  413. });
  414. _this.deleteMemberSonProject(delid)
  415. },
  416. onCancel() {
  417. // _this.aGain()
  418. },
  419. });
  420. } else {
  421. this.setState({
  422. serviceLife,
  423. commodityQuantity: serviceLife.length == 0 ? undefined : serviceLife.length,
  424. yearSum: serviceLife.length == 0 ? undefined : serviceLife.length.toString(),
  425. serviceYear: undefined
  426. }, () => {
  427. this.onChange()
  428. });
  429. }
  430. }
  431. // 添加会员子项目
  432. addMemberFirstSonProject() {
  433. if (!this.state.serviceYear) {
  434. message.warning("请选择本次派单年份!");
  435. return
  436. }
  437. this.setState({
  438. loading: true,
  439. });
  440. let info = {
  441. tid: this.state.tid,
  442. serviceYear: this.state.serviceYear,
  443. taskComment: this.state.taskComment,
  444. }
  445. let changeInfo = {
  446. id: this.state.tid,
  447. serviceYear: this.state.serviceYear,
  448. taskComment: this.state.taskComment,
  449. }
  450. if (this.state.recoveryId != "") {
  451. this.updateMemberSonProject(this.state.recoveryId, this.state.taskComment)
  452. return
  453. }
  454. $.ajax({
  455. method: "POST",
  456. dataType: "json",
  457. crossDomain: false,
  458. url: globalConfig.context +
  459. this.props.type == "change"
  460. ? "/api/admin/orderChange/addMemberSonProject"
  461. : "/api/admin/orderProject/addMemberFirstSonProject",
  462. data: this.props.type == "change" ? changeInfo : info,
  463. }).done(
  464. function (data) {
  465. this.setState({
  466. loading: false,
  467. });
  468. if (!data.error.length) {
  469. message.success("保存成功!");
  470. let list = this.state.splitList
  471. let histList = this.state.histYear
  472. list.push(data.data)
  473. histList.push(data.data.serviceYear)
  474. this.setState({
  475. addFrom: false,
  476. splitList: list,
  477. histYear: histList,
  478. serviceYear: undefined,
  479. taskComment: undefined,
  480. isMedit: 0,
  481. })
  482. } else {
  483. message.warning(data.error[0].message);
  484. }
  485. }.bind(this)
  486. );
  487. }
  488. render() {
  489. let children = vipYear.map(its => (
  490. <Option key={its}>{its}</Option>
  491. ));
  492. const { RangePicker } = DatePicker;
  493. const { readOnly } = this.props;
  494. const { isVip, histYear, isMedit } = this.state
  495. return (
  496. <Modal
  497. maskClosable={false}
  498. visible={this.props.visible}
  499. onOk={this.props.onCancel}
  500. onCancel={this.props.onCancel}
  501. width="900px"
  502. title={readOnly ? "项目任务详情" : "编辑项目任务"}
  503. footer=""
  504. className="admin-desc-content"
  505. >
  506. <Form
  507. layout="horizontal"
  508. >
  509. <Spin spinning={this.state.loading}>
  510. <div>
  511. <div className="clearfix">
  512. <FormItem
  513. className="half-item"
  514. {...formItemLayout}
  515. label="服务名称"
  516. >
  517. {this.state.commodityName}
  518. </FormItem>
  519. {
  520. isVip != 6 &&
  521. <FormItem
  522. className="half-item"
  523. {...formItemLayout}
  524. label="服务数量"
  525. >
  526. {readOnly ? this.state.commodityQuantity :
  527. <Input
  528. placeholder="请输入服务数量"
  529. disabled={isVip == 6}
  530. value={this.state.commodityQuantity}
  531. style={{ width: "200px" }}
  532. onChange={(e) => {
  533. this.setState({ commodityQuantity: e.target.value });
  534. }}
  535. ref="commodityQuantity"
  536. />}
  537. {!readOnly && <span className="mandatory">*</span>}
  538. </FormItem>
  539. }
  540. </div>
  541. <FormItem
  542. className="half-item"
  543. {...formItemLayout}
  544. label="实签价格(万元)"
  545. >
  546. {readOnly ? this.state.commodityPrice :
  547. <Input
  548. type='number'
  549. placeholder="请输入实签价格"
  550. disabled={isMedit != 1}
  551. value={this.state.commodityPrice}
  552. style={{ width: "200px" }}
  553. onChange={(e) => {
  554. this.setState({ commodityPrice: e.target.value });
  555. }}
  556. ref="commodityPrice"
  557. />}
  558. {!readOnly && <span className="mandatory">*</span>}
  559. </FormItem>
  560. <FormItem
  561. className="half-item"
  562. {...formItemLayout}
  563. label="主要业务"
  564. >
  565. {readOnly ? getboutique(this.state.main) :
  566. <Select
  567. placeholder="选择是否为主要业务"
  568. disabled={isMedit != 1}
  569. style={{ width: "200px" }}
  570. value={this.state.main}
  571. onChange={(e) => {
  572. this.setState({ main: e });
  573. }}
  574. >
  575. {boutique.map(function (item) {
  576. return (
  577. <Select.Option key={item.value}>
  578. {item.key}
  579. </Select.Option>
  580. );
  581. })}
  582. </Select>}
  583. {!readOnly && <span className="mandatory">*</span>}
  584. </FormItem>
  585. {
  586. !this.state.patentTransfer &&
  587. <FormItem
  588. className="half-item"
  589. labelCol={{ span: 4 }}
  590. wrapperCol={{ span: 14 }}
  591. label="专利类型:"
  592. style={{
  593. display: this.state.displayFees,
  594. marginLeft: "63px",
  595. }}
  596. >
  597. {readOnly ? this.state.patentTypeName :
  598. <Select
  599. placeholder="请选择专利类型"
  600. style={{ width: "200px" }}
  601. value={this.state.patentType}
  602. onChange={(e) => {
  603. this.setState({ patentType: e });
  604. if (e !== 0 && e !== 2) {
  605. this.setState({
  606. costReduction: ''
  607. })
  608. }
  609. }}
  610. >
  611. {this.state.patentTypeList.map(function (v, k) {
  612. return (
  613. <Select.Option key={k} value={v.id}>{v.name}</Select.Option>
  614. );
  615. })}
  616. </Select>}
  617. <span style={{ color: "red", marginLeft: "8px" }}>
  618. *
  619. </span>
  620. </FormItem>
  621. }
  622. <FormItem
  623. className="half-item"
  624. labelCol={{ span: 3 }}
  625. wrapperCol={{ span: 14 }}
  626. label="官费:"
  627. style={{
  628. display: this.state.displayFees,
  629. marginLeft: "63px",
  630. }}
  631. >
  632. {readOnly
  633. ? (this.state.officialCost === 1 ? '含官费' : this.state.officialCost === 0 ? '不含官费' : '')
  634. : <Radio.Group
  635. value={this.state.officialCost}
  636. onChange={(e) => {
  637. this.setState({ officialCost: e.target.value });
  638. if (e.target.value === 0) {
  639. this.setState({
  640. costReduction: ''
  641. })
  642. }
  643. }}
  644. >
  645. <Radio value={1}>含官费</Radio>
  646. <Radio value={0}>不含官费</Radio>
  647. </Radio.Group>}
  648. <span style={{ color: "red", marginLeft: "8px" }}>
  649. *
  650. </span>
  651. </FormItem>
  652. {
  653. readOnly ?
  654. <FormItem
  655. className="half-item"
  656. labelCol={{ span: 3 }}
  657. wrapperCol={{ span: 14 }}
  658. label="费减:"
  659. style={{
  660. display: this.state.displayFees,
  661. marginLeft: "63px",
  662. }}
  663. >
  664. {this.state.costReduction === 1 ? '有费减' : this.state.costReduction === 0 ? '无费减' : ''}
  665. <span style={{ color: "red", marginLeft: "8px" }}>
  666. *
  667. </span>
  668. </FormItem>
  669. :
  670. (this.state.patentType === 0 || this.state.patentType === 2) && this.state.officialCost === 1 &&
  671. <FormItem
  672. className="half-item"
  673. labelCol={{ span: 3 }}
  674. wrapperCol={{ span: 14 }}
  675. label="费减:"
  676. style={{
  677. display: this.state.displayFees,
  678. marginLeft: "63px",
  679. }}
  680. >
  681. {/*不含官费或者专利类型不为复审或者申请时置灰*/}
  682. <Radio.Group
  683. disabled={this.state.officialCost === 0 || (this.state.patentType !== 0 && this.state.patentType !== 2)}
  684. value={this.state.costReduction}
  685. onChange={(e) => {
  686. this.setState({ costReduction: e.target.value });
  687. }}
  688. >
  689. <Radio value={1}>有费减</Radio>
  690. <Radio value={0}>无费减</Radio>
  691. </Radio.Group>
  692. <span style={{ color: "red", marginLeft: "8px" }}>
  693. *
  694. </span>
  695. </FormItem>
  696. }
  697. {
  698. //审计
  699. this.state.addProjectType == "3" &&
  700. <FormItem
  701. className="half-item"
  702. {...formItemLayout}
  703. label="服务年限"
  704. >
  705. {
  706. readOnly ?
  707. !!this.state.serviceLife ? this.state.serviceLife.toString() : "" :
  708. <Select
  709. mode="multiple"
  710. style={{ width: '200px' }}
  711. placeholder="请选择服务年限"
  712. value={this.state.serviceLife}
  713. onChange={(e) => {
  714. this.setState({
  715. serviceLife: e,
  716. })
  717. }}
  718. >
  719. {children}
  720. </Select>
  721. }
  722. {!readOnly && <span className="mandatory">*</span>}
  723. </FormItem>
  724. }
  725. {
  726. isVip == 6 &&
  727. <FormItem
  728. className="half-item"
  729. {...formItemLayout}
  730. label="会员服务年限"
  731. >
  732. {
  733. readOnly ?
  734. !!this.state.serviceLife ? this.state.serviceLife.toString() : "" :
  735. <div>
  736. {
  737. this.state.serviceLife.map((tag) =>
  738. <Tag
  739. key={tag}
  740. // closable={!isEdit}
  741. // afterClose={() => this.handleClose(tag)}
  742. // onClose={() => this.tagClose(tag)}
  743. onClick={() => isMedit == 1 && this.tagClose(tag)}
  744. >{tag + " "}{isMedit == 1 && <Icon type="close" />}</Tag>
  745. )
  746. }
  747. {
  748. isMedit == 1 && (this.state.serviceLife.length < 5) &&
  749. <Button
  750. size="small"
  751. type="primary"
  752. onClick={() => {
  753. this.setState({
  754. addYears: true,
  755. addyear: undefined,
  756. isGive: undefined,
  757. })
  758. }}>
  759. + 添加服务年限
  760. </Button>
  761. }
  762. </div>
  763. }
  764. </FormItem>
  765. }
  766. {
  767. isVip == 6 &&
  768. <FormItem
  769. className="half-item"
  770. {...formItemLayout}
  771. label="会员总服务年限"
  772. >
  773. {
  774. !this.state.yearSum ? "" :
  775. [
  776. { value: "0", key: "" },
  777. { value: "1", key: "一年" },
  778. { value: "2", key: "二年" },
  779. { value: "3", key: "三年" },
  780. { value: "4", key: "四年" },
  781. { value: "5", key: "五年" },
  782. ][this.state.yearSum]["key"]
  783. }
  784. </FormItem>
  785. }
  786. {
  787. isVip == 6 &&
  788. <div className="clearfix">
  789. <FormItem
  790. className="half-item"
  791. {...formItemLayout}
  792. >
  793. </FormItem>
  794. <FormItem
  795. className="half-item"
  796. {...formItemLayout}
  797. label="合同期"
  798. >
  799. {
  800. readOnly ?
  801. !!this.state.contractTerm ? this.state.contractTerm.toString().replace(",", "至") : "" :
  802. <RangePicker
  803. style={{ width: 200 }}
  804. disabled={isMedit != 1}
  805. value={[
  806. this.state.contractTerm[0]
  807. ? moment(this.state.contractTerm[0])
  808. : null,
  809. this.state.contractTerm[1]
  810. ? moment(this.state.contractTerm[1])
  811. : null,
  812. ]}
  813. onChange={(data, dataString) => {
  814. this.setState({ contractTerm: dataString });
  815. }}
  816. />
  817. // <Select
  818. // mode="multiple"
  819. // style={{ width: '200px' }}
  820. // placeholder="请选择合同期"
  821. // disabled={isMedit != 1}
  822. // value={this.state.contractTerm}
  823. // onChange={e => {
  824. // this.setState({
  825. // contractTerm: e,
  826. // })
  827. // }}
  828. // >
  829. // {children}
  830. // </Select>
  831. }
  832. {!readOnly && <span className="mandatory">*</span>}
  833. </FormItem>
  834. </div>
  835. }
  836. {
  837. // 普通项目说明
  838. isVip != 6 &&
  839. <div className="clearfix">
  840. <FormItem
  841. labelCol={{ span: 4 }}
  842. wrapperCol={{ span: 16 }}
  843. label="项目说明"
  844. >
  845. {readOnly ? this.state.taskComment :
  846. <Input
  847. type="textarea"
  848. placeholder=""
  849. autosize={{ minRows: 4 }}
  850. value={this.state.taskComment}
  851. onChange={(e) => {
  852. this.setState({ taskComment: e.target.value });
  853. }}
  854. />}
  855. </FormItem>
  856. </div>
  857. }
  858. {/*0通用 1专利 2软著 3审计 4双软 5高新 6商标*/}
  859. {
  860. this.state.addProjectType === 5 &&
  861. <div className="clearfix">
  862. <FormItem
  863. className="half-item"
  864. {...formItemLayout}
  865. label="企业要求申报批次"
  866. >
  867. {readOnly ? (
  868. this.state.declarationBatch === 1 ? '第一批' :
  869. this.state.declarationBatch === 2 ? '第二批' :
  870. this.state.declarationBatch === 3 ? '第三批' :
  871. this.state.declarationBatch === 4 ? '第四批' : '未知'
  872. ) :
  873. <Select
  874. placeholder="请选择企业要求申报批次"
  875. style={{ width: "200px" }}
  876. value={this.state.declarationBatch}
  877. onChange={(e) => {
  878. this.setState({ declarationBatch: e });
  879. }}
  880. >
  881. <Select.Option value={1}>
  882. 第一批
  883. </Select.Option>
  884. <Select.Option value={2}>
  885. 第二批
  886. </Select.Option>
  887. <Select.Option value={3}>
  888. 第三批
  889. </Select.Option>
  890. <Select.Option value={4}>
  891. 第四批
  892. </Select.Option>
  893. </Select>}
  894. {!readOnly && <span className="mandatory">*</span>}
  895. </FormItem>
  896. <FormItem
  897. className="half-item"
  898. {...formItemLayout}
  899. label="申报年份"
  900. >
  901. {
  902. readOnly ? this.state.serviceYear :
  903. <Select
  904. style={{ width: '200px' }}
  905. placeholder="请选择申报年份"
  906. value={this.state.serviceYear}
  907. onChange={e => {
  908. this.setState({
  909. serviceYear: e,
  910. })
  911. }}
  912. >
  913. {
  914. vipYear.map(its => (
  915. <Option key={its}>{its}</Option>
  916. ))
  917. }
  918. </Select>
  919. }
  920. {!readOnly && <span className="mandatory">*</span>}
  921. </FormItem>
  922. </div>
  923. }
  924. {
  925. this.props.isIso || this.state.isIso ?
  926. <div className="clearfix">
  927. <FormItem
  928. className="half-item"
  929. {...formItemLayout}
  930. label="是否包含认证费用"
  931. >
  932. {readOnly ? (
  933. this.state.ifCertificationFee == "1" ? '包含' :
  934. this.state.ifCertificationFee == "0" ? '不包含' : '未知'
  935. ) : <Select
  936. placeholder="请选择是否包含认证费用"
  937. style={{ width: "200px" }}
  938. value={this.state.ifCertificationFee}
  939. onChange={(e) => {
  940. this.setState({ ifCertificationFee: e });
  941. }}
  942. >
  943. <Select.Option value={"0"}>否</Select.Option>
  944. <Select.Option value={"1"}>是</Select.Option>
  945. </Select>}
  946. {!readOnly && <span className="mandatory">*</span>}
  947. </FormItem>
  948. </div> : null
  949. }
  950. {
  951. isMedit == 0 && isVip == 6 &&
  952. <div className="clearfix">
  953. <FormItem
  954. wrapperCol={{ span: 12, offset: 10 }}
  955. className="half-middle"
  956. >
  957. <Button
  958. className="submitSave"
  959. type="primary"
  960. onClick={() => {
  961. this.setState({
  962. isMedit: 1
  963. })
  964. }}
  965. >
  966. 我要编辑
  967. </Button>
  968. </FormItem>
  969. </div>
  970. }
  971. {
  972. ((!readOnly && isVip != 6) || (isVip == 6 && isMedit == 1)) &&
  973. <div className="clearfix">
  974. <FormItem
  975. wrapperCol={{ span: 12, offset: 8 }}
  976. className="half-middle"
  977. >
  978. <Button
  979. className="submitSave"
  980. type="primary"
  981. onClick={() => {
  982. this.onChange("submit");
  983. }}
  984. >
  985. 保存
  986. </Button>
  987. <Button
  988. className="submitSave"
  989. type="ghost"
  990. onClick={() => {
  991. isVip == 6
  992. ? this.setState({
  993. isMedit: 0
  994. })
  995. : this.props.onCancel()
  996. }}
  997. >
  998. 取消
  999. </Button>
  1000. </FormItem>
  1001. </div>
  1002. }
  1003. {
  1004. // 会员项目子集列表
  1005. !!this.state.splitList && this.state.splitList.length > 0 &&
  1006. this.state.splitList.map((item) =>
  1007. // 标识为 3=删 不显示
  1008. item.type != 3 &&
  1009. <div
  1010. key={item.id}
  1011. className="clearfix"
  1012. style={{
  1013. width: "100%",
  1014. borderTop: "1px dashed #000000",
  1015. padding: "10px 0"
  1016. }}
  1017. >
  1018. <FormItem
  1019. className="half-item"
  1020. {...formItemLayout}
  1021. label="本次派单"
  1022. >
  1023. {item.serviceYear}
  1024. </FormItem>
  1025. <FormItem
  1026. className="half-item"
  1027. {...formItemLayout}
  1028. label="服务数量"
  1029. >
  1030. {item.commodityQuantity}
  1031. </FormItem>
  1032. {
  1033. (item.memberType == "0" || item.memberType == "1" || item.memberType == "2") &&
  1034. <FormItem
  1035. className="half-item"
  1036. {...formItemLayout}
  1037. label="付款情况"
  1038. >
  1039. {item.memberType == "0"
  1040. ? "已付会员节点全款" : item.memberType == "1"
  1041. ? "已付部分期款,需特批" : item.memberType == "2"
  1042. ? "未付款,需特批" : ""}
  1043. </FormItem>
  1044. }
  1045. {
  1046. (item.memberType == "1" || item.memberType == "2") &&
  1047. <div className="clearfix">
  1048. <FormItem
  1049. labelCol={{ span: 4 }}
  1050. wrapperCol={{ span: 16 }}
  1051. label="附件"
  1052. >
  1053. {item.pictureUrl ?
  1054. <div>
  1055. <ImgList fileList={splitUrl(item.pictureUrl, ",", globalConfig.avatarHost + "/upload")} ItemWidth={'96px'} />
  1056. </div> : <div />}
  1057. </FormItem>
  1058. </div>
  1059. }
  1060. <div className="clearfix">
  1061. <FormItem
  1062. labelCol={{ span: 4 }}
  1063. wrapperCol={{ span: 16 }}
  1064. label="项目说明"
  1065. >
  1066. {item.taskComment}
  1067. </FormItem>
  1068. </div>
  1069. {/* {
  1070. (isMedit == 0 || isMedit == 2) &&
  1071. <div className="clearfix">
  1072. <FormItem
  1073. wrapperCol={{ span: 12, offset: 10 }}
  1074. className="half-middle"
  1075. >
  1076. <Button type="danger"
  1077. onClick={() => {
  1078. const _this = this
  1079. confirm({
  1080. title: '确定要删除吗',
  1081. content: '确定删除本次派单吗',
  1082. okText: '确定',
  1083. okType: 'danger',
  1084. cancelText: '取消',
  1085. onOk() {
  1086. _this.deleteMemberSonProject(item.id)
  1087. },
  1088. onCancel() { },
  1089. });
  1090. }}
  1091. >删除</Button>
  1092. </FormItem>
  1093. </div>
  1094. } */}
  1095. </div>
  1096. )
  1097. }
  1098. {
  1099. (isMedit == 0 || isMedit == 2) &&
  1100. this.state.splitList.filter((item) => { return item.type != 3 }).length < this.state.yearSum &&
  1101. <div
  1102. className="clearfix"
  1103. style={{
  1104. width: "100%",
  1105. borderTop: "1px dashed #000000",
  1106. padding: "30px 0 10px 0"
  1107. }}
  1108. >
  1109. {
  1110. !this.state.addFrom &&
  1111. // this.state.splitList.length < this.state.yearSum &&
  1112. this.state.splitList.filter((item) => { return item.type != 3 }).length < this.state.yearSum &&
  1113. <div className="clearfix">
  1114. <Button
  1115. type="primary"
  1116. onClick={() => {
  1117. this.setState({
  1118. addFrom: true,
  1119. })
  1120. }}
  1121. >
  1122. + 本次派单
  1123. </Button>
  1124. </div>
  1125. }
  1126. {
  1127. this.state.addFrom &&
  1128. <div>
  1129. <FormItem
  1130. className="half-item"
  1131. {...formItemLayout}
  1132. label="本次派单"
  1133. >
  1134. <Select
  1135. placeholder="请选择本次派单年份"
  1136. style={{ width: "200px" }}
  1137. value={this.state.serviceYear}
  1138. onChange={(e) => {
  1139. let addId = ""
  1140. let addtext = ""
  1141. if (!!this.state.splitList) {
  1142. for (var i = 0; i < this.state.splitList.length; i++) {
  1143. if (this.state.splitList[i].serviceYear == e && this.state.splitList[i].type == 3) {
  1144. addId = this.state.splitList[i].id
  1145. addtext = this.state.splitList[i].taskComment
  1146. }
  1147. }
  1148. }
  1149. this.setState({
  1150. serviceYear: e,
  1151. recoveryId: addId,
  1152. taskComment: addtext,
  1153. });
  1154. }}
  1155. >
  1156. {this.state.serviceLife.length > 0 && this.state.serviceLife.map(function (item) {
  1157. return (
  1158. <Select.Option key={item} disabled={histYear.includes(item)}>
  1159. {item}
  1160. </Select.Option>
  1161. );
  1162. })}
  1163. </Select>
  1164. {<span className="mandatory">*</span>}
  1165. </FormItem>
  1166. <FormItem
  1167. className="half-item"
  1168. {...formItemLayout}
  1169. label="服务数量"
  1170. >
  1171. <Input
  1172. placeholder="请输入服务数量"
  1173. disabled={isVip == 6}
  1174. value={1}
  1175. style={{ width: "200px" }}
  1176. ref="commodityQuantity"
  1177. />
  1178. {<span className="mandatory">*</span>}
  1179. </FormItem>
  1180. <div className="clearfix">
  1181. <FormItem
  1182. labelCol={{ span: 4 }}
  1183. wrapperCol={{ span: 16 }}
  1184. label="项目说明"
  1185. >
  1186. <Input
  1187. type="textarea"
  1188. placeholder=""
  1189. autosize={{ minRows: 2 }}
  1190. value={this.state.taskComment}
  1191. onChange={(e) => {
  1192. this.setState({ taskComment: e.target.value });
  1193. }}
  1194. />
  1195. </FormItem>
  1196. </div>
  1197. <div className="clearfix">
  1198. <FormItem
  1199. wrapperCol={{ span: 12, offset: 8 }}
  1200. className="half-middle"
  1201. >
  1202. <Button
  1203. className="submitSave"
  1204. type="primary"
  1205. onClick={() => {
  1206. this.addMemberFirstSonProject()
  1207. }}
  1208. >
  1209. 保存
  1210. </Button>
  1211. <Button
  1212. className="submitSave"
  1213. type="ghost"
  1214. onClick={() => {
  1215. this.setState({
  1216. addFrom: false
  1217. })
  1218. }}
  1219. >
  1220. 取消
  1221. </Button>
  1222. </FormItem>
  1223. </div>
  1224. </div>
  1225. }
  1226. </div>
  1227. }
  1228. </div>
  1229. </Spin>
  1230. </Form>
  1231. {
  1232. this.state.addYears &&
  1233. <Modal
  1234. title="添加服务年限"
  1235. visible={this.state.addYears}
  1236. okText="添加"
  1237. onOk={() => {
  1238. if (!this.state.addyear) {
  1239. message.warn("请选择年份!")
  1240. return
  1241. }
  1242. if (this.state.isGive == undefined) {
  1243. message.warn("请选择是否赠送!")
  1244. return
  1245. }
  1246. let slist = this.state.serviceLife
  1247. let newYear = this.state.addyear
  1248. if (this.state.isGive == 0) {
  1249. newYear = newYear
  1250. } else if (this.state.isGive == 1) {
  1251. newYear = newYear + "(赠)"
  1252. }
  1253. slist.push(newYear)
  1254. this.setState({
  1255. serviceLife: slist,
  1256. commodityQuantity: slist.length,
  1257. yearSum: slist.length.toString(),
  1258. addYears: false
  1259. }, () => {
  1260. // let addId = ""
  1261. // if (!!this.state.splitList) {
  1262. // for (var i = 0; i < this.state.splitList.length; i++) {
  1263. // if (this.state.splitList[i].serviceYear == newYear && this.state.splitList[i].type == 3) {
  1264. // addId = this.state.splitList[i].id
  1265. // }
  1266. // }
  1267. // }
  1268. // addId == ""
  1269. // ? this.onChange()
  1270. // : this.updateMemberSonProject(addId)
  1271. })
  1272. }}
  1273. onCancel={() => {
  1274. this.setState({
  1275. addYears: false
  1276. })
  1277. }}
  1278. >
  1279. <Select
  1280. style={{ width: '200px', marginRight: 50 }}
  1281. placeholder="请选择年份"
  1282. onChange={e => {
  1283. this.setState({
  1284. addyear: e,
  1285. })
  1286. }}
  1287. >
  1288. {
  1289. vipYear.map(its => (
  1290. <Option
  1291. key={its}
  1292. disabled={this.state.serviceLife.toString().includes(its)}
  1293. >{its}</Option>
  1294. ))
  1295. }
  1296. </Select>
  1297. <RadioGroup
  1298. onChange={e => {
  1299. this.setState({
  1300. isGive: e.target.value
  1301. })
  1302. }}
  1303. value={this.state.isGive}
  1304. >
  1305. <Radio value={0}>非赠送</Radio>
  1306. <Radio value={1}>赠送</Radio>
  1307. </RadioGroup>
  1308. </Modal>
  1309. }
  1310. </Modal >
  1311. )
  1312. }
  1313. }
  1314. export default newEditProject;