businessCategory.jsx 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903
  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:
  250. globalConfig.context + "/api/admin/Varieties/editVarieties",
  251. data: {
  252. id: this.state.editId, //品类ID
  253. cname: this.state.editName, //品类名称
  254. superId: changeSuper, //上级品类
  255. status: this.state.editStatus, //品类状态
  256. varietiesLogo: theorgCodeUrl,
  257. sort: this.state.editSort
  258. }
  259. }).done(
  260. function(data) {
  261. this.setState({
  262. loading: false
  263. });
  264. if (!data.error.length) {
  265. message.success("保存成功!");
  266. this.edithandleCancel();
  267. this.selectSuperId();
  268. } else {
  269. message.warning(data.error[0].message);
  270. }
  271. }.bind(this)
  272. );
  273. return false
  274. }
  275. }else {
  276. $.ajax({
  277. method: "post",
  278. dataType: "json",
  279. crossDomain: false,
  280. url:
  281. globalConfig.context + "/api/admin/Varieties/editVarieties",
  282. data: {
  283. id: this.state.editId, //品类ID
  284. cname: this.state.editName, //品类名称
  285. superId: superIdText, //上级品类
  286. status: this.state.editStatus, //品类状态
  287. varietiesLogo: theorgCodeUrl,
  288. sort: this.state.editSort
  289. }
  290. }).done(
  291. function(data) {
  292. this.setState({
  293. loading: false
  294. });
  295. if (!data.error.length) {
  296. message.success("保存成功!");
  297. this.edithandleCancel();
  298. this.selectSuperId();
  299. } else {
  300. message.warning(data.error[0].message);
  301. }
  302. }.bind(this)
  303. );
  304. }
  305. }
  306. }else{
  307. if(!(superOne==superText)){
  308. let changeSuper=nameText[parseInt(this.state.editSuperName)].id;
  309. if(confirm('上级组织已修改,是否保存?')){
  310. $.ajax({
  311. method: "post",
  312. dataType: "json",
  313. crossDomain: false,
  314. url:
  315. globalConfig.context + "/api/admin/Varieties/editVarieties",
  316. data: {
  317. id: this.state.editId, //品类ID
  318. cname: this.state.editName, //品类名称
  319. superId: changeSuper, //上级品类
  320. status: this.state.editStatus, //品类状态
  321. varietiesLogo: theorgCodeUrl,
  322. sort: this.state.editSort
  323. }
  324. }).done(
  325. function(data) {
  326. this.setState({
  327. loading: false
  328. });
  329. if (!data.error.length) {
  330. message.success("保存成功!");
  331. this.edithandleCancel();
  332. this.selectSuperId();
  333. } else {
  334. message.warning(data.error[0].message);
  335. }
  336. }.bind(this)
  337. );
  338. return false
  339. }
  340. }else {
  341. $.ajax({
  342. method: "post",
  343. dataType: "json",
  344. crossDomain: false,
  345. url:
  346. globalConfig.context + "/api/admin/Varieties/editVarieties",
  347. data: {
  348. id: this.state.editId, //品类ID
  349. cname: this.state.editName, //品类名称
  350. superId: superIdText, //上级品类
  351. status: this.state.editStatus, //品类状态
  352. varietiesLogo: theorgCodeUrl,
  353. sort: this.state.editSort
  354. }
  355. }).done(
  356. function(data) {
  357. this.setState({
  358. loading: false
  359. });
  360. if (!data.error.length) {
  361. message.success("保存成功!");
  362. this.edithandleCancel();
  363. this.selectSuperId();
  364. } else {
  365. message.warning(data.error[0].message);
  366. }
  367. }.bind(this)
  368. );
  369. }
  370. }
  371. },
  372. //整行点击
  373. tableRowClick(record, index) {
  374. this.selectSuperId();
  375. this.state.RowData = record;
  376. this.setState({
  377. editvisible: true,
  378. selectedRowKeys:[],
  379. rowId:record.businessId,
  380. });
  381. $.ajax({
  382. method: "get",
  383. dataType: "json",
  384. crossDomain: false,
  385. url: globalConfig.context +"/api/admin/Varieties/detailVarieties" ,
  386. data: {
  387. id: record.id
  388. },
  389. success: function (data) {
  390. let theArr = [];
  391. let thisdata = data.data;
  392. if (!data) {
  393. if (data.error && data.error.length) {
  394. message.warning(data.error[0].message);
  395. };
  396. } else {
  397. theArr.push({
  398. editId: thisdata.id,//每一条记录的ID
  399. editName:thisdata.cname,//品类名称
  400. editStatus:thisdata.status,//品类状态
  401. editSuperName:thisdata.superName,//上级品类
  402. editlayer:thisdata.layer,//品类层级
  403. editCid: thisdata.cid,//品类编号
  404. editSort: thisdata.sort,//品类序号
  405. editCreateName:thisdata.createName,//创建人
  406. editTime:thisdata.createTimeFormattedDate,//创建时间
  407. orgCodeUrl: thisdata.varietiesLogo ? splitUrl(thisdata.varietiesLogo, ',', globalConfig.avatarHost + '/upload') : [],
  408. });
  409. };
  410. this.setState({
  411. editId: thisdata.id,//每一条记录的ID
  412. editName:thisdata.cname,//品类名称
  413. editStatus:thisdata.status,//品类状态
  414. editSuperName:thisdata.superName,//上级品类
  415. editSuperId:thisdata.superId,//上级品类
  416. editlayer:thisdata.layer,//品类层级
  417. editCid: thisdata.cid,//品类编号
  418. editSort: thisdata.sort,//品类序号
  419. editCreateName:thisdata.createName,//创建人
  420. editTime:thisdata.createTimeFormattedDate,//创建时间
  421. orgCodeUrl: thisdata.varietiesLogo ? splitUrl(thisdata.varietiesLogo, ',', globalConfig.avatarHost + '/upload') : [],
  422. editDataSource: theArr,
  423. });
  424. }.bind(this),
  425. }).always(function () {
  426. this.setState({
  427. loading: false
  428. });
  429. }.bind(this));
  430. },
  431. //左侧图片地址
  432. getOrgCodeUrl(e) {
  433. this.setState({ orgCodeUrl: e });
  434. },
  435. //新增一个品类,保存
  436. addhandleSubmit(e){
  437. e.preventDefault();
  438. if(!this.state.categoryName){
  439. message.warning('请输入品类名称');
  440. return false;
  441. }
  442. if(!this.state.upCategory){
  443. message.warning('请选择上级品类');
  444. return false;
  445. }
  446. this.props.form.validateFields((err, values) => {
  447. if (!err) {
  448. this.setState({
  449. loading: true
  450. });
  451. //上级组织字典
  452. let nameText=this.state.SuperArr;
  453. let superText=nameText[parseInt(this.state.upCategory)].id;
  454. $.ajax({
  455. method: "get",
  456. dataType: "json",
  457. crossDomain: false,
  458. url:globalConfig.context + '/api/admin/Varieties/addVarieties',
  459. data:{
  460. cname:this.state.categoryName,//组织名称
  461. superId:superText,//上级组织
  462. }
  463. }).done(function (data) {
  464. this.setState({
  465. loading: false
  466. });
  467. if (!data.error.length) {
  468. message.success('新增品类成功!');
  469. this.handleCancel();
  470. this.selectSuperId();
  471. } else {
  472. message.warning(data.error[0].message);
  473. }
  474. }.bind(this));
  475. }
  476. });
  477. },
  478. //整行删除
  479. delectRow() {
  480. let deletedIds = '';
  481. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  482. let rowItem = this.state.selectedRows[idx];
  483. if (rowItem.id) {
  484. deletedIds=rowItem.id;
  485. };
  486. };
  487. this.setState({
  488. selectedRowKeys: [],
  489. loading: deletedIds.length > 0
  490. });
  491. $.ajax({
  492. method: "get",
  493. dataType: "json",
  494. crossDomain: false,
  495. url: globalConfig.context + "/api/admin/Varieties/deleteState",
  496. data: {
  497. id: deletedIds
  498. }
  499. }).done(function (data) {
  500. if (!data.error.length) {
  501. message.success('删除成功!');
  502. this.setState({
  503. loading: false,
  504. });
  505. } else {
  506. message.warning(data.error[0].message);
  507. };
  508. this.selectSuperId();
  509. }.bind(this));
  510. },
  511. //整行停用
  512. blockRow() {
  513. let deletedIds = '';
  514. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  515. let rowItem = this.state.selectedRows[idx];
  516. if (rowItem.id) {
  517. deletedIds=rowItem.id;
  518. };
  519. };
  520. this.setState({
  521. selectedRowKeys: [],
  522. loading: deletedIds.length > 0
  523. });
  524. $.ajax({
  525. method: "get",
  526. dataType: "json",
  527. crossDomain: false,
  528. url: globalConfig.context + "/api/admin/Varieties/updateStatus",
  529. data: {
  530. id: deletedIds
  531. }
  532. }).done(function (data) {
  533. if (!data.error.length) {
  534. message.success('该品类已成功停用!');
  535. this.setState({
  536. loading: false,
  537. });
  538. } else {
  539. message.warning(data.error[0].message);
  540. };
  541. this.selectSuperId();
  542. }.bind(this));
  543. },
  544. //品类上移
  545. upClick() {
  546. let deletedIds = '';
  547. let upSort = '';
  548. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  549. let rowItem = this.state.selectedRows[idx];
  550. if (rowItem.id) {
  551. deletedIds=rowItem.id;
  552. upSort=rowItem.sort;
  553. };
  554. };
  555. this.setState({
  556. selectedRowKeys: [],
  557. loading: deletedIds.length > 0
  558. });
  559. $.ajax({
  560. method: "get",
  561. dataType: "json",
  562. crossDomain: false,
  563. url: globalConfig.context + "/api/admin/Varieties/locationChange",
  564. data: {
  565. id: deletedIds,
  566. sort:upSort,
  567. flag:'1',
  568. }
  569. }).done(function (data) {
  570. if (!data.error.length) {
  571. message.success('该品类已成功上移!');
  572. this.setState({
  573. loading: false,
  574. });
  575. } else {
  576. message.warning(data.error[0].message);
  577. };
  578. this.selectSuperId();
  579. }.bind(this));
  580. },
  581. //品类下移
  582. downClick() {
  583. let deletedIds = '';
  584. let upSort = '';
  585. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  586. let rowItem = this.state.selectedRows[idx];
  587. if (rowItem.id) {
  588. deletedIds=rowItem.id;
  589. upSort=rowItem.sort;
  590. };
  591. };
  592. this.setState({
  593. selectedRowKeys: [],
  594. loading: deletedIds.length > 0
  595. });
  596. $.ajax({
  597. method: "get",
  598. dataType: "json",
  599. crossDomain: false,
  600. url: globalConfig.context + "/api/admin/Varieties/locationChange",
  601. data: {
  602. id: deletedIds,
  603. sort:upSort,
  604. flag:'0',
  605. }
  606. }).done(function (data) {
  607. if (!data.error.length) {
  608. message.success('该品类已成功下移!');
  609. this.setState({
  610. loading: false,
  611. });
  612. } else {
  613. message.warning(data.error[0].message);
  614. };
  615. this.selectSuperId();
  616. }.bind(this));
  617. },
  618. addClick() {
  619. this.state.RowData = {};
  620. this.addReset();
  621. this.setState({
  622. visible: true
  623. });
  624. },
  625. editClick() {
  626. this.state.RowData = {};
  627. this.setState({
  628. editvisible: true
  629. });
  630. },
  631. handleCancel() {
  632. this.setState({ visible: false })
  633. },
  634. edithandleCancel() {
  635. this.setState({ editvisible: false })
  636. },
  637. search() {
  638. this.loadData();
  639. },
  640. reset() {
  641. this.state.cname = '';//品类名称清零
  642. this.state.layer = undefined;//品类层级清零
  643. this.state.status = undefined;//品类状态清零
  644. this.state.superId = undefined;//上级品类清零
  645. this.loadData();
  646. },
  647. addReset() {
  648. this.state.categoryName = '';//品类名称清零
  649. this.state.upCategory = undefined;//上级品类清零
  650. },
  651. searchSwitch() {
  652. this.setState({
  653. searchMore: !this.state.searchMore
  654. });
  655. },
  656. render() {
  657. const FormItem = Form.Item
  658. const rowSelection = {
  659. selectedRowKeys: this.state.selectedRowKeys,
  660. onChange: (selectedRowKeys, selectedRows) => {
  661. this.setState({
  662. selectedRows: selectedRows.slice(-1),
  663. selectedRowKeys: selectedRowKeys.slice(-1)
  664. });
  665. }
  666. };
  667. const formItemLayout = {
  668. labelCol: { span: 8 },
  669. wrapperCol: { span: 14 },
  670. };
  671. const { getFieldDecorator } = this.props.form;
  672. const hasSelected = this.state.selectedRowKeys.length > 0;
  673. const { RangePicker } = DatePicker;
  674. return (
  675. <div className="user-content" >
  676. <div className="content-title">
  677. <div className="user-search">
  678. <Input placeholder="业务品类名称" style={{width:'150px',marginRight:'10px',marginBottom:'10px'}}
  679. value={this.state.cname}
  680. onChange={(e) => { this.setState({ cname: e.target.value }); }} />
  681. <Select placeholder="上级品类"
  682. style={{ width:'200px',marginRight:'10px' }}
  683. value={this.state.superId}
  684. onChange={(e) => { this.setState({ superId: e }) }} notFoundContent="未获取到上级品类列表">
  685. {this.state.contactsOption}
  686. </Select>
  687. <Button type="primary" onClick={this.search} style={{marginRight:'10px'}}>搜索</Button>
  688. <Button onClick={this.reset} style={{marginRight:'10px'}}>重置</Button>
  689. <Popconfirm title="是否删除?" onConfirm={this.delectRow} okText="是" cancelText="否">
  690. <Button style={{ background: "#ea0862", border: "none", color: "#fff",marginRight:'10px' ,marginLeft:'10px'}}
  691. disabled={!hasSelected}
  692. >删除<Icon type="minus" />
  693. </Button>
  694. </Popconfirm>
  695. <Popconfirm title="是否停用?" onConfirm={this.blockRow} okText="是" cancelText="否">
  696. <Button style={{ background: "#ea0862", border: "none", color: "#fff",marginRight:'10px' ,marginLeft:'10px',display:'none'}}
  697. disabled={!hasSelected}
  698. >停用<Icon type="minus" />
  699. </Button>
  700. </Popconfirm>
  701. <span style={{marginRight:'20px'}}>更多搜索 <Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  702. <div style={this.state.searchMore ? { display: 'none' } : {display: 'inline-block'}}>
  703. <Select placeholder="品类层级"
  704. style={{ width:'150px',marginRight:'10px' }}
  705. value={this.state.layer}
  706. onChange={(e) => { this.setState({ layer: e }) }}>
  707. <Select.Option value="1" >一级</Select.Option>
  708. <Select.Option value="2" >二级</Select.Option>
  709. <Select.Option value="3" >三级</Select.Option>
  710. </Select>
  711. <Select placeholder="品类状态"
  712. style={{width:'150px',marginRight:'50px'}}
  713. value={this.state.status}
  714. onChange={(e) => { this.setState({ status: e }) }}>
  715. <Select.Option value="0" >正常</Select.Option>
  716. <Select.Option value="1" >停用</Select.Option>
  717. </Select>
  718. </div>
  719. <Button type="primary" className="addButton" onClick={this.addClick} style={{float:'right',marginRight:'200px'}}>新增品类<Icon type="plus" /></Button>
  720. <Button type="primary" className="addButton" onClick={this.downClick} style={{float:'right'}} disabled={!hasSelected}>品类下移</Button>
  721. <Button type="primary" className="addButton" onClick={this.upClick} style={{float:'right'}} disabled={!hasSelected}>品类上移</Button>
  722. </div>
  723. <div className="patent-table">
  724. <Spin spinning={this.state.loading}>
  725. <Table columns={this.state.columns}
  726. dataSource={this.state.dataSource}
  727. rowSelection={rowSelection}
  728. pagination={this.state.pagination}
  729. onRowClick={this.tableRowClick} />
  730. </Spin>
  731. </div>
  732. <div className="patent-desc">
  733. <Modal maskClosable={false} visible={this.state.visible}
  734. onOk={this.checkPatentProcess} onCancel={this.handleCancel}
  735. width='400px'
  736. title='新增品类'
  737. footer=''
  738. className="admin-desc-content">
  739. <Form horizontal onSubmit={this.addhandleSubmit} id="demand-form">
  740. <Spin spinning={this.state.loading}>
  741. <div className="clearfix">
  742. <FormItem
  743. labelCol={{ span: 7 }}
  744. wrapperCol={{ span: 12 }}
  745. label="品类名称" >
  746. <Input placeholder="品类名称" value={this.state.categoryName} style={{width:'94%'}}
  747. onChange={(e)=>{this.setState({categoryName:e.target.value})}} required="required"/>
  748. <span className="mandatory" style={{color:'red',marginLeft:'5px'}}>*</span>
  749. </FormItem>
  750. </div>
  751. <div className="clearfix">
  752. <FormItem
  753. labelCol={{ span: 7 }}
  754. wrapperCol={{ span: 12 }}
  755. label="上级品类"
  756. >
  757. <Select placeholder="请选择上级品类" value={this.state.upCategory} onChange={(e)=>{this.setState({upCategory:e})}}
  758. notFoundContent="未获取到上级品类列表" style={{width:'94%'}} required="required">
  759. {this.state.contactsOption}
  760. </Select>
  761. <span className="mandatory" style={{color:'red',marginLeft:'5px'}}>*</span>
  762. </FormItem>
  763. </div>
  764. <FormItem wrapperCol={{ span: 12, offset: 7 }}>
  765. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  766. <Button className="set-submit" type="ghost" onClick={this.handleCancel} style={{marginLeft:'15px'}}>取消</Button>
  767. </FormItem>
  768. </Spin>
  769. </Form >
  770. </Modal>
  771. </div>
  772. <div className="patent-desc">
  773. <Modal maskClosable={false} visible={this.state.editvisible}
  774. onOk={this.checkPatentProcess} onCancel={this.edithandleCancel}
  775. width='600px'
  776. title='编辑品类'
  777. footer=''
  778. className="admin-desc-content">
  779. <Form horizontal onSubmit={this.edithandleSubmit} id="demand-form">
  780. <Spin spinning={this.state.loading}>
  781. <div className="clearfix">
  782. <FormItem
  783. labelCol={{ span: 7 }}
  784. wrapperCol={{ span: 12 }}
  785. label="品类名称" >
  786. <Input placeholder="组织名称" value={this.state.editName}
  787. onChange={(e)=>{this.setState({editName:e.target.value})}}/>
  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.editStatus}
  797. onChange={(e)=>{this.setState({editStatus:e})}}>
  798. {
  799. categoryState.map(function (item) {
  800. return <Select.Option key={item.value} >{item.key}</Select.Option>
  801. })
  802. }
  803. </Select>
  804. </FormItem>
  805. </div>
  806. <div className="clearfix">
  807. <FormItem
  808. labelCol={{ span: 7 }}
  809. wrapperCol={{ span: 12 }}
  810. label="上级品类"
  811. >
  812. <Select placeholder="请选择上级组织" value={this.state.editSuperName} onChange={(e)=>{this.setState({editSuperName:e})}}
  813. notFoundContent="未获取到上级组织列表">
  814. {this.state.contactsOption}
  815. </Select>
  816. </FormItem>
  817. </div>
  818. <div className="clearfix">
  819. <FormItem
  820. labelCol={{ span: 7 }}
  821. wrapperCol={{ span: 12 }}
  822. label="业务品类图标" >
  823. <PicturesWall
  824. pictureSign="varieties_picture"
  825. fileList={this.getOrgCodeUrl}
  826. pictureUrl={this.state.orgCodeUrl} />
  827. </FormItem>
  828. </div>
  829. <div className="clearfix">
  830. <FormItem
  831. labelCol={{ span: 7 }}
  832. wrapperCol={{ span: 12 }}
  833. label="品类序号"
  834. >
  835. {/* <span>{this.state.editSort}</span> */}
  836. <Input
  837. value={this.state.editSort}
  838. onChange={ (e) => {
  839. this.setState({
  840. editSort: e.target.value
  841. });
  842. } }
  843. />
  844. </FormItem>
  845. </div>
  846. <div className="clearfix">
  847. <FormItem
  848. labelCol={{ span: 7 }}
  849. wrapperCol={{ span: 12 }}
  850. label="品类层级"
  851. >
  852. <span>{this.state.editlayer}</span>
  853. </FormItem>
  854. </div>
  855. <div className="clearfix">
  856. <FormItem
  857. labelCol={{ span: 7 }}
  858. wrapperCol={{ span: 12 }}
  859. label="品类编号"
  860. >
  861. <span>{this.state.editCid}</span>
  862. </FormItem>
  863. </div>
  864. <div className="clearfix" >
  865. <FormItem
  866. labelCol={{ span: 7 }}
  867. wrapperCol={{ span: 12 }}
  868. label="创建人"
  869. >
  870. <span>{this.state.editCreateName}</span>
  871. </FormItem>
  872. </div>
  873. <div className="clearfix">
  874. <FormItem
  875. labelCol={{ span: 7 }}
  876. wrapperCol={{ span: 12 }}
  877. label="创建时间"
  878. >
  879. <span>{this.state.editTime}</span>
  880. </FormItem>
  881. </div>
  882. <FormItem wrapperCol={{ span: 12, offset: 7 }}>
  883. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  884. <Button className="set-submit" type="ghost" onClick={this.edithandleCancel} style={{marginLeft:'100px'}}>取消</Button>
  885. </FormItem>
  886. </Spin>
  887. </Form >
  888. </Modal>
  889. </div>
  890. </div>
  891. </div>
  892. );
  893. }
  894. }));
  895. export default BusinessCategory;