organization.jsx 47 KB

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