businessCategory.jsx 38 KB

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