businessCategory.jsx 37 KB

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