organization.jsx 49 KB

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