organization.jsx 40 KB

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