businessCategory.jsx 35 KB

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