organization.jsx 60 KB

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