businessCategory.jsx 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951
  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. homeIndex: undefined,
  315. superId: recard.id,
  316. module: recard.module ? recard.module.toString() : 'undefined'
  317. });
  318. },
  319. //编辑保存
  320. edithandleSubmit(e) {
  321. e.preventDefault();
  322. let thePictureUrl = [];
  323. if (this.state.pictureUrl.length) {
  324. let picArr = [];
  325. this.state.pictureUrl.map(function(item) {
  326. if (item.response && item.response.data && item.response.data.length) {
  327. picArr.push(item.response.data);
  328. }
  329. });
  330. thePictureUrl = picArr.join(',');
  331. }
  332. let dataList = {};
  333. if (this.state.layer == '1') {
  334. dataList.id = this.state.id;
  335. dataList.name = this.state.name;
  336. dataList.summary = this.state.summary;
  337. dataList.imgUrl = thePictureUrl.length ? thePictureUrl : '';
  338. dataList.module = this.state.moduleNumber ? this.state.moduleNumber : '0';
  339. dataList.nextModule = this.state.modules;
  340. } else {
  341. dataList.id = this.state.id;
  342. dataList.name = this.state.name;
  343. dataList.summary = this.state.summary;
  344. dataList.imgUrl = thePictureUrl.length ? thePictureUrl : '';
  345. dataList.oldSuperId = this.state.superId;
  346. dataList.superId = this.state.superNameId;
  347. dataList.pcIndex =this.state.index;
  348. dataList.appIndex=this.state.appIndex;
  349. dataList.homeIndex=this.state.homeIndex;
  350. }
  351. $.ajax({
  352. method: 'post',
  353. dataType: 'json',
  354. crossDomain: false,
  355. url: globalConfig.context + '/api/admin/jtBusiness/category/update',
  356. data: dataList
  357. }).done(
  358. function(data) {
  359. if (!data.error.length) {
  360. message.success('保存成功!');
  361. this.setState({
  362. loading: false,
  363. editvisible: false
  364. });
  365. } else {
  366. message.warning(data.error[0].message);
  367. }
  368. this.loadData(this.state.page);
  369. }.bind(this)
  370. );
  371. },
  372. //整行删除
  373. delectRow() {
  374. let deletedIds = [];
  375. let rowItem = this.state.selectedRowKeys[0];
  376. let data = this.state.dataSource || [];
  377. if (data.length) {
  378. deletedIds.push(data[rowItem].id);
  379. }
  380. this.setState({
  381. selectedRowKeys: [],
  382. loading: deletedIds.length > 0
  383. });
  384. $.ajax({
  385. method: 'post',
  386. dataType: 'json',
  387. crossDomain: false,
  388. url: globalConfig.context + '/api/admin/jtBusiness/category/delete',
  389. data: {
  390. id: deletedIds[0]
  391. }
  392. }).done(
  393. function(data) {
  394. if (!data.error.length) {
  395. message.success('删除成功!');
  396. this.setState({
  397. loading: false
  398. });
  399. } else {
  400. message.warning(data.error[0].message);
  401. }
  402. this.loadData(this.state.page);
  403. this.loadMenu();
  404. }.bind(this)
  405. );
  406. },
  407. addClick() {
  408. this.state.RowData = {};
  409. this.setState({
  410. visible: true,
  411. addFirst: 0,
  412. name: '',
  413. superId: '',
  414. module: '1',
  415. index: undefined,
  416. appIndex: undefined,
  417. homeIndex: undefined,
  418. });
  419. },
  420. //新增保存
  421. addhandleSubmit(e) {
  422. e.preventDefault();
  423. this.setState({
  424. loading: true
  425. });
  426. $.ajax({
  427. method: 'post',
  428. dataType: 'json',
  429. crossDomain: false,
  430. url: globalConfig.context + '/api/admin/jtBusiness/category/apply',
  431. data: {
  432. name: this.state.name,
  433. superId: this.state.superId,
  434. layer: this.state.addFirst ? this.state.recrdAdd.layer + 1 : '1',
  435. module: this.state.module,
  436. pcIndex : this.state.index,
  437. appIndex: this.state.appIndex,
  438. homeIndex: this.state.homeIndex
  439. }
  440. }).done(
  441. function(data) {
  442. if (!data.error.length) {
  443. message.success('新增成功!');
  444. this.setState({
  445. loading: false,
  446. visible: false
  447. });
  448. } else {
  449. message.warning(data.error[0].message);
  450. }
  451. this.loadData(this.state.page);
  452. this.loadMenu();
  453. }.bind(this)
  454. );
  455. },
  456. editClick() {
  457. this.state.RowData = {};
  458. this.setState({
  459. editvisible: true
  460. });
  461. },
  462. detailes(recard) {
  463. this.setState({
  464. loading: true
  465. });
  466. $.ajax({
  467. method: 'get',
  468. dataType: 'json',
  469. crossDomain: false,
  470. url: globalConfig.context + '/api/admin/jtBusiness/category/detail',
  471. data: {
  472. id: recard.id
  473. },
  474. success: function(data) {
  475. if (!data.data) {
  476. if (data.error && data.error.length) {
  477. message.warning(data.error[0].message);
  478. }
  479. } else {
  480. let thisdata = data.data;
  481. this.setState({
  482. id: thisdata.id, //品类id
  483. name: thisdata.name, //品类名称
  484. createTime: thisdata.createTime ? new Date(thisdata.createTime).toLocaleString() : '',
  485. superId: thisdata.superId, //父类id
  486. modules: thisdata.module ? thisdata.module.toString() : undefined,
  487. pictureUrl: thisdata.imgUrl
  488. ? splitUrl(thisdata.imgUrl, ',', globalConfig.avatarHost + '/upload')
  489. : [],
  490. number: thisdata.number,
  491. layer: thisdata.layer,
  492. superNameId: thisdata.superId,
  493. index:thisdata.pcIndex ,
  494. homeIndex:thisdata.homeIndex ,
  495. appIndex:thisdata.appIndex,
  496. moduleNumber: thisdata.module ? thisdata.module.toString() : undefined
  497. });
  498. }
  499. }.bind(this)
  500. }).always(
  501. function() {
  502. this.setState({
  503. loading: false
  504. });
  505. }.bind(this)
  506. );
  507. },
  508. handleCancel() {
  509. this.setState({ visible: false });
  510. },
  511. edithandleCancel() {
  512. this.setState({ editvisible: false });
  513. },
  514. search() {
  515. this.loadData();
  516. },
  517. reset() {
  518. this.state.nameSearch = ''; //品类名称清零
  519. this.state.moduleSearch = undefined;
  520. this.state.layerSearch = undefined; //品类层级清零
  521. this.loadData();
  522. },
  523. searchSwitch() {
  524. this.setState({
  525. searchMore: !this.state.searchMore
  526. });
  527. },
  528. getPictureUrl(e) {
  529. this.setState({ pictureUrl: e });
  530. },
  531. tableRowClick(record, index) {
  532. this.setState({
  533. editvisible: true,
  534. visible: false,
  535. theData: record
  536. });
  537. this.detailes(record);
  538. },
  539. render() {
  540. const FormItem = Form.Item;
  541. const rowSelection = {
  542. selectedRowKeys: this.state.selectedRowKeys,
  543. onChange: (selectedRowKeys, selectedRows) => {
  544. this.setState({
  545. selectedRows: selectedRows.slice(-1),
  546. selectedRowKeys: selectedRowKeys.slice(-1)
  547. });
  548. }
  549. };
  550. const hasSelected = this.state.selectedRowKeys.length > 0;
  551. const theData = this.state.theData || {};
  552. const recrdAdd = this.state.recrdAdd || {};
  553. const dataMenu = this.state.dataMenu || {};
  554. return (
  555. <div className="user-content">
  556. <div className="content-title">
  557. <div className="content-title">
  558. <span>项目业务管理</span>
  559. </div>
  560. <div className="user-search">
  561. <Input
  562. placeholder="业务品类名称"
  563. style={{ width: '150px', marginRight: '10px', marginBottom: '10px' }}
  564. value={this.state.nameSearch}
  565. onChange={(e) => {
  566. this.setState({ nameSearch: e.target.value });
  567. }}
  568. />
  569. <Select
  570. placeholder="品类层级"
  571. style={{ width: '200px', marginRight: '10px' }}
  572. value={this.state.layerSearch}
  573. onChange={(e) => {
  574. this.setState({ layerSearch: e });
  575. }}
  576. >
  577. <Select.Option value="1">一级</Select.Option>
  578. <Select.Option value="2">二级</Select.Option>
  579. </Select>
  580. <Select
  581. style={{ width: '200px', marginRight: '10px' }}
  582. value={this.state.moduleSearch}
  583. placeholder="模块"
  584. onChange={(e) => {
  585. this.setState({ moduleSearch: e });
  586. }}
  587. >
  588. {typeModule.map((item) => {
  589. return (
  590. <Select.Option key={item.value} value={item.value}>
  591. {item.key}
  592. </Select.Option>
  593. );
  594. })}
  595. </Select>
  596. <Button type="primary" onClick={this.search} style={{ marginRight: '10px' }}>
  597. 搜索
  598. </Button>
  599. <Button onClick={this.reset} style={{ marginRight: '10px' }}>
  600. 重置
  601. </Button>
  602. <Popconfirm title="是否删除?" onConfirm={this.delectRow} okText="是" cancelText="否">
  603. <Button
  604. style={{ marginRight: '10px', marginLeft: '10px' }}
  605. type="danger"
  606. disabled={!hasSelected}
  607. >
  608. 删除<Icon type="minus" />
  609. </Button>
  610. </Popconfirm>
  611. <Popconfirm title="是否停用?" onConfirm={this.blockRow} okText="是" cancelText="否">
  612. <Button
  613. style={{
  614. background: '#ea0862',
  615. border: 'none',
  616. color: '#fff',
  617. marginRight: '10px',
  618. marginLeft: '10px',
  619. display: 'none'
  620. }}
  621. disabled={!hasSelected}
  622. >
  623. 停用<Icon type="minus" />
  624. </Button>
  625. </Popconfirm>
  626. <Button
  627. type="primary"
  628. className="addButton"
  629. onClick={this.addClick}
  630. style={{ float: 'right', marginRight: '200px' }}
  631. >
  632. 新增品类<Icon type="plus" />
  633. </Button>
  634. </div>
  635. <div className="patent-table">
  636. <Spin spinning={this.state.loading}>
  637. <Table
  638. columns={this.state.columns}
  639. dataSource={this.state.dataSource}
  640. rowSelection={rowSelection}
  641. pagination={this.state.pagination}
  642. onRowClick={this.tableRowClick}
  643. />
  644. </Spin>
  645. </div>
  646. <div className="patent-desc">
  647. <Modal
  648. maskClosable={false}
  649. visible={this.state.visible}
  650. onOk={this.checkPatentProcess}
  651. onCancel={this.handleCancel}
  652. width="420px"
  653. title="新增品类"
  654. footer=""
  655. className="admin-desc-content"
  656. >
  657. <Form
  658. layout="horizontal"
  659. onSubmit={(e) => {
  660. this.addhandleSubmit(e, {});
  661. }}
  662. id="demand-form"
  663. >
  664. <Spin spinning={this.state.loading}>
  665. <div className="clearfix">
  666. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="品类名称">
  667. <Input
  668. placeholder="品类名称"
  669. value={this.state.name}
  670. style={{ width: '94%' }}
  671. onChange={(e) => {
  672. this.setState({ name: e.target.value });
  673. }}
  674. required="required"
  675. />
  676. <span className="mandatory" style={{ color: 'red', marginLeft: '5px' }}>
  677. *
  678. </span>
  679. </FormItem>
  680. </div>
  681. <div className="clearfix">
  682. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="所属模块">
  683. {!this.state.addFirst ? (
  684. <Select
  685. value={this.state.module}
  686. onChange={(e) => {
  687. this.setState({ module: e });
  688. }}
  689. >
  690. {typeModule.map((item) => {
  691. return (
  692. <Select.Option key={item.value} value={item.value}>
  693. {item.key}
  694. </Select.Option>
  695. );
  696. })}
  697. </Select>
  698. ) : (
  699. <span>{getTypeModule(recrdAdd.module)}</span>
  700. )}
  701. </FormItem>
  702. </div>
  703. <div className="clearfix">
  704. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="上级品类">
  705. <span>{this.state.addFirst ? recrdAdd.name : '超级品类'}</span>
  706. </FormItem>
  707. </div>
  708. {this.state.addFirst ? (
  709. <div>
  710. <div className="clearfix">
  711. <FormItem
  712. labelCol={{ span: 7 }}
  713. wrapperCol={{ span: 12 }}
  714. label="发布到项目首页"
  715. >
  716. <Radio.Group
  717. onChange={(e) => {
  718. this.setState({ index: e.target.value });
  719. }}
  720. value={this.state.index}
  721. >
  722. <Radio value={1}>是</Radio>
  723. <Radio value={0}>否</Radio>
  724. </Radio.Group>
  725. </FormItem>
  726. </div>
  727. <div className="clearfix">
  728. <FormItem
  729. labelCol={{ span: 7 }}
  730. wrapperCol={{ span: 12 }}
  731. label="发布到PC首页"
  732. >
  733. <Radio.Group
  734. onChange={(e) => {
  735. this.setState({ homeIndex: e.target.value });
  736. }}
  737. value={this.state.homeIndex}
  738. >
  739. <Radio value={1}>是</Radio>
  740. <Radio value={0}>否</Radio>
  741. </Radio.Group>
  742. </FormItem>
  743. </div>
  744. <div className="clearfix">
  745. <FormItem
  746. labelCol={{ span: 7 }}
  747. wrapperCol={{ span: 12 }}
  748. label="发布到APP首页"
  749. >
  750. <Radio.Group
  751. onChange={(e) => {
  752. this.setState({ appIndex: e.target.value });
  753. }}
  754. value={this.state.appIndex}
  755. >
  756. <Radio value={1}>是</Radio>
  757. <Radio value={0}>否</Radio>
  758. </Radio.Group>
  759. </FormItem>
  760. </div>
  761. </div>
  762. ) : (
  763. ''
  764. )}
  765. <FormItem wrapperCol={{ span: 12, offset: 7 }}>
  766. <Button className="set-submit" type="primary" htmlType="submit">
  767. 保存
  768. </Button>
  769. <Button
  770. className="set-submit"
  771. type="ghost"
  772. onClick={this.handleCancel}
  773. style={{ marginLeft: '15px' }}
  774. >
  775. 取消
  776. </Button>
  777. </FormItem>
  778. </Spin>
  779. </Form>
  780. </Modal>
  781. </div>
  782. <div className="patent-desc">
  783. <Modal
  784. maskClosable={false}
  785. visible={this.state.editvisible}
  786. onOk={this.checkPatentProcess}
  787. onCancel={this.edithandleCancel}
  788. width="600px"
  789. title="编辑品类"
  790. footer=""
  791. className="admin-desc-content"
  792. >
  793. <Form layout="horizontal" onSubmit={this.edithandleSubmit} id="demand-form">
  794. <Spin spinning={this.state.loading}>
  795. <div className="clearfix">
  796. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="品类名称">
  797. <Input
  798. placeholder="组织名称"
  799. value={this.state.name}
  800. onChange={(e) => {
  801. this.setState({ name: e.target.value });
  802. }}
  803. />
  804. </FormItem>
  805. </div>
  806. {theData.layer == '2' ? (
  807. <div className="clearfix">
  808. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="上级品类">
  809. <Select
  810. onChange={(e) => {
  811. this.setState({ superNameId: e });
  812. }}
  813. value={this.state.superNameId}
  814. >
  815. {dataMenu.map((item) => {
  816. return (
  817. <Select.Option key={item.key} value={item.id}>
  818. {item.name}
  819. </Select.Option>
  820. );
  821. })}
  822. </Select>
  823. </FormItem>
  824. </div>
  825. ) : (
  826. ''
  827. )}
  828. {this.state.layer=='2'?<div>
  829. <div className="clearfix">
  830. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="发布到项目首页">
  831. <Radio.Group
  832. onChange={(e) => {
  833. this.setState({ index: e.target.value });
  834. }}
  835. value={this.state.index}
  836. >
  837. <Radio value={1}>是</Radio>
  838. <Radio value={0}>否</Radio>
  839. </Radio.Group>
  840. </FormItem>
  841. </div>
  842. <div className="clearfix">
  843. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="发布到PC首页">
  844. <Radio.Group
  845. onChange={(e) => {
  846. this.setState({ homeIndex: e.target.value });
  847. }}
  848. value={this.state.homeIndex}
  849. >
  850. <Radio value={1}>是</Radio>
  851. <Radio value={0}>否</Radio>
  852. </Radio.Group>
  853. </FormItem>
  854. </div>
  855. <div className="clearfix">
  856. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="发布到APP首页">
  857. <Radio.Group
  858. onChange={(e) => {
  859. this.setState({ appIndex: e.target.value });
  860. }}
  861. value={this.state.appIndex}
  862. >
  863. <Radio value={1}>是</Radio>
  864. <Radio value={0}>否</Radio>
  865. </Radio.Group>
  866. </FormItem>
  867. </div>
  868. </div>:''}
  869. <div className="clearfix">
  870. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="业务品类图标">
  871. <PicturesWall
  872. fileList={this.getPictureUrl}
  873. pictureUrl={this.state.pictureUrl}
  874. visible={this.props.visible}
  875. />
  876. </FormItem>
  877. </div>
  878. <div className="clearfix">
  879. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="品类序号">
  880. <span>{theData.sort}</span>
  881. </FormItem>
  882. </div>
  883. <div className="clearfix">
  884. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="品类层级">
  885. <span>{theData.layerName}</span>
  886. </FormItem>
  887. </div>
  888. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="所属模块">
  889. {theData.layer == '1' ? (
  890. <Select
  891. value={this.state.modules}
  892. onChange={(e) => {
  893. this.setState({ modules: e });
  894. }}
  895. style={{ width: 160 }}
  896. >
  897. {typeModule.map((item) => {
  898. return (
  899. <Select.Option key={item.value} value={item.value}>
  900. {item.key}
  901. </Select.Option>
  902. );
  903. })}
  904. </Select>
  905. ) : (
  906. <span>{getTypeModule(this.state.modules)}</span>
  907. )}
  908. </FormItem>
  909. <div className="clearfix">
  910. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="品类编号">
  911. <span>{theData.number}</span>
  912. </FormItem>
  913. </div>
  914. <div className="clearfix">
  915. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="创建人">
  916. <span>超级管理员</span>
  917. </FormItem>
  918. </div>
  919. <div className="clearfix">
  920. <FormItem labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} label="创建时间">
  921. <span>{this.state.createTime}</span>
  922. </FormItem>
  923. </div>
  924. <FormItem wrapperCol={{ span: 12, offset: 7 }}>
  925. <Button className="set-submit" type="primary" htmlType="submit">
  926. 保存
  927. </Button>
  928. <Button
  929. className="set-submit"
  930. type="ghost"
  931. onClick={this.edithandleCancel}
  932. style={{ marginLeft: '100px' }}
  933. >
  934. 取消
  935. </Button>
  936. </FormItem>
  937. </Spin>
  938. </Form>
  939. </Modal>
  940. </div>
  941. </div>
  942. </div>
  943. );
  944. }
  945. })
  946. );
  947. export default BusinessCategory;