organization.jsx 57 KB

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