topTab.jsx 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952
  1. import React from "react";
  2. import {
  3. Row,
  4. Col,
  5. Icon,
  6. Modal,
  7. Button,
  8. Spin,
  9. Input,
  10. message,
  11. Badge,
  12. Table,
  13. Tabs,
  14. Tag,
  15. } from "antd";
  16. import { getProvince } from "../NewDicProvinceList.js";
  17. import { ShowModal, getActives } from "../tools.js";
  18. import "./topTab.less";
  19. import $ from "jquery/src/ajax";
  20. import logo from "../../../image/acc-logo.png";
  21. import FollowDetail from "./customer/NEW/intentionCustomer/followDetail";
  22. import AccountDetails from "./financialManage/account/accountDetails";
  23. const TabPane = Tabs.TabPane;
  24. const MessageModal = React.createClass({
  25. getInitialState() {
  26. return {
  27. unreadData: [],
  28. unreadDataType: "0",
  29. dataSourceType: "1",
  30. unreadDataIndex: 0,
  31. visible: false,
  32. loading: false,
  33. pagination: {
  34. defaultCurrent: 1,
  35. defaultPageSize: 10,
  36. showQuickJumper: true,
  37. pageSize: 10,
  38. onChange: function (page) {
  39. this.loadReaded(page);
  40. }.bind(this),
  41. showTotal: function (total) {
  42. return "共" + total + "条数据";
  43. },
  44. },
  45. UnreadPagination: {
  46. defaultCurrent: 1,
  47. defaultPageSize: 10,
  48. showQuickJumper: true,
  49. pageSize: 10,
  50. onChange: function (page) {
  51. this.loadUnread(page);
  52. }.bind(this),
  53. showTotal: function (total) {
  54. return "共" + total + "条数据";
  55. },
  56. },
  57. categoryArr: [],
  58. columns: [
  59. {
  60. title: "类型",
  61. dataIndex: "noticeType",
  62. key: "noticeType",
  63. render: (text, record) => {
  64. return <span style={{ color: record.noticeType == 59 && "red" }}>{record.noticeTypeName}</span>;
  65. },
  66. },
  67. {
  68. title: "时间",
  69. dataIndex: "createTimeFormattedDate",
  70. key: "createTimeFormattedDate",
  71. },
  72. {
  73. title: "内容",
  74. dataIndex: "content",
  75. key: "content",
  76. render: (text, record) => {
  77. return <span style={{ color: record.noticeType == 59 && "red" }}>{text}</span>;
  78. },
  79. },
  80. {
  81. title: "操作",
  82. dataIndex: "abc",
  83. key: "abc",
  84. render: (text, record) => {
  85. let contractNo = "";
  86. if (
  87. (record.noticeType === 14 || record.noticeType === 40) &&
  88. record.content.indexOf("合同编号-") !== -1
  89. ) {
  90. let arr = record.content.split("合同编号-");
  91. contractNo = arr[1].match(/(\S*), 订单编号/)[1];
  92. }
  93. return record.noticeType === 48 || record.noticeType === 49 ? (
  94. <Button
  95. type="primary"
  96. onClick={() => {
  97. this.category();
  98. record.id = record.uid;
  99. this.setState({
  100. followData: record,
  101. visitModul: true,
  102. });
  103. }}
  104. >
  105. 立即跟进
  106. </Button>
  107. ) : record.noticeType === 14 || record.noticeType === 40 ? (
  108. <Button
  109. disabled={!contractNo}
  110. type="primary"
  111. onClick={(e) => {
  112. e.stopPropagation();
  113. let input = document.getElementById("copyText");
  114. input.value = contractNo;
  115. input.select();
  116. document.execCommand("copy");
  117. message.success("复制成功");
  118. }}
  119. >
  120. 复制合同号
  121. </Button>
  122. ) : null;
  123. },
  124. },
  125. ],
  126. data: [],
  127. };
  128. },
  129. category() {
  130. $.ajax({
  131. method: "get",
  132. dataType: "json",
  133. crossDomain: false,
  134. url: globalConfig.context + "/api/admin/Varieties/getSuperList",
  135. data: {},
  136. success: function (data) {
  137. let thedata = data.data;
  138. let theArr = [];
  139. if (!thedata) {
  140. if (data.error && data.error.length) {
  141. message.warning(data.error[0].message);
  142. }
  143. thedata = {};
  144. } else {
  145. thedata.map(function (item, index) {
  146. theArr.push({
  147. value: item.id,
  148. key: item.cname,
  149. });
  150. });
  151. }
  152. this.setState({
  153. categoryArr: theArr,
  154. });
  155. }.bind(this),
  156. });
  157. },
  158. loadReaded(pageNo) {
  159. this.state.data = [];
  160. this.setState({
  161. loading: true,
  162. });
  163. $.ajax({
  164. method: "get",
  165. dataType: "json",
  166. crossDomain: false,
  167. url: globalConfig.context + "/api/admin/notice/readed",
  168. data: {
  169. pageNo: pageNo || 1,
  170. pageSize: this.state.pagination.pageSize,
  171. type: this.state.unreadDataType,
  172. },
  173. })
  174. .done((data) => {
  175. if (!data.data) {
  176. if (data.error && data.error.length) {
  177. message.warning(data.error[0].message);
  178. return;
  179. }
  180. }
  181. this.state.data = [];
  182. for (let i = 0; i < data.data.list.length; i++) {
  183. let thisdata = data.data.list[i];
  184. this.state.data.push({
  185. key: i + 1,
  186. id: thisdata.id,
  187. rid: thisdata.rid,
  188. uid: thisdata.uid,
  189. aid: thisdata.aid,
  190. noticeType: thisdata.noticeType,
  191. year: thisdata.year,
  192. noticeTypeName: thisdata.noticeTypeName,
  193. content: thisdata.content,
  194. createTime: thisdata.createTime,
  195. createTimeFormattedDate: thisdata.createTimeFormattedDate,
  196. principle: thisdata.principle,
  197. unitName: thisdata.unitName,
  198. });
  199. }
  200. this.state.pagination.current = data.data.pageNo;
  201. this.state.pagination.total = data.data.totalCount;
  202. this.setState({
  203. dataSource: this.state.data,
  204. pagination: this.state.pagination,
  205. });
  206. })
  207. .always(
  208. function () {
  209. this.setState({
  210. loading: false,
  211. });
  212. }.bind(this)
  213. );
  214. },
  215. loadUnread(pageNo) {
  216. this.state.data = [];
  217. this.setState({
  218. loading: true,
  219. });
  220. $.ajax({
  221. method: "get",
  222. dataType: "json",
  223. crossDomain: false,
  224. url: globalConfig.context + "/api/admin/notice/unread",
  225. data: {},
  226. })
  227. .done((data) => {
  228. if (data.error && data.error.length) {
  229. message.warning(data.error[0].message);
  230. return;
  231. } else {
  232. let arr = data.data.filter((v) => v.list.length > 0);
  233. if (arr.length) {
  234. this.setState({
  235. newVisible: true,
  236. });
  237. }
  238. let index = data.data.findIndex((v) => v.list.length > 0);
  239. if (index >= 0) {
  240. data.data[index].isRead = true;
  241. this.setState({
  242. unreadDataType: data.data[index]["id"] + "",
  243. unreadDataIndex: index,
  244. });
  245. } else {
  246. this.setState({
  247. unreadDataType: data.data[0]["id"] + "",
  248. unreadDataIndex: "0",
  249. });
  250. }
  251. this.setState({
  252. unreadData: data.data,
  253. });
  254. }
  255. })
  256. .always(
  257. function () {
  258. this.setState({
  259. loading: false,
  260. });
  261. }.bind(this)
  262. );
  263. },
  264. componentWillReceiveProps(nextProps) {
  265. if (!this.state.visible && nextProps.showDesc) {
  266. this.loadReaded();
  267. this.loadUnread();
  268. }
  269. this.state.visible = nextProps.showDesc;
  270. },
  271. handleOk() {
  272. let arr = this.state.unreadData.filter(
  273. (v) => v.list.length > 0 && !v.isRead
  274. );
  275. if (arr.length > 0) {
  276. message.warning("还存在未读消息,请查看后再关闭当前页面!");
  277. return;
  278. } else {
  279. this.setState({
  280. visible: false,
  281. });
  282. }
  283. this.props.closeDesc(false, true);
  284. },
  285. handleCancel(e) {
  286. let arr = this.state.unreadData.filter(
  287. (v) => v.list.length > 0 && !v.isRead
  288. );
  289. if (arr.length > 0) {
  290. message.warning("还存在未读消息,请查看后再关闭当前页面!");
  291. return;
  292. } else {
  293. this.setState({
  294. visible: false,
  295. });
  296. }
  297. this.props.closeDesc(false, true);
  298. },
  299. closeDesc() {
  300. this.setState(
  301. {
  302. categoryArr: [],
  303. followData: "",
  304. visitModul: false,
  305. },
  306. () => {
  307. this.loadReaded(this.state.pagination.current);
  308. }
  309. );
  310. },
  311. render() {
  312. return (
  313. <div className="topTab-modal">
  314. <Spin spinning={this.state.loading} className="spin-box">
  315. <Modal
  316. maskClosable={false}
  317. title="信息中心"
  318. visible={this.state.visible}
  319. onOk={this.handleOk}
  320. onCancel={this.handleCancel}
  321. width="1200px"
  322. footer=""
  323. >
  324. <Spin spinning={this.state.loading} className="spin-box">
  325. <Tabs
  326. defaultActiveKey={this.state.unreadDataType}
  327. activeKey={this.state.unreadDataType}
  328. onChange={(v) => {
  329. let index = this.state.unreadData.findIndex((d) => d.id == v);
  330. this.state.unreadData[index].isRead = true;
  331. this.setState(
  332. {
  333. unreadDataIndex: index,
  334. unreadData: this.state.unreadData,
  335. unreadDataType: v,
  336. },
  337. () => {
  338. if (this.state.dataSourceType === "2") {
  339. this.loadReaded();
  340. }
  341. }
  342. );
  343. }}
  344. >
  345. {this.state.unreadData.map((v) => (
  346. <Tabs.TabPane
  347. key={v.id + ""}
  348. tab={
  349. <div
  350. style={{ color: v.id == 7 && "red" }}
  351. >
  352. {v.list.length === 0 || v.isRead ? null : (
  353. <div
  354. style={{
  355. width: "8px",
  356. height: "8px",
  357. borderRadius: "8px",
  358. background: "#f00",
  359. position: "absolute",
  360. right: "5px",
  361. top: "2px",
  362. }}
  363. />
  364. )}
  365. {v.name}
  366. </div>
  367. }
  368. />
  369. ))}
  370. </Tabs>
  371. <Tabs
  372. defaultActiveKey="1"
  373. type="card"
  374. tabPosition="left"
  375. value={this.state.dataSourceType}
  376. onChange={(v) => {
  377. this.setState({
  378. dataSourceType: v,
  379. });
  380. if (v === "2") {
  381. this.loadReaded();
  382. }
  383. }}
  384. >
  385. <Tabs.TabPane tab={"未读"} key="1">
  386. <Table
  387. bordered
  388. columns={this.state.columns}
  389. dataSource={
  390. this.state.unreadData[this.state.unreadDataIndex]
  391. ? this.state.unreadData[this.state.unreadDataIndex].list
  392. : []
  393. }
  394. pagination={false}
  395. />
  396. </Tabs.TabPane>
  397. <Tabs.TabPane tab="已读" key="2">
  398. <Table
  399. bordered
  400. columns={this.state.columns}
  401. dataSource={this.state.dataSource}
  402. pagination={this.state.pagination}
  403. />
  404. </Tabs.TabPane>
  405. </Tabs>
  406. </Spin>
  407. <textarea id="copyText" style={{ opacity: 0 }} />
  408. </Modal>
  409. </Spin>
  410. <FollowDetail
  411. categoryArr={this.state.categoryArr}
  412. followData={this.state.followData}
  413. visitModul={this.state.visitModul}
  414. closeDesc={this.closeDesc}
  415. />
  416. </div>
  417. );
  418. },
  419. });
  420. const UserModal = React.createClass({
  421. getInitialState() {
  422. return {
  423. visible: false,
  424. loading: false,
  425. locations: [],
  426. };
  427. },
  428. loadData() {
  429. this.setState({
  430. loading: true,
  431. });
  432. $.ajax({
  433. method: "get",
  434. dataType: "json",
  435. crossDomain: false,
  436. url: globalConfig.context + "/api/admin/adminInfo",
  437. success: function (data) {
  438. if (!data.data) {
  439. if (data.error[0] && data.error[0]) {
  440. message.warning(data.error[0].message);
  441. }
  442. return;
  443. }
  444. this.setState({
  445. id: data.data.id,
  446. mobile: data.data.mobile,
  447. contactMobile: data.data.contactMobile,
  448. name: data.data.name,
  449. position: data.data.position,
  450. email: data.data.email,
  451. createTime: data.data.createTime,
  452. number: data.data.number,
  453. createTimeFormattedDate: data.data.createTimeFormattedDate,
  454. pwd: "",
  455. password: "",
  456. });
  457. this.loadLocations(data.data.id);
  458. }.bind(this),
  459. }).always(
  460. function (data) {
  461. this.setState({
  462. loading: false,
  463. });
  464. }.bind(this)
  465. );
  466. },
  467. loadLocations(id) {
  468. this.setState({
  469. loading: true,
  470. });
  471. $.ajax({
  472. url: globalConfig.context + "/api/admin/supervise/adminDetailLocation",
  473. cache: false,
  474. data: {
  475. id: id,
  476. },
  477. }).done((data) => {
  478. if (!data.data) {
  479. if (data.error && data.error.length) {
  480. message.warning(data.error[0].message);
  481. return;
  482. }
  483. }
  484. data.data.map((item) => {
  485. if (item.city) {
  486. item.city = item.city.split(",");
  487. }
  488. });
  489. this.setState({
  490. locations: data.data,
  491. loading: false,
  492. });
  493. });
  494. },
  495. componentWillReceiveProps(nextProps) {
  496. if (!this.state.visible && nextProps.showDesc) {
  497. this.loadData();
  498. }
  499. this.state.visible = nextProps.showDesc;
  500. },
  501. handleOk() {
  502. this.setState({
  503. loading: true,
  504. });
  505. if (this.state.contactMobile) {
  506. if (!/^1[1-9][0-9]\d{4,8}$/.test(this.state.contactMobile)) {
  507. message.warning("不是完整的11位手机号或者正确的手机号前七位");
  508. this.setState({
  509. loading: false,
  510. });
  511. return false;
  512. }
  513. }
  514. // if(this.state.mobile.length>11){
  515. // message.warning("登录账号不能超过11位");
  516. // return false;
  517. // }
  518. $.ajax({
  519. method: "post",
  520. dataType: "json",
  521. crossDomain: false,
  522. url: globalConfig.context + "/api/admin/updateAdminInfo",
  523. data: {
  524. id: this.state.id,
  525. mobile: this.state.mobile,
  526. contactMobile: this.state.contactMobile,
  527. name: this.state.name,
  528. email: this.state.email,
  529. province: this.state.province,
  530. password: this.state.password,
  531. pwd: this.state.pwd,
  532. },
  533. }).always(
  534. function (data) {
  535. if (data.error && data.error.length) {
  536. message.warning(data.error[0].message);
  537. } else {
  538. this.setState({
  539. loading: false,
  540. });
  541. message.success("保存成功!");
  542. this.props.closeDesc(false, true);
  543. }
  544. }.bind(this)
  545. );
  546. },
  547. handleCancel(e) {
  548. this.setState({
  549. visible: false,
  550. });
  551. this.props.closeDesc(false);
  552. },
  553. render() {
  554. return (
  555. <div className="topTab-modal">
  556. <Spin spinning={this.state.loading} className="spin-box">
  557. <Modal
  558. maskClosable={false}
  559. title="用户设置"
  560. visible={this.state.visible}
  561. onOk={this.handleOk}
  562. onCancel={this.handleCancel}
  563. width="380px"
  564. >
  565. <ul className="modal-content">
  566. <li>
  567. <span className="modal-text">名字</span>
  568. <Input
  569. value={this.state.name}
  570. onChange={(e) => {
  571. this.state.name = e.target.value;
  572. this.setState({ name: this.state.name });
  573. }}
  574. />
  575. </li>
  576. <li>
  577. <span className="modal-text">职位</span>
  578. <span>{this.state.position}</span>
  579. </li>
  580. <li>
  581. <span className="modal-text">登录账号</span>
  582. <span>{this.state.mobile}</span>
  583. </li>
  584. <li>
  585. <span className="modal-text">联系方式</span>
  586. <Input
  587. value={this.state.contactMobile}
  588. onChange={(e) => {
  589. this.state.contactMobile = e.target.value;
  590. this.setState({ contactMobile: this.state.contactMobile });
  591. }}
  592. />
  593. </li>
  594. <li>
  595. <span className="modal-text">省份</span>
  596. <div style={{ display: "inline-block", width: "78%" }}>
  597. {this.state.locations.map((item, i) => {
  598. return (
  599. <Tag key={i}>
  600. {getProvince(item.province) +
  601. " " +
  602. (item.city
  603. ? item.city.map((c) => {
  604. return getProvince(c) + " ";
  605. })
  606. : "")}
  607. </Tag>
  608. );
  609. })}
  610. </div>
  611. </li>
  612. <li>
  613. <span className="modal-text">邮箱</span>
  614. <Input
  615. value={this.state.email}
  616. onChange={(e) => {
  617. this.state.email = e.target.value;
  618. this.setState({ email: this.state.email });
  619. }}
  620. />
  621. </li>
  622. <li>
  623. <span className="modal-text">原密码</span>
  624. <Input
  625. value={this.state.pwd}
  626. type="password"
  627. onChange={(e) => {
  628. this.state.pwd = e.target.value;
  629. this.setState({ pwd: this.state.pwd });
  630. }}
  631. />
  632. </li>
  633. <li>
  634. <span className="modal-text">密码</span>
  635. <Input
  636. value={this.state.password}
  637. type="password"
  638. onChange={(e) => {
  639. this.state.password = e.target.value;
  640. this.setState({ password: this.state.password });
  641. }}
  642. />
  643. </li>
  644. </ul>
  645. </Modal>
  646. </Spin>
  647. </div>
  648. );
  649. },
  650. });
  651. const TopTab = React.createClass({
  652. getInitialState() {
  653. return {
  654. username: "请登录!",
  655. defaultActiveKey: "-1",
  656. htmlMenus: [],
  657. count: 0,
  658. visible: false,
  659. };
  660. },
  661. logOut() {
  662. let theActive = this.props.active;
  663. $.ajax({
  664. method: "get",
  665. dataType: "json",
  666. url: globalConfig.context + "/login",
  667. }).done(function (data) {
  668. window.location.href = globalConfig.context + "/admin/login.html";
  669. });
  670. },
  671. componentWillMount() {
  672. if (this.props.active) {
  673. this.loadData();
  674. }
  675. this.mainMenu();
  676. },
  677. //主菜单请求
  678. mainMenu() {
  679. this.setState({
  680. loading: true,
  681. });
  682. $.ajax({
  683. method: "get",
  684. dataType: "json",
  685. crossDomain: false,
  686. url: globalConfig.context + "/api/admin/selectNavList",
  687. data: {},
  688. success: function (data) {
  689. if (!data.data) {
  690. if (data.error && data.error.length) {
  691. message.warning(data.error[0].message);
  692. return;
  693. }
  694. }
  695. let menu = data.data;
  696. var htmlMenu = [];
  697. let index = menu.findIndex(
  698. (v) => getActives(v.name) === this.props.active
  699. );
  700. this.setState({
  701. htmlMenus: menu,
  702. defaultActiveKey: index + "",
  703. });
  704. }.bind(this),
  705. }).always(
  706. function (data) {
  707. this.setState({
  708. loading: false,
  709. });
  710. }.bind(this)
  711. );
  712. },
  713. loadData() {
  714. this.setState({
  715. loading: true,
  716. });
  717. $.ajax({
  718. method: "get",
  719. dataType: "json",
  720. crossDomain: false,
  721. url: globalConfig.context + "/api/admin/notice/unreadCount",
  722. success: function (data) {
  723. if (!data.data) {
  724. if (data.error[0] && data.error[0]) {
  725. message.warning(data.error[0].message);
  726. return;
  727. }
  728. }
  729. this.setState({
  730. badge: data.data,
  731. });
  732. }.bind(this),
  733. }).always(
  734. function (data) {
  735. this.setState({
  736. loading: false,
  737. });
  738. }.bind(this)
  739. );
  740. },
  741. closeUserModal(e, s) {
  742. this.state.userModalShow = e;
  743. if (s) {
  744. this.loadData();
  745. }
  746. },
  747. closeMessageModal(e, s) {
  748. this.state.messageModalShow = e;
  749. if (s) {
  750. this.loadData();
  751. }
  752. },
  753. //定时任务
  754. componentDidMount() {
  755. clearInterval(this.timerID)
  756. this.timerID = setInterval(
  757. () => this.tick(),
  758. 5000
  759. );
  760. },
  761. componentWillUnmount() {
  762. clearInterval(this.timerID)
  763. },
  764. // 解决同时登录多个账号没有刷新页面操作的问题
  765. tick() {
  766. if (adminData.uid != localStorage.getItem("userId")) {
  767. Modal.error({
  768. title: '登录失效',
  769. content: (
  770. <div>
  771. <p>同一浏览器不能同时登录多个账号,</p>
  772. <p>如需登录多个账号请用不同浏览器打开登录!!!</p>
  773. </div>
  774. ),
  775. okText: '重新登录',
  776. onOk() {
  777. window.location.href = globalConfig.context + "/admin/login.html";
  778. },
  779. });
  780. clearInterval(this.timerID)
  781. }
  782. },
  783. onAccount() {
  784. if (!this.state.checkNo) {
  785. message.warning("报销单编号不能为空!")
  786. return
  787. }
  788. $.ajax({
  789. method: "get",
  790. dataType: "json",
  791. crossDomain: false,
  792. url: globalConfig.context + "/api/admin/expenseAccount/selectByCheckNo",
  793. data: { checkNo: this.state.checkNo, },
  794. success: function (data) {
  795. ShowModal(this);
  796. if (data.error.length === 0) {
  797. if (!data.data) {
  798. message.warning("您输入的报销单编号有误,请重新输入!")
  799. } else {
  800. this.setState({
  801. detailsPup: true,
  802. visible: false,
  803. id: data.data.id,
  804. })
  805. }
  806. } else {
  807. message.warning(data.error[0].message);
  808. }
  809. }.bind(this),
  810. }).always(
  811. function () {
  812. }.bind(this)
  813. );
  814. },
  815. render() {
  816. return (
  817. <div className="account-top">
  818. <div className="acc-top-user">
  819. <span className="acc-top-user-name">
  820. 欢迎您 ,{" "}
  821. {adminData.name || adminData.mobile ? (
  822. <a
  823. onClick={() => {
  824. // if (window.showPermissionList && window.showRoleList) {
  825. // return
  826. // };
  827. this.setState({ userModalShow: true });
  828. }}
  829. >
  830. {" "}
  831. {adminData.name || adminData.mobile}{" "}
  832. </a>
  833. ) : (
  834. <a onClick={this.logOut}>{this.state.username}</a>
  835. )}{" "}
  836. <a onClick={this.logOut}>[ 退出 ]</a>
  837. </span>
  838. <span className="acc-top-user-toindex">
  839. {/* <a href={jumpUrl || "" + "/portal/index.html"}>返回首页</a> */}
  840. <span
  841. className="printbt"
  842. onClick={() => { this.setState({ checkNo: undefined, visible: true }) }}
  843. >报销清单打印</span>
  844. <span>&nbsp;&nbsp;|&nbsp;&nbsp;</span>
  845. <a href={globalConfig.context + "/RD/admin/login"}>前往RD库</a>
  846. </span>
  847. {this.props.active ? (
  848. <a
  849. onClick={() => {
  850. this.setState({ messageModalShow: true });
  851. }}
  852. className="user-badge"
  853. >
  854. <Icon type="mail" />
  855. {/* {!window.showSystem && this.state.badge ? (
  856. <Badge status="processing" />
  857. ) : null} */}
  858. </a>
  859. ) : null}
  860. </div>
  861. <div className="acc-index">
  862. <div className="acc-index-imgbox">
  863. <img src={logo} alt="" />
  864. </div>
  865. <span>
  866. <a href={globalConfig.context + "/admin/index.html"}>
  867. {/* 管理中心首页 */}
  868. 科德人力资源
  869. </a>
  870. </span>
  871. </div>
  872. <div className="acc-top-tab">
  873. {this.state.htmlMenus.length > 0 ? (
  874. <Tabs
  875. defaultActiveKey={this.state.defaultActiveKey}
  876. activeKey={this.state.defaultActiveKey}
  877. tabPosition="top"
  878. onTabClick={(v) => {
  879. window.location.href = globalConfig.context + this.state.htmlMenus[parseInt(v)].url + '?rid=' + this.state.htmlMenus[parseInt(v)].id;
  880. }}
  881. // onChange={v=>{
  882. // window.location.href=globalConfig.context + this.state.htmlMenus[parseInt(v)].url+'?rid='+this.state.htmlMenus[parseInt(v)].id;
  883. // }}
  884. >
  885. {this.state.htmlMenus.map((v, k) => (
  886. <TabPane key={k} tab={v.name} />
  887. ))}
  888. </Tabs>
  889. ) : null}
  890. </div>
  891. <UserModal
  892. showDesc={this.state.userModalShow}
  893. closeDesc={this.closeUserModal}
  894. />
  895. <MessageModal
  896. showDesc={this.state.messageModalShow}
  897. closeDesc={this.closeMessageModal}
  898. />
  899. {
  900. this.state.visible &&
  901. <Modal
  902. title="报销清单查询"
  903. visible={this.state.visible}
  904. onOk={() => { this.onAccount() }}
  905. onCancel={() => { this.setState({ visible: false, }) }}
  906. okText="确认"
  907. cancelText="取消"
  908. maskClosable={false}
  909. >
  910. <div style={{ width: "60%", margin: "40px auto" }}>
  911. <Input
  912. placeholder="请输入报销单编号"
  913. value={this.state.checkNo}
  914. onChange={(e) => {
  915. this.setState({ checkNo: e.target.value });
  916. }}
  917. />
  918. </div>
  919. </Modal>
  920. }
  921. {
  922. // 报销信息详情
  923. this.state.detailsPup &&
  924. <AccountDetails
  925. isSelect={true}
  926. showDetails={this.state.detailsPup}
  927. id={this.state.id}
  928. onCancel={() => { this.setState({ detailsPup: false }) }}
  929. />
  930. }
  931. </div >
  932. );
  933. },
  934. });
  935. export default TopTab;