businessCategory.jsx 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916
  1. import React from 'react';
  2. import $ from 'jquery/src/ajax';
  3. import { Form, Icon, Radio, Button, Input, Select, Spin, Table, message, Modal, Upload, Popconfirm } from 'antd';
  4. import { typeModule } from '@/dataDic.js';
  5. import { splitUrl, getTypeModule } from '@/tools.js';
  6. //图片组件
  7. const PicturesWall = React.createClass({
  8. getInitialState() {
  9. return {
  10. previewVisible: false,
  11. previewImage: '',
  12. fileList: [],
  13. tags: []
  14. };
  15. },
  16. handleCancel() {
  17. this.setState({ previewVisible: false });
  18. },
  19. handlePreview(file) {
  20. this.setState({
  21. previewImage: file.url || file.thumbUrl,
  22. previewVisible: true
  23. });
  24. },
  25. handleChange(info) {
  26. let fileList = info.fileList;
  27. this.setState({ fileList });
  28. this.props.fileList(fileList);
  29. },
  30. componentWillReceiveProps(nextProps) {
  31. this.state.fileList = nextProps.pictureUrl;
  32. },
  33. render() {
  34. const { previewVisible, previewImage, fileList } = this.state;
  35. const uploadButton = (
  36. <div>
  37. <Icon type="plus" />
  38. <div className="ant-upload-text">点击上传</div>
  39. </div>
  40. );
  41. return (
  42. <div className="clearfix">
  43. <Upload
  44. action={globalConfig.context + '/api/admin/jtBusiness/uploadPicture'}
  45. data={{ sign: 'jt_business_picture' }}
  46. listType="picture-card"
  47. fileList={fileList}
  48. onPreview={this.handlePreview}
  49. onChange={this.handleChange}
  50. >
  51. {fileList.length >= 1 ? null : uploadButton}
  52. </Upload>
  53. <Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
  54. <img alt="example" style={{ width: '100%' }} src={previewImage} />
  55. </Modal>
  56. </div>
  57. );
  58. }
  59. });
  60. const BusinessCategory = Form.create()(
  61. React.createClass({
  62. loadData(pageNo) {
  63. this.state.data = [];
  64. this.setState({
  65. loading: true,
  66. page: pageNo
  67. });
  68. $.ajax({
  69. method: 'get',
  70. dataType: 'json',
  71. crossDomain: false,
  72. url: globalConfig.context + '/api/admin/jtBusiness/category/list',
  73. data: {
  74. pageNo: pageNo || 1,
  75. pageSize: this.state.pagination.pageSize,
  76. name: this.state.nameSearch, //品类名称
  77. layer: this.state.layerSearch, //组织层级
  78. module: this.state.moduleSearch
  79. },
  80. success: function(data) {
  81. let theArr = [];
  82. if (!data.data || !data.data.list) {
  83. if (data.error && data.error.length) {
  84. message.warning(data.error[0].message);
  85. }
  86. } else {
  87. for (let i = 0; i < data.data.list.length; i++) {
  88. let thisdata = data.data.list[i];
  89. theArr.push({
  90. key: i,
  91. id: thisdata.id, //品类ID
  92. sort: thisdata.sort, //品类序号
  93. number: thisdata.number, //品类编号
  94. module: thisdata.module ? thisdata.module.toString() : undefined,
  95. name: thisdata.name, //品类名称
  96. layer: thisdata.layer,
  97. superId: thisdata.superId,
  98. layerName: thisdata.layerName, //品类层级
  99. superNameId: thisdata.superId, //上级品类
  100. superName: thisdata.superName
  101. });
  102. }
  103. this.state.pagination.current = data.data.pageNo;
  104. this.state.pagination.total = data.data.totalCount;
  105. }
  106. this.setState({
  107. dataSource: theArr,
  108. pagination: this.state.pagination
  109. });
  110. }.bind(this)
  111. }).always(
  112. function() {
  113. this.setState({
  114. loading: false
  115. });
  116. }.bind(this)
  117. );
  118. },
  119. loadMenu() {
  120. this.state.data = [];
  121. $.ajax({
  122. method: 'get',
  123. dataType: 'json',
  124. crossDomain: false,
  125. url: globalConfig.context + '/api/admin/jtBusiness/category/list',
  126. data: {
  127. pageNo: 1,
  128. pageSize: 9999,
  129. layer: 1 //组织层级
  130. },
  131. success: function(data) {
  132. let theArr = [];
  133. if (!data.data || !data.data.list) {
  134. if (data.error && data.error.length) {
  135. message.warning(data.error[0].message);
  136. }
  137. } else {
  138. for (let i = 0; i < data.data.list.length; i++) {
  139. let thisdata = data.data.list[i];
  140. theArr.push({
  141. key: i,
  142. id: thisdata.id, //品类ID
  143. name: thisdata.name //品类名称
  144. });
  145. }
  146. }
  147. this.setState({
  148. dataMenu: theArr
  149. });
  150. }.bind(this)
  151. }).always(
  152. function() {
  153. this.setState({
  154. loading: false
  155. });
  156. }.bind(this)
  157. );
  158. },
  159. getInitialState() {
  160. return {
  161. searchMore: true,
  162. selectedRowKeys: [],
  163. pictureUrl: [],
  164. selectedRows: [],
  165. loading: false,
  166. pagination: {
  167. defaultCurrent: 1,
  168. defaultPageSize: 10,
  169. showQuickJumper: true,
  170. pageSize: 10,
  171. onChange: function(page) {
  172. this.loadData(page);
  173. this.setState({
  174. selectedRowKeys: []
  175. });
  176. }.bind(this),
  177. showTotal: function(total) {
  178. return '共' + total + '条数据';
  179. }
  180. },
  181. columns: [
  182. {
  183. title: '品类编号',
  184. dataIndex: 'number',
  185. key: 'number'
  186. },
  187. {
  188. title: '品类名称',
  189. dataIndex: 'name',
  190. key: 'name'
  191. },
  192. {
  193. title: '品类层级',
  194. dataIndex: 'layerName',
  195. key: 'layerName'
  196. },
  197. {
  198. title: '序号',
  199. dataIndex: 'sort',
  200. key: 'sort'
  201. },
  202. {
  203. title: '所属模块',
  204. dataIndex: 'module',
  205. key: 'module',
  206. render: (text) => {
  207. return getTypeModule(text);
  208. }
  209. },
  210. {
  211. title: '上级品类',
  212. dataIndex: 'superName',
  213. key: 'superName',
  214. render: (text) => {
  215. return text ? text : '超级品类';
  216. }
  217. },
  218. {
  219. title: '操作',
  220. dataIndex: 'superName1',
  221. key: 'superName1',
  222. render: (text, recard) => {
  223. return (
  224. <div>
  225. {recard.layer < 2 && (
  226. <Button
  227. style={{ background: '#51a351', color: '#fff' }}
  228. onClick={(e) => {
  229. e.stopPropagation();
  230. this.nextAdd(recard);
  231. }}
  232. >
  233. 新建下级品类
  234. </Button>
  235. )}
  236. <Button
  237. type="primary"
  238. style={{ margin: 10 }}
  239. onClick={(e) => {
  240. e.stopPropagation();
  241. this.movePre(recard);
  242. }}
  243. >
  244. 上移
  245. </Button>
  246. <Button
  247. type="primary"
  248. onClick={(e) => {
  249. e.stopPropagation();
  250. this.moveTop(recard);
  251. }}
  252. >
  253. 置顶
  254. </Button>
  255. </div>
  256. );
  257. }
  258. }
  259. ],
  260. dataSource: []
  261. };
  262. },
  263. //上移动
  264. movePre(recard) {
  265. this.setState({
  266. loading: false
  267. });
  268. $.ajax({
  269. method: 'POST',
  270. url: globalConfig.context + '/api/admin/jtBusiness/project/moveUp',
  271. data: {
  272. id: recard.id
  273. }
  274. }).done((data) => {
  275. if (data && data.error.length) {
  276. message.error(data.error[0].message);
  277. }
  278. this.setState({ loading: false });
  279. this.loadData(this.state.page);
  280. });
  281. },
  282. //置顶
  283. moveTop(recard) {
  284. this.setState({
  285. loading: false
  286. });
  287. $.ajax({
  288. method: 'POST',
  289. url: globalConfig.context + '/api/admin/jtBusiness/project/setTop',
  290. data: {
  291. id: recard.id
  292. }
  293. }).done((data) => {
  294. if (data && data.error.length) {
  295. message.error(data.error[0].message);
  296. }
  297. this.setState({ loading: false });
  298. this.loadData(this.state.page);
  299. });
  300. },
  301. componentWillMount() {
  302. this.loadData();
  303. this.loadMenu();
  304. },
  305. //新建下级
  306. nextAdd(recard) {
  307. this.setState({
  308. recrdAdd: recard,
  309. visible: true,
  310. name: '',
  311. addFirst: 1,
  312. index: undefined,
  313. appIndex: undefined,
  314. superId: recard.id,
  315. module: recard.module ? recard.module.toString() : 'undefined'
  316. });
  317. },
  318. //编辑保存
  319. edithandleSubmit(e) {
  320. e.preventDefault();
  321. let thePictureUrl = [];
  322. if (this.state.pictureUrl.length) {
  323. let picArr = [];
  324. this.state.pictureUrl.map(function(item) {
  325. if (item.response && item.response.data && item.response.data.length) {
  326. picArr.push(item.response.data);
  327. }
  328. });
  329. thePictureUrl = picArr.join(',');
  330. }
  331. let dataList = {};
  332. if (this.state.layer == '1') {
  333. dataList.id = this.state.id;
  334. dataList.name = this.state.name;
  335. dataList.summary = this.state.summary;
  336. dataList.imgUrl = thePictureUrl.length ? thePictureUrl : '';
  337. dataList.module = this.state.moduleNumber ? this.state.moduleNumber : '0';
  338. dataList.nextModule = this.state.modules;
  339. } else {
  340. dataList.id = this.state.id;
  341. dataList.name = this.state.name;
  342. dataList.summary = this.state.summary;
  343. dataList.imgUrl = thePictureUrl.length ? thePictureUrl : '';
  344. dataList.oldSuperId = this.state.superId;
  345. dataList.superId = this.state.superNameId;
  346. dataList.pcIndex =this.state.index,
  347. dataList.appIndex=this.state.appIndex
  348. }
  349. $.ajax({
  350. method: 'post',
  351. dataType: 'json',
  352. crossDomain: false,
  353. url: globalConfig.context + '/api/admin/jtBusiness/category/update',
  354. data: dataList
  355. }).done(
  356. function(data) {
  357. if (!data.error.length) {
  358. message.success('保存成功!');
  359. this.setState({
  360. loading: false,
  361. editvisible: false
  362. });
  363. } else {
  364. message.warning(data.error[0].message);
  365. }
  366. this.loadData(this.state.page);
  367. }.bind(this)
  368. );
  369. },
  370. //整行删除
  371. delectRow() {
  372. let deletedIds = [];
  373. let rowItem = this.state.selectedRowKeys[0];
  374. let data = this.state.dataSource || [];
  375. if (data.length) {
  376. deletedIds.push(data[rowItem].id);
  377. }
  378. this.setState({
  379. selectedRowKeys: [],
  380. loading: deletedIds.length > 0
  381. });
  382. $.ajax({
  383. method: 'post',
  384. dataType: 'json',
  385. crossDomain: false,
  386. url: globalConfig.context + '/api/admin/jtBusiness/category/delete',
  387. data: {
  388. id: deletedIds[0]
  389. }
  390. }).done(
  391. function(data) {
  392. if (!data.error.length) {
  393. message.success('删除成功!');
  394. this.setState({
  395. loading: false
  396. });
  397. } else {
  398. message.warning(data.error[0].message);
  399. }
  400. this.loadData(this.state.page);
  401. this.loadMenu();
  402. }.bind(this)
  403. );
  404. },
  405. addClick() {
  406. this.state.RowData = {};
  407. this.setState({
  408. visible: true,
  409. addFirst: 0,
  410. name: '',
  411. superId: '',
  412. module: '1',
  413. index: undefined,
  414. appIndex: undefined
  415. });
  416. },
  417. //新增保存
  418. addhandleSubmit(e) {
  419. e.preventDefault();
  420. this.setState({
  421. loading: true
  422. });
  423. $.ajax({
  424. method: 'post',
  425. dataType: 'json',
  426. crossDomain: false,
  427. url: globalConfig.context + '/api/admin/jtBusiness/category/apply',
  428. data: {
  429. name: this.state.name,
  430. superId: this.state.superId,
  431. layer: this.state.addFirst ? this.state.recrdAdd.layer + 1 : '1',
  432. module: this.state.module,
  433. pcIndex : this.state.index,
  434. appIndex: this.state.appIndex
  435. }
  436. }).done(
  437. function(data) {
  438. if (!data.error.length) {
  439. message.success('新增成功!');
  440. this.setState({
  441. loading: false,
  442. visible: false
  443. });
  444. } else {
  445. message.warning(data.error[0].message);
  446. }
  447. this.loadData(this.state.page);
  448. this.loadMenu();
  449. }.bind(this)
  450. );
  451. },
  452. editClick() {
  453. this.state.RowData = {};
  454. this.setState({
  455. editvisible: true
  456. });
  457. },
  458. detailes(recard) {
  459. this.setState({
  460. loading: true
  461. });
  462. $.ajax({
  463. method: 'get',
  464. dataType: 'json',
  465. crossDomain: false,
  466. url: globalConfig.context + '/api/admin/jtBusiness/category/detail',
  467. data: {
  468. id: recard.id
  469. },
  470. success: function(data) {
  471. if (!data.data) {
  472. if (data.error && data.error.length) {
  473. message.warning(data.error[0].message);
  474. }
  475. } else {
  476. let thisdata = data.data;
  477. this.setState({
  478. id: thisdata.id, //品类id
  479. name: thisdata.name, //品类名称
  480. createTime: thisdata.createTime ? new Date(thisdata.createTime).toLocaleString() : '',
  481. superId: thisdata.superId, //父类id
  482. modules: thisdata.module ? thisdata.module.toString() : undefined,
  483. pictureUrl: thisdata.imgUrl
  484. ? splitUrl(thisdata.imgUrl, ',', globalConfig.avatarHost + '/upload')
  485. : [],
  486. number: thisdata.number,
  487. layer: thisdata.layer,
  488. superNameId: thisdata.superId,
  489. index:thisdata.pcIndex ,
  490. appIndex:thisdata.appIndex,
  491. moduleNumber: thisdata.module ? thisdata.module.toString() : undefined
  492. });
  493. }
  494. }.bind(this)
  495. }).always(
  496. function() {
  497. this.setState({
  498. loading: false
  499. });
  500. }.bind(this)
  501. );
  502. },
  503. handleCancel() {
  504. this.setState({ visible: false });
  505. },
  506. edithandleCancel() {
  507. this.setState({ editvisible: false });
  508. },
  509. search() {
  510. this.loadData();
  511. },
  512. reset() {
  513. this.state.nameSearch = ''; //品类名称清零
  514. this.state.moduleSearch = undefined;
  515. this.state.layerSearch = undefined; //品类层级清零
  516. this.loadData();
  517. },
  518. searchSwitch() {
  519. this.setState({
  520. searchMore: !this.state.searchMore
  521. });
  522. },
  523. getPictureUrl(e) {
  524. this.setState({ pictureUrl: e });
  525. },
  526. tableRowClick(record, index) {
  527. this.setState({
  528. editvisible: true,
  529. visible: false,
  530. theData: record
  531. });
  532. this.detailes(record);
  533. },
  534. render() {
  535. const FormItem = Form.Item;
  536. const rowSelection = {
  537. selectedRowKeys: this.state.selectedRowKeys,
  538. onChange: (selectedRowKeys, selectedRows) => {
  539. this.setState({
  540. selectedRows: selectedRows.slice(-1),
  541. selectedRowKeys: selectedRowKeys.slice(-1)
  542. });
  543. }
  544. };
  545. const hasSelected = this.state.selectedRowKeys.length > 0;
  546. const theData = this.state.theData || {};
  547. const recrdAdd = this.state.recrdAdd || {};
  548. const dataMenu = this.state.dataMenu || {};
  549. return (
  550. <div className="user-content">
  551. <div className="content-title">
  552. <div className="content-title">
  553. <span>项目业务管理</span>
  554. </div>
  555. <div className="user-search">
  556. <Input
  557. placeholder="业务品类名称"
  558. style={{ width: '150px', marginRight: '10px', marginBottom: '10px' }}
  559. value={this.state.nameSearch}
  560. onChange={(e) => {
  561. this.setState({ nameSearch: e.target.value });
  562. }}
  563. />
  564. <Select
  565. placeholder="品类层级"
  566. style={{ width: '200px', marginRight: '10px' }}
  567. value={this.state.layerSearch}
  568. onChange={(e) => {
  569. this.setState({ layerSearch: e });
  570. }}
  571. >
  572. <Select.Option value="1">一级</Select.Option>
  573. <Select.Option value="2">二级</Select.Option>
  574. </Select>
  575. <Select
  576. style={{ width: '200px', marginRight: '10px' }}
  577. value={this.state.moduleSearch}
  578. placeholder="模块"
  579. onChange={(e) => {
  580. this.setState({ moduleSearch: e });
  581. }}
  582. >
  583. {typeModule.map((item) => {
  584. return (
  585. <Select.Option key={item.value} value={item.value}>
  586. {item.key}
  587. </Select.Option>
  588. );
  589. })}
  590. </Select>
  591. <Button type="primary" onClick={this.search} style={{ marginRight: '10px' }}>
  592. 搜索
  593. </Button>
  594. <Button onClick={this.reset} style={{ marginRight: '10px' }}>
  595. 重置
  596. </Button>
  597. <Popconfirm title="是否删除?" onConfirm={this.delectRow} okText="是" cancelText="否">
  598. <Button
  599. style={{ marginRight: '10px', marginLeft: '10px' }}
  600. type="danger"
  601. disabled={!hasSelected}
  602. >
  603. 删除<Icon type="minus" />
  604. </Button>
  605. </Popconfirm>
  606. <Popconfirm title="是否停用?" onConfirm={this.blockRow} okText="是" cancelText="否">
  607. <Button
  608. style={{
  609. background: '#ea0862',
  610. border: 'none',
  611. color: '#fff',
  612. marginRight: '10px',
  613. marginLeft: '10px',
  614. display: 'none'
  615. }}
  616. disabled={!hasSelected}
  617. >
  618. 停用<Icon type="minus" />
  619. </Button>
  620. </Popconfirm>
  621. <Button
  622. type="primary"
  623. className="addButton"
  624. onClick={this.addClick}
  625. style={{ float: 'right', marginRight: '200px' }}
  626. >
  627. 新增品类<Icon type="plus" />
  628. </Button>
  629. </div>
  630. <div className="patent-table">
  631. <Spin spinning={this.state.loading}>
  632. <Table
  633. columns={this.state.columns}
  634. dataSource={this.state.dataSource}
  635. rowSelection={rowSelection}
  636. pagination={this.state.pagination}
  637. onRowClick={this.tableRowClick}
  638. />
  639. </Spin>
  640. </div>
  641. <div className="patent-desc">
  642. <Modal
  643. maskClosable={false}
  644. visible={this.state.visible}
  645. onOk={this.checkPatentProcess}
  646. onCancel={this.handleCancel}
  647. width="420px"
  648. title="新增品类"
  649. footer=""
  650. className="admin-desc-content"
  651. >
  652. <Form
  653. layout="horizontal"
  654. onSubmit={(e) => {
  655. this.addhandleSubmit(e, {});
  656. }}
  657. id="demand-form"
  658. >
  659. <Spin spinning={this.state.loading}>
  660. <div className="clearfix">
  661. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="品类名称">
  662. <Input
  663. placeholder="品类名称"
  664. value={this.state.name}
  665. style={{ width: '94%' }}
  666. onChange={(e) => {
  667. this.setState({ name: e.target.value });
  668. }}
  669. required="required"
  670. />
  671. <span className="mandatory" style={{ color: 'red', marginLeft: '5px' }}>
  672. *
  673. </span>
  674. </FormItem>
  675. </div>
  676. <div className="clearfix">
  677. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="所属模块">
  678. {!this.state.addFirst ? (
  679. <Select
  680. value={this.state.module}
  681. onChange={(e) => {
  682. this.setState({ module: e });
  683. }}
  684. >
  685. {typeModule.map((item) => {
  686. return (
  687. <Select.Option key={item.value} value={item.value}>
  688. {item.key}
  689. </Select.Option>
  690. );
  691. })}
  692. </Select>
  693. ) : (
  694. <span>{getTypeModule(recrdAdd.module)}</span>
  695. )}
  696. </FormItem>
  697. </div>
  698. <div className="clearfix">
  699. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="上级品类">
  700. <span>{this.state.addFirst ? recrdAdd.name : '超级品类'}</span>
  701. </FormItem>
  702. </div>
  703. {this.state.addFirst ? (
  704. <div>
  705. <div className="clearfix">
  706. <FormItem
  707. labelCol={{ span: 7 }}
  708. wrapperCol={{ span: 12 }}
  709. label="发布到项目首页"
  710. >
  711. <Radio.Group
  712. onChange={(e) => {
  713. this.setState({ index: e.target.value });
  714. }}
  715. value={this.state.index}
  716. >
  717. <Radio value={1}>是</Radio>
  718. <Radio value={0}>否</Radio>
  719. </Radio.Group>
  720. </FormItem>
  721. </div>
  722. <div className="clearfix">
  723. <FormItem
  724. labelCol={{ span: 7 }}
  725. wrapperCol={{ span: 12 }}
  726. label="发布到APP首页"
  727. >
  728. <Radio.Group
  729. onChange={(e) => {
  730. this.setState({ appIndex: e.target.value });
  731. }}
  732. value={this.state.appIndex}
  733. >
  734. <Radio value={1}>是</Radio>
  735. <Radio value={0}>否</Radio>
  736. </Radio.Group>
  737. </FormItem>
  738. </div>
  739. </div>
  740. ) : (
  741. ''
  742. )}
  743. <FormItem wrapperCol={{ span: 12, offset: 7 }}>
  744. <Button className="set-submit" type="primary" htmlType="submit">
  745. 保存
  746. </Button>
  747. <Button
  748. className="set-submit"
  749. type="ghost"
  750. onClick={this.handleCancel}
  751. style={{ marginLeft: '15px' }}
  752. >
  753. 取消
  754. </Button>
  755. </FormItem>
  756. </Spin>
  757. </Form>
  758. </Modal>
  759. </div>
  760. <div className="patent-desc">
  761. <Modal
  762. maskClosable={false}
  763. visible={this.state.editvisible}
  764. onOk={this.checkPatentProcess}
  765. onCancel={this.edithandleCancel}
  766. width="600px"
  767. title="编辑品类"
  768. footer=""
  769. className="admin-desc-content"
  770. >
  771. <Form layout="horizontal" onSubmit={this.edithandleSubmit} id="demand-form">
  772. <Spin spinning={this.state.loading}>
  773. <div className="clearfix">
  774. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="品类名称">
  775. <Input
  776. placeholder="组织名称"
  777. value={this.state.name}
  778. onChange={(e) => {
  779. this.setState({ name: e.target.value });
  780. }}
  781. />
  782. </FormItem>
  783. </div>
  784. {theData.layer == '2' ? (
  785. <div className="clearfix">
  786. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="上级品类">
  787. <Select
  788. onChange={(e) => {
  789. this.setState({ superNameId: e });
  790. }}
  791. value={this.state.superNameId}
  792. >
  793. {dataMenu.map((item) => {
  794. return (
  795. <Select.Option key={item.key} value={item.id}>
  796. {item.name}
  797. </Select.Option>
  798. );
  799. })}
  800. </Select>
  801. </FormItem>
  802. </div>
  803. ) : (
  804. ''
  805. )}
  806. {this.state.layer=='2'?<div>
  807. <div className="clearfix">
  808. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="发布到项目首页">
  809. <Radio.Group
  810. onChange={(e) => {
  811. this.setState({ index: e.target.value });
  812. }}
  813. value={this.state.index}
  814. >
  815. <Radio value={1}>是</Radio>
  816. <Radio value={0}>否</Radio>
  817. </Radio.Group>
  818. </FormItem>
  819. </div>
  820. <div className="clearfix">
  821. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="发布到APP首页">
  822. <Radio.Group
  823. onChange={(e) => {
  824. this.setState({ appIndex: e.target.value });
  825. }}
  826. value={this.state.appIndex}
  827. >
  828. <Radio value={1}>是</Radio>
  829. <Radio value={0}>否</Radio>
  830. </Radio.Group>
  831. </FormItem>
  832. </div>
  833. </div>:''}
  834. <div className="clearfix">
  835. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="业务品类图标">
  836. <PicturesWall
  837. fileList={this.getPictureUrl}
  838. pictureUrl={this.state.pictureUrl}
  839. visible={this.props.visible}
  840. />
  841. </FormItem>
  842. </div>
  843. <div className="clearfix">
  844. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="品类序号">
  845. <span>{theData.sort}</span>
  846. </FormItem>
  847. </div>
  848. <div className="clearfix">
  849. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="品类层级">
  850. <span>{theData.layerName}</span>
  851. </FormItem>
  852. </div>
  853. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="所属模块">
  854. {theData.layer == '1' ? (
  855. <Select
  856. value={this.state.modules}
  857. onChange={(e) => {
  858. this.setState({ modules: e });
  859. }}
  860. style={{ width: 160 }}
  861. >
  862. {typeModule.map((item) => {
  863. return (
  864. <Select.Option key={item.value} value={item.value}>
  865. {item.key}
  866. </Select.Option>
  867. );
  868. })}
  869. </Select>
  870. ) : (
  871. <span>{getTypeModule(this.state.modules)}</span>
  872. )}
  873. </FormItem>
  874. <div className="clearfix">
  875. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="品类编号">
  876. <span>{theData.number}</span>
  877. </FormItem>
  878. </div>
  879. <div className="clearfix">
  880. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="创建人">
  881. <span>超级管理员</span>
  882. </FormItem>
  883. </div>
  884. <div className="clearfix">
  885. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="创建时间">
  886. <span>{this.state.createTime}</span>
  887. </FormItem>
  888. </div>
  889. <FormItem wrapperCol={{ span: 12, offset: 7 }}>
  890. <Button className="set-submit" type="primary" htmlType="submit">
  891. 保存
  892. </Button>
  893. <Button
  894. className="set-submit"
  895. type="ghost"
  896. onClick={this.edithandleCancel}
  897. style={{ marginLeft: '100px' }}
  898. >
  899. 取消
  900. </Button>
  901. </FormItem>
  902. </Spin>
  903. </Form>
  904. </Modal>
  905. </div>
  906. </div>
  907. </div>
  908. );
  909. }
  910. })
  911. );
  912. export default BusinessCategory;