businessCategory.jsx 37 KB

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