PersonCenter.js 51.1 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326
/* eslint-disable array-callback-return,no-undef,no-unused-vars */
import React, { Component } from 'react';

import {
  DeleteOutlined,
  DownOutlined,
  IdcardOutlined,
  InfoCircleOutlined,
  MailOutlined,
  PoweroffOutlined,
  QuestionCircleOutlined,
  EllipsisOutlined,
  SkinOutlined,
  SearchOutlined,
} from '@ant-design/icons';

import { Form } from '@ant-design/compatible';
import '@ant-design/compatible/assets/index.css';

import BraftEditor from 'braft-editor';
import 'braft-editor/dist/index.css';

import { Button, Input, Modal, Menu, Badge, message, Dropdown, Space, notification, Popover, Tabs, Checkbox } from 'antd';
import styles from '@/routes/indexPage.less';
import config from '@/utils/config';
import * as commonUtils from '@/utils/utils';
import * as commonBusiness from '@/components/Common/commonBusiness';
import * as commonFunc from '@/components/Common/commonFunc';/* 单据业务功能 */
import AntdDraggableModal from '@/components/Common/AntdDraggableModal';
import FaceDetect from '@/components/FaceDetect';
import logoAbout from '@/assets/logo.png';
import prompt from '@/assets/prompt.png';
import newsTone from '@/assets/news.mp3';
import OnlineUser from '@/assets/onlineUser.svg';
import StaticEditTable from '@/components/Common/CommonTable';
import * as commonServices from '@/services/services';
import commonConfig from '../../../utils/config';
import SvgIcon from '../../SvgIcon';
import SkinChangeModal from './SkinChangeModal';
import MenuSearchPopovor from './MenuSearchPopovor';
import SwitchCompanyAndLanguage from './SwitchCompanyAndLanguage';

const { TabPane } = Tabs;
const { SubMenu } = Menu;
const MenuItemGroup = Menu.ItemGroup;
const FormItem = Form.Item;

class PersonCenter extends Component {
  constructor(props) {
    super(props);
    this.changePwd = localStorage.getItem(`${commonConfig.prefix}changePwd`) === 'true';
    this.state = {
      sId: props.app.userinfo.sId,
      dispatch: props.dispatch,
      userVisible: false,
      pwdVisible: this.changePwd,
      addFaceVisible: false,
      sUserName: props.app.userinfo.sUserName,
      menuSearchPopoverVisible: false,
      noticeVisible: false, // 新增:公告弹窗显示状态
      noticeChecked: false, // 新增:复选框选中状态
    };
  }
  componentWillMount() {
    const currentSkin = localStorage.getItem('xly-skin') || 'default';
    const oBody = document.querySelector('body');
    oBody.setAttribute('data-skin', currentSkin);
  }
  componentDidMount() {
    if (this.changePwd) {
      const changePwd = commonFunc.showLocalMessage(this.props, 'changePwd', '系统判断密码为初始密码,2请修改密码后再操作!');

      message.warning(changePwd, 10);
    }
    // 检查是否有公告数据需要显示
    this.checkNoticeData();
  }

  componentWillReceiveProps(nextProps) {
    const { app } = nextProps;
    if (commonUtils.isNotEmptyObject(app) && commonUtils.isNotEmptyObject(this.props.app.unRead) && commonUtils.isNull(app.unRead.iCount, 0).toString() !== commonUtils.isNull(this.props.app.unRead.iCount, 0).toString()) { /* 当nextProps中的消息大于原来props中的消息数 标明有新消息推送过来 */
      const audio = document.getElementById('msgAudio');
      if (commonUtils.isNotEmptyObject(audio)) {
        audio.play();
      }
    }
    // 检查是否有新的公告数据
    this.checkNoticeData(nextProps);
  }
  shouldComponentUpdate(nextProps) {
    const { pwdVisible } = this.state;
    const { app: appNew } = nextProps;
    const { app } = this.props;
    // 修改密码时,阻止websockt消息推送导致更新
    if (pwdVisible && JSON.stringify(appNew) !== JSON.stringify(app)) {
      return false;
    }
    return true;
  }
  onSaveFaceSuccess = (e) => {
    /* 阻止表单提交动作 */
    this.setState({
      addFaceVisible: false,
    });
  }
  handleCancellation = (e) => {
    const { dispatch, sId } = this.state;
    if (e.key === 'loginOut' || e.key === 'switchAccount') {
      const url = `${config.server_host}logout`;
      dispatch({ type: 'app/loginOut', payload: { url, sId, loginOutType: 'loginOut' } });
    } else if (e.key === 'setUser') {
      this.setState({ userVisible: true });
    } else if (e.key === 'setPsd') {
      this.setState({ pwdVisible: true });
    } else if (e.key === 'addFace') {
      this.setState({ addFaceVisible: true });
    } else if (e.key === 'resetPwd') {
      const { sId } = this.state;
      const url = `${config.server_host}sftlogininfo/updatePasswordUserName/reset?sModelsId=${100}&sId=${sId}`;
      const value = {};
      value.sId = sId;
      dispatch({ type: 'app/resetPwd', payload: { url, value } });
    } else if (e.key === 'mailAndMsg') {
      const pane = {
        title: '消息列表', route: '/indexPage/commonList', formId: '15669750700007338351055957774000', key: commonUtils.createSid(), sModelsType: 'commonList/msg',
      };
      dispatch({ type: 'app/addPane', payload: { pane } });
    } else if (e.key === 'clearOption') {
      const recordDeletion = commonFunc.showMessage(this.props.app.commonConst, 'recordDeletion') || '记录删除';/* 人脸采集 */
      sessionStorage.clear();
      this.clearSocket({ optName: recordDeletion });
      commonUtils.clearStoreDropDownData();
    } else if (e.key === 'about') {
      this.handleShowAbout();
    } else if (e.key === 'onlineUser') {
      this.handleShowOnlineUser();
    }
  };
  handleShowAbout = async () => {
    const { app } = this.props;
    const { token } = app;
    const configUrl = `${config.server_host}license/getLicense?sModelsId=${100}`;
    const configReturn = (await commonServices.getService(token, configUrl)).data;
    if (configReturn.code === 1) {
      const returnData = configReturn.dataset.rows;
      if (commonUtils.isNotEmptyArr(returnData)) {
        const aboutInfo = returnData[0];
        this.setState({ aboutInfo, aboutVisible: true });
      }
    } else {
      message.error(configReturn.msg);
    }
  };
  handleShowNews = (e) => {
    const { dispatch } = this.state;
    const pane = {
      title: '消息列表', route: '/indexPage/commonList', formId: '15669750700007338351055957774000', key: commonUtils.createSid(), sModelsType: 'commonList/msg',
    };
    dispatch({ type: 'app/addPane', payload: { pane } });
  };

  handleShowMsg = async (e, sFormId) => {
    const { dispatch } = this.state;
    const { app } = this.props;
    const { token } = app;
    /* 根据getModelById 取对应窗体 */
    const paneKey = new Date().getTime().toString();
    let sModelsType = '';
    let title = '单据页';
    let sProcName = '';
    let route = '/indexPage/commonBill';
    const configUrl = `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sFormId}?sModelsId=${sFormId}`;
    const configReturn = (await commonServices.getService(token, configUrl)).data;
    if (configReturn.code === 1) {
      const dataReturn = configReturn.dataset.rows;
      if (commonUtils.isNotEmptyArr(dataReturn) && commonUtils.isNotEmptyObject(dataReturn[0])) {
        const config = dataReturn[0];
        sModelsType = commonUtils.isNotEmptyObject(config.sModelType) ? config.sModelType.toString() : '';
        title = commonUtils.isNotEmptyObject(config.sMenuName) ? config.sMenuName.toString() : '';
        route = commonUtils.isNotEmptyObject(config.sName) ? config.sName.toString() : '';
        sProcName = commonUtils.isNotEmptyObject(config.sProcName) ? config.sProcName.toString() : '';
      }
    } else {
      this.getServiceError(configReturn);
    }
    const pane = {
      formId: sFormId,
      key: commonUtils.createSid(),
      route,
      title,
      sModelsType,
      sProcName,
    };
    // const pane = {
    //   title: '消息列表', route: '/indexPage/commonList', formId: sFormId, key: commonUtils.createSid(), sModelsType: 'commonList/msg',
    // };
    dispatch({ type: 'app/addPane', payload: { pane } });
  };


  // 检查公告数据
  checkNoticeData = async (nextProps = null) => {
    const props = nextProps || this.props;
    const { noticeVisible = false } = this.state;
    const msg = props.app.unRead;
    const { sModelsId, formSrcRoute = '' } = props;
    const msgObj = commonUtils.isJSON(msg) ? JSON.parse(msg) : {};
    const msgData = msgObj.data; /* 推送信息 */

    // 如果有公告数据且尚未显示过,则显示公告弹窗
    if (commonUtils.isNotEmptyObject(msgData) && commonUtils.isNotEmptyObject(msgData.COPYTO) &&
      msgData.COPYTO.sMsgId && !noticeVisible) {
      /* 根据sMsgId, sSlaveId 获取接口 */
      // eslint-disable-next-line prefer-destructuring
      const sMsgId = msgData.COPYTO.sMsgId;
      const sMsgSlaveId = msgData.COPYTO.sSlaveId;
      // 1. 在调用接口前先检查是否已经显示过该公告
      const noticeKey = `${sMsgId}_${sMsgSlaveId}`;

      const shownNotices = localStorage.getItem('shownNotices') || '';

      console.log('shownNotices', shownNotices, noticeKey);

      // 如果已经显示过,直接返回,不调用接口
      if (shownNotices.includes(noticeKey)) {
        console.log('公告已显示过,跳过接口调用:', noticeKey);
        return;
      }

      const dataUrl = `${commonConfig.server_host}notice/getNoticeDetail?sModelsId=${sModelsId}&sName=${formSrcRoute}`;
      const condition = {
        sMsgId,
        sSlaveId: sMsgSlaveId,
      };
      const configReturn = (await commonServices.postValueService(props.app?.token, condition, dataUrl)).data;
      if (configReturn?.code === 1) {
        const dataReturn = configReturn.dataset.rows;

        if (commonUtils.isNotEmptyArr(dataReturn) && commonUtils.isNotEmptyObject(dataReturn[0])) {
          const noticeData = dataReturn[0];

          // 3. 再次确认是否已显示(防止并发请求)
          const currentShownNotices = localStorage.getItem('shownNotices') || '';
          console.log('currentShownNotices11', currentShownNotices);
          if (!currentShownNotices.includes(noticeKey)) {
            this.setState({
              noticeVisible: true,
              noticeData,
              noticeTitle: noticeData?.msgData?.sTitle,
              noticeChecked: false,
              sMsgId,
              sMsgSlaveId,
            });
          }
        }
      }
    }
  }

  // 处理公告弹窗确定按钮点击
  handleNoticeConfirm = async () => {
    if (this.state.noticeChecked) {
      /* 调用接口把数据更新为已读 */
      const { app } = this.props;
      const { sMsgId, sMsgSlaveId } = this.state;

      const { token } = app;
      const configUrl = `${config.server_host}notice/updateNotice?sModelsId=${100}`;
      const condition = {
        sMsgId,
        sSlaveId: sMsgSlaveId,
      };
      const configReturn = (await commonServices.postValueService(token, condition, configUrl)).data;
      if (configReturn?.code === 1) {
        message.success('公告已阅读');
        // 在用户确认阅读后,才将公告记录存储到shownNotices中
        const noticeKey = `${sMsgId}_${sMsgSlaveId}`;
        const currentShownNotices = localStorage.getItem('shownNotices') || '';
        console.log('noticeKe11111y', noticeKey);
        localStorage.setItem('shownNotices', JSON.stringify(noticeKey));
      } else {
        message.error(configReturn?.msg);
      }
      this.setState({
        noticeVisible: false,
      });
    }
  }

  // 处理公告弹窗取消按钮点击
  handleNoticeCancel = () => {
    this.setState({
      noticeVisible: false,
    });
  }

  // 处理复选框变化
  handleNoticeCheckChange = (e) => {
    this.setState({
      noticeChecked: e.target.checked,
    });
  }


  handleSubmitPwd = (e) => {
    /* 阻止表单提交动作 */
    e.preventDefault();
    this.psdform.validateFields((err, values) => {
      if (!err) {
        const { sId } = this.state;
        values.sId = sId;
        if (values.sUserPwd !== values.sUserPwdAgain) {
          message.error('密码输入不一致');
          return;
        }
        const url = `${config.server_host}sftlogininfo/updatePasswordUserName/update?sModelsId=${100}`;
        const { dispatch } = this.state;
        dispatch({ type: 'app/editPwd', payload: { url, value: values, editPwdType: 'window' } });
        this.setState({
          pwdVisible: false,
        });
      }
    });
  }

  handleShowModal = () => {
    this.setState({
      visible: true,
    });
  }

  handleShowOnlineUser = async () => {
    const { app } = this.props;
    const { token } = app;
    const configUrl = `${config.server_host}license/getOnline?sModelsId=${100}`;
    const configReturn = (await commonServices.getService(token, configUrl)).data;
    if (configReturn.code === 1) {
      const returnData = configReturn.dataset.rows;
      if (commonUtils.isNotEmptyArr(returnData)) {
        const onlineUserData = returnData[0];
        this.setState({ onlineUserData, onlineUserVisible: true });
      }
    } else {
      message.error(configReturn.msg);
    }
  }

  handleSaveOnlineUserState = (onlineUserState) => {
    this.setState({ onlineUserState });
  }

  // 强制下线用户
  handleExitTbRow = (index, record) => {
    const oThis = this;
    Modal.confirm({
      title: `确定要将用户【${record.sUserName}】强制退出`,
      async onOk() {
        const { app } = oThis.props;
        const { userinfo, token } = app;
        const { sUserId, sUserLoginType } = record;
        const { onlineUserData } = oThis.state;
        const configUrl = `${config.server_host}license/doExit/${sUserId}/${sUserLoginType}`;
        const configReturn = (await commonServices.getService(token, configUrl)).data;
        if (configReturn.code === 1) {
          const iIndex = onlineUserData.data.findIndex(item => item.sUserId === record.sUserId);
          if (iIndex !== -1) {
            onlineUserData.data.splice(iIndex, 1);
            oThis.setState({ onlineUserData });
          }
          message.success(`用户【${record.sUserName}】已下线`);
        } else {
          message.error(`用户【${record.sUserName}】强制退出失败`);
        }
      },
    });
  }

  handleCancel = () => {
    this.setState({
      userVisible: false,
      pwdVisible: false,
      aboutVisible: false,
      addFaceVisible: false,
      onlineUserVisible: false,
      skinChangeModalVisible: false,
    });
  };

  handleUserForm = (form) => {
    this.userform = form;
  }

  handlePsdForm = (form) => {
    this.psdform = form;
  }

  handleSubmit = (e) => {
    /* 阻止表单提交动作 */
    e.preventDefault();
    this.userform.validateFields((err, values) => {
      if (!err) {
        const { sId } = this.state;
        values.sId = sId;
        const url = `${config.server_host}sftlogininfo/updatePasswordUserName/update?sModelsId=${100}`;
        const { dispatch } = this.state;
        dispatch({ type: 'app/editUser', payload: { url, value: values } });
        this.setState({
          userVisible: false,
        });
      }
    });
  };

  handleGetMsg = (content) => {
    const msgArr = commonUtils.isNotEmptyArr(content) ? content : '';
    const divStr = [];
    if (commonUtils.isNotEmptyArr(msgArr)) {
      // eslint-disable-next-line no-plusplus
      for (let i = 0; i < msgArr.length; i++) {
        const msgObj = msgArr[i];
        // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
        divStr.push(<p onClick={e => this.handleShowMsg(e, msgObj.sFormId)}>{msgObj.sTypeName} <span style={{ color: 'red' }}>{`(${msgObj.iCount})`}</span></p>);
      }
    }
    return divStr;
  }

  clearSocket = async (params) => {
    const { app } = this.props;
    const { token } = app;
    const returnData = await commonBusiness.clearSocketData({ token, value: params, sModelsId: 100 });
  };

  handleSetMenuSearchPopoverVisible = (visible) => {
    this.setState({ menuSearchPopoverVisible: visible });
  }
  updateMenuPanel = () => {
    // const url = `${config.server_host}business/getBuMenu?sModelsId=100`;
    // const { token } = this.props.app;
    // const options = {
    //   method: 'GET',
    //   headers: {
    //     'Content-Type': 'application/json',
    //     authorization: token,
    //   },
    // };
    // fetch(url, options).then(response => response.json()).then(async (json) => {
    //   if (json.code === 1) {
    //     console.log(json);
    //     this.setState({ menuPanel: json.dataset.rows });
    //     // message.success(json.msg);
    //   } else {
    //     message.error(json.msg);
    //   }
    // });
  }
  render() {
    const { props, state, unRead } = this;
    const { sUserName, sType, companyName } = props.app.userinfo;
    const ModifyUserNserName = commonFunc.showMessage(props.app.commonConst, 'ModifyUserNserName');/* 修改用户名 */
    const ModifyPassword = commonFunc.showMessage(props.app.commonConst, 'ModifyPassword');/* 修改密码 */
    const InitPassword = commonFunc.showMessage(props.app.commonConst, 'InitPassword');/* 初始化密码 */
    const SwitchAccount = commonFunc.showMessage(props.app.commonConst, 'SwitchAccount');/* 切换账号 */
    const GetFace = commonUtils.isNotEmptyObject(commonFunc.showMessage(props.app.commonConst, 'GetFace')) ?
      commonFunc.showMessage(props.app.commonConst, 'GetFace') : '人脸采集';/* 人脸采集 */
    const Newsinfo = commonFunc.showMessage(props.app.commonConst, 'Newsinfo');/* 消息 */
    const Todo = commonFunc.showMessage(props.app.commonConst, 'Todo');/* Todo待办 */
    const aMe = commonFunc.showMessage(props.app.commonConst, '@Me');/* @Me */
    const ClearOut = commonFunc.showMessage(props.app.commonConst, 'ClearOut');/* 清空 */
    const Help = commonFunc.showMessage(props.app.commonConst, 'Help');/* 帮助 */
    const About = commonFunc.showMessage(props.app.commonConst, 'About');/* 关于 */
    const ExitLogin = commonFunc.showMessage(props.app.commonConst, 'ExitLogin');/* 退出 */
    const sysadmin = commonFunc.showMessage(props.app.commonConst, 'sysadmin');/* 超级管理员 */
    const General = commonFunc.showMessage(props.app.commonConst, 'General');/* 普通用户 */
    const OnlineUserName =  commonFunc.showMessage(props.app.commonConst, 'OnlineUsers') || '在线用户';/* 在线用户 */
    const sLookAll = commonUtils.isNotEmptyObject(commonFunc.showMessage(props.app.commonConst, 'sLookAll')) ?
      commonFunc.showMessage(props.app.commonConst, 'sLookAll') : '';


    const formItemLayout = {
      labelCol: {
        xs: { span: 24 },
        sm: { span: 8 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 12 },
      },
    };
    const tailFormItemLayout = {
      wrapperCol: {
        xs: {
          span: 24,
          offset: 0,
        },
        sm: {
          span: 16,
          offset: 8,
        },
      },
    };
    const msg = props.app.unRead;
    const msgObj = commonUtils.isJSON(msg) ? JSON.parse(msg) : {};
    const msgData = msgObj.data; /* 推送信息 */
    const { menuSearchPopoverVisible, dispatch } = this.state;
    const { menuPanel, onAddPane, app } = this.props;
    return (
      <div className={styles.dropdownContainer} id="pcDropdwonContainer">
        <Space align="baseline" style={{ display: 'flex', alignItems: 'center' }}>
          <div style={{ display: 'none' }} className={styles.dropdownDiv}>{companyName}</div>
          <div
            className="sysSearchInput"
            style={menuSearchPopoverVisible ? {
              width: 0,
              opacity: 0,
              '--transform-left': '-30px',
            } : {}}
          >
            <Popover
              trigger="click"
              destroyTooltipOnHide
              content={
                <MenuSearchPopovor
                  menuPanel={menuPanel}
                  onAddPane={onAddPane}
                  app={app}
                  dispatch={dispatch}
                  updateMenuPanel={this.updateMenuPanel}
                  onSetMenuSearchPopoverVisible={this.handleSetMenuSearchPopoverVisible}
                />
              }
              placement="left"
              overlayClassName="sysSearchContent"
              open={menuSearchPopoverVisible}
            >
              <SearchOutlined
                onClick={() => {
                  this.handleSetMenuSearchPopoverVisible(true);
                }}
              />
            </Popover>
          </div>
          <SwitchCompanyAndLanguage {...props} />
          <div
            className="sysNewBox"
            onFocus={() => 0}
            onBlur={() => 0}
            onMouseOver={() => {
              clearTimeout(this.showCodeBoxTimer);
              this.setState({ showCodeBox: true });
            }}
            onMouseOut={() => {
              clearTimeout(this.showCodeBoxTimer);
              this.showCodeBoxTimer = setTimeout(() => {
                this.setState({ showCodeBox: false });
              }, 500);
            }}
          >
            <div className="sysNews">
              {
                commonUtils.isNotEmptyArr(msgData) ?
                  <Badge count={msgObj.iCount}>
                    <img alt="logo" src={prompt} width={18} />
                  </Badge> :
                  <div onClick={this.handleShowNews}>
                    <Badge count={commonUtils.isNotEmptyNumber(msgObj.iCount) ? msgObj.iCount : (commonUtils.isNotEmptyObject(msg) ? msg : '')}>
                      <MailOutlined className={styles.iconMailOutlined} style={{ fontSize: '15px' }} />
                    </Badge>
                  </div>
              }
              {/* eslint-disable-next-line jsx-a11y/media-has-caption */}
              <audio src={newsTone} id="msgAudio">
                Your browser does not support the audio element.
              </audio>
              <div className="code-box-demo" style={{ display: this.state.showCodeBox ? 'block' : 'none' }}>
                <div className="card-container">
                  {
                    commonUtils.isNotEmptyObject(msgData) ?
                      <Tabs
                        defaultActiveKey="1"
                        size="middle"
                        type="card"
                      >

                        <TabPane tab={<span>{Newsinfo} {commonUtils.isNotEmptyNumber(msgData.MSG.iCount) ? <span style={{ color: 'red' }}>{`(${msgData.MSG.iCount})`}</span> : ''} </span>} key="1">
                          <div className="newsContent">
                            <div className="newsTitle" >
                              {commonUtils.isNotEmptyObject(msgData.MSG) ?
                                <div> {msgData.MSG.sContent}</div> : ''
                              }
                            </div>
                            <div className="newsFoot" >
                              <div onClick={e => this.handleShowMsg(e, msgData.MSG.sFormId)}>{sLookAll}</div>
                            </div>
                          </div>
                        </TabPane>
                        <TabPane tab={<span>{Todo} {commonUtils.isNotEmptyNumber(msgData.UNDO.iCount) ? <span style={{ color: 'red' }}>{`(${msgData.UNDO.iCount})`}</span> : ''} </span>} key="2">
                          <div className="newsContent">
                            <div className="newsTitle" >
                              {commonUtils.isNotEmptyObject(msgData.UNDO) ?
                                <div> {msgData.UNDO.sContent}</div> : ''
                              }
                            </div>
                            <div className="newsFoot" >
                              <div onClick={e => this.handleShowMsg(e, msgData.UNDO.sFormId)}>{sLookAll}</div>
                            </div>
                          </div>
                        </TabPane>
                        <TabPane tab={<span>{aMe} {commonUtils.isNotEmptyNumber(msgData.COPYTO.iCount) ? <span style={{ color: 'red' }}>{`(${msgData.COPYTO.iCount})`}</span> : ''} </span>} key="3">
                          <div className="newsContent">
                            <div className="newsTitle" >
                              {commonUtils.isNotEmptyObject(msgData.COPYTO) ?
                                <div> {msgData.COPYTO.sContent}</div> : ''
                              }
                            </div>
                            <div className="newsFoot" >
                              <div onClick={e => this.handleShowMsg(e, msgData.COPYTO.sFormId)}>{sLookAll}</div>
                            </div>
                          </div>
                        </TabPane>
                      </Tabs> : ''
                  }

                </div>
              </div>
            </div>
          </div>
          <Space>
            <SkinOutlined
              className={styles.skinChange}
              onClick={() => {
                this.setState({ skinChangeModalVisible: true });
              }}
            />
            <Dropdown overlay={
              <Menu
                onClick={this.handleCancellation}
              >
                <Menu.Item key="setUser" style={{ fontSize: '14px', height: '32px' }}>{ModifyUserNserName}</Menu.Item>
                <Menu.Item key="setPsd" style={{ fontSize: '14px', height: '32px' }}>{ModifyPassword}</Menu.Item>
                <Menu.Item key="resetPwd" style={{ fontSize: '14px', height: '32px' }}>{InitPassword}</Menu.Item>
                <Menu.Item key="addFace" style={{ fontSize: '14px', height: '32px' }}>{GetFace}</Menu.Item>
                <Menu.Item key="switchAccount" style={{ fontSize: '14px', height: '32px' }}>{SwitchAccount}</Menu.Item>
              </Menu>}
            >
              <div className={styles.antDropdownLink} onClick={e => e.preventDefault()} >
                <Space>
                  {/* <SvgIcon iconClass="card" fill="#fff" size="16" offsetY="3" /> */}
                  <span>{sUserName}({sType === 'sysadmin' ? sysadmin : sType === 'General' ? General : ''})</span>
                  <DownOutlined />
                </Space>
              </div>
            </Dropdown>
          </Space>
          <div />
          <Dropdown overlay={
            <Menu
              onClick={this.handleCancellation}
            >
              <Menu.Item key="clearOption">
                <Space style={{ fontSize: '14px', width: '120px', height: '28px' }}>
                  <DeleteOutlined />{ClearOut}
                </Space>
              </Menu.Item>
              <Menu.Item key="help">
                <Space style={{ fontSize: '14px', width: '120px', height: '28px' }}>
                  <QuestionCircleOutlined />{Help}
                </Space>
              </Menu.Item>
              <Menu.Item key="about">
                <Space style={{ fontSize: '14px', width: '120px', height: '28px' }}>
                  <InfoCircleOutlined />{About}
                </Space>
              </Menu.Item>
              <Menu.Item key="onlineUser">
                <Space style={{ fontSize: '14px', width: '120px', height: '28px' }}>
                  <img src={OnlineUser} alt="onlineUser" width="16px" height="16px" />
                  <span style={{ marginLeft: '-2px' }}>{OnlineUserName}</span>
                </Space>
              </Menu.Item>
              <Menu.Item key="loginOut">
                <Space style={{ fontSize: '14px', width: '120px', height: '28px' }}>
                  <PoweroffOutlined />{ExitLogin}
                </Space>
              </Menu.Item>
            </Menu>}
          >
            <div className={styles.antDropdownLink} onClick={e => e.preventDefault()}>
              <EllipsisOutlined />
            </div>
          </Dropdown>
        </Space>
        <PersonCenterUserName
          {...props}
          {...state}
          formItemLayout={formItemLayout}
          tailFormItemLayout={tailFormItemLayout}
          handleSubmit={this.handleSubmit}
          handleCancel={this.handleCancel}
          handleUserForm={this.handleUserForm}
        />
        <PersonCenterPsd
          {...props}
          {...state}
          formItemLayout={formItemLayout}
          tailFormItemLayout={tailFormItemLayout}
          handleSubmitPwd={this.handleSubmitPwd}
          handleCancel={this.handleCancel}
          handlePsdForm={this.handlePsdForm}
        />
        <PersonCenterAddFace
          {...props}
          {...state}
          formItemLayout={formItemLayout}
          tailFormItemLayout={tailFormItemLayout}
          onSaveFaceSuccess={this.onSaveFaceSuccess}
          handleCancel={this.handleCancel}
        />
        <PersonCenterOnlineUser
          {...props}
          {...state}
          formItemLayout={formItemLayout}
          tailFormItemLayout={tailFormItemLayout}
          handleCancel={this.handleCancel}
          onSaveState={this.handleSaveOnlineUserState}
          onExitTbRow={this.handleExitTbRow}
        />
        {state.skinChangeModalVisible &&
          <SkinChangeModal
            {...props}
            {...state}
            handleCancel={this.handleCancel}
          />
        }
        {/* 新增公告弹窗组件 */}
        <PersonCenterNotice
          {...props}
          {...state}
          handleNoticeConfirm={this.handleNoticeConfirm}
          handleNoticeCancel={this.handleNoticeCancel}
          handleNoticeCheckChange={this.handleNoticeCheckChange}
        />
      </div>
    );
  }
}
const PersonCenterUserName = Form.create({
  mapPropsToFields(props) {
  },
})((props) => {
  const {
    handleCancel,
    handleSubmit,
    tailFormItemLayout,
    handleUserForm,
    formItemLayout,
    form,
    userVisible,
    aboutVisible,
    app,
    aboutInfo,
  } = props;
  const { getFieldDecorator } = props.form;
  const { sUserName, companyName } = props.app.userinfo;
  const ModifyUserNserName = commonFunc.showMessage(app.commonConst, 'ModifyUserNserName');/* 修改用户名 */
  const userName = commonFunc.showMessage(app.commonConst, 'userName');/* 用户名 */
  const pleaseInputNewName = commonFunc.showMessage(app.commonConst, 'pleaseInputNewName');/* 请输入新名称 */
  const btnSave = commonFunc.showMessage(app.commonConst, 'BtnSave');/* 保存 */
  const About = commonFunc.showMessage(app.commonConst, 'About');/* 关于 */
  const Version = commonFunc.showMessage(app.commonConst, 'Version');/* 版本号 */
  const comName = commonFunc.showMessage(app.commonConst, 'CompanyName');/* 公司名称 */
  const Website = commonFunc.showMessage(app.commonConst, 'Website');/* 站点数 */
  const ExpirationDate = commonFunc.showMessage(app.commonConst, 'ExpirationDate');/* 软件到期时间 */
  const MAC = commonFunc.showMessage(app.commonConst, 'MAC');/* 物理地址 */
  const versionValue = commonUtils.isNotEmptyObject(aboutInfo) ? aboutInfo.version : '';
  const websiteValue = commonUtils.isNotEmptyObject(aboutInfo) ? aboutInfo.consumerCount : '';
  const expirationDateValue = commonUtils.isNotEmptyObject(aboutInfo) ? aboutInfo.afterTime : '';
  const macValue = commonUtils.isNotEmptyObject(aboutInfo) ? aboutInfo.mac : '';
  return (
    <div>
      {
        userVisible ?
          <AntdDraggableModal
            title={ModifyUserNserName}
            width={500}
            visible={userVisible}
            onCancel={handleCancel}
            footer={null}
            className={styles.changeUserName}
          >
            {handleUserForm(form)}
            <Form onSubmit={handleSubmit} className={styles.popoverForm}>
              <FormItem label={userName} {...formItemLayout} hasFeedback>
                {getFieldDecorator('sUserName', {
                  initialValue: sUserName,
                  rules: [{ required: true, message: pleaseInputNewName }],
                })(<Input placeholder={pleaseInputNewName} type="sUserName" />)}
              </FormItem>
              <FormItem {...tailFormItemLayout}>
                <Button type="primary" htmlType="submit">{btnSave}</Button>
              </FormItem>
            </Form>
          </AntdDraggableModal>
          : ''
      }{
        aboutVisible ?
          <AntdDraggableModal
            title={About}
            width={400}
            visible={aboutVisible}
            onCancel={handleCancel}
            footer={null}
            className={styles.changeUserName}
          >
            <div className={styles.sysAbout}>
              <div className={styles.syslog} >
                <img alt="logo" src={logoAbout} style={{ marginRight: 10 }} />
              </div>
              <div className={styles.sysInfo} >
                <div className={styles.sysLine}>
                  <div className={styles.aboutleft}>{comName}</div><div className={styles.aboutRight}>{companyName}</div>
                </div>
                <div className={styles.sysLine}>
                  <div className={styles.aboutleft}>{Version}</div><div className={styles.aboutRight}>{versionValue}</div>
                </div>
                <div className={styles.sysLine}>
                  <span className={styles.aboutleft}>{Website}</span><span className={styles.aboutRight}> {websiteValue}</span>
                </div>
                <div className={styles.sysLine}>
                  <span className={styles.aboutleft}>{MAC}</span><span className={styles.aboutRight}> {macValue}</span>
                </div>
                <div className={styles.sysLine}>
                  <span className={styles.aboutleft}>{ExpirationDate}</span><span className={styles.aboutRight}> {expirationDateValue}</span>
                </div>
              </div>
            </div>
          </AntdDraggableModal>
          : ''
      }
    </div>
  );
});

const PersonCenterPsd = Form.create({
  mapPropsToFields(props) {
  },
})((props) => {
  const {
    handleCancellation,
    handleCancel,
    handleModalClose,
    handleSubmitPwd,
    handlePsdForm,
    pwdVisible,
    form,
    app,
  } = props;
  const formItemLayout = {
    labelCol: {
      xs: { span: 24 },
      sm: { span: 8 },
    },
    wrapperCol: {
      xs: { span: 24 },
      sm: { span: 13 },
    },
  };
  const tailFormItemLayout = {
    wrapperCol: {
      xs: {
        span: 24,
        offset: 0,
      },
      sm: {
        span: 16,
        offset: 8,
      },
    },
  };
  const { getFieldDecorator } = props.form;
  const NotSamePassword = commonFunc.showMessage(app.commonConst, 'NotSamePassword');/* 两次密码输入不一致 */
  /*  密码不一致验证 */
  const passwordValidator = (rule, value, callback) => {
    const { getFieldValue } = form;
    if (value && value !== getFieldValue('sUserPwd')) {
      callback(NotSamePassword);
    }
    // 必须总是返回一个 callback,否则 validateFields 无法响应
    callback();
  };
  const ModifyPassword = commonFunc.showMessage(app.commonConst, 'ModifyPassword');/* 修改密码 */
  const oldPassword = commonFunc.showMessage(app.commonConst, 'oldPassword');/* 原密码 */
  const pleaseInputOldPassword = commonFunc.showMessage(app.commonConst, 'pleaseInputOldPassword');/* 请输入原密码 */
  const newPassword = commonFunc.showMessage(app.commonConst, 'newPassword');/* 新密码 */
  const peleaseInputNewPassword = commonFunc.showMessage(app.commonConst, 'peleaseInputNewPassword');/* 请输入新密码 */
  const confirmNewPassword = commonFunc.showMessage(app.commonConst, 'confirmNewPassword');/* 确认新密码 */
  const pleaseConfirmPasswordAgin = commonFunc.showMessage(app.commonConst, 'pleaseConfirmPasswordAgin');/* 请再次确认新密码 */
  const btnSave = commonFunc.showMessage(app.commonConst, 'BtnSave');/* 保存 */
  return (
    <div>
      {
        pwdVisible ?
          <AntdDraggableModal
            title={ModifyPassword}
            width={500}
            visible={pwdVisible}
            onCancel={handleCancel}
            afterClose={handleModalClose}
            footer={null}
            className={styles.changePwd}
            closable={!app?.isInitPassword}
          >
            {handlePsdForm(form)}
            <Form onSubmit={handleSubmitPwd} className={styles.popoverForm}>
              <FormItem label={oldPassword} {...formItemLayout}>
                {getFieldDecorator('sOldPwd', {
                  rules: [{ required: true, message: pleaseInputOldPassword }],
                })(<Input placeholder={pleaseInputOldPassword} type="password" />)}
              </FormItem>
              <FormItem label={newPassword} {...formItemLayout} hasFeedback>
                {getFieldDecorator('sUserPwd', {
                  rules: [{ required: true, message: peleaseInputNewPassword }],
                })(<Input placeholder={peleaseInputNewPassword} type="password" />)}
              </FormItem>
              <FormItem label={confirmNewPassword} {...formItemLayout} hasFeedback>
                {getFieldDecorator('sUserPwdAgain', {
                  rules: [{ required: true, message: pleaseConfirmPasswordAgin }, {
                    validator: passwordValidator,
                  }],
                  validateFirst: true,
                })(<Input placeholder={pleaseConfirmPasswordAgin} type="password" />)}
              </FormItem>
              <FormItem {...tailFormItemLayout}>
                <Button type="primary" htmlType="submit">{btnSave}</Button>
              </FormItem>
            </Form>
          </AntdDraggableModal>
          : ''
      }
    </div>
  );
});

const PersonCenterAddFace = Form.create({
  mapPropsToFields(props) {
  },
})((props) => {
  const {
    handleCancel,
    handleModalClose,
    addFaceVisible,
  } = props;
  const GetFace = commonFunc.showMessage(props.app.commonConst, 'GetFace');/* 在线用户 */
  return (
    <div>
      {
        <AntdDraggableModal
          title={GetFace}
          width={400}
          visible={addFaceVisible}
          onCancel={handleCancel}
          afterClose={handleModalClose}
          footer={null}
          className={styles.changePwd}
        >
          <div className="tab-container">
            <FaceDetect {...props} actionType="saveFace" onSaveFaceSuccess={props.onSaveFaceSuccess}>11</FaceDetect>
          </div>
        </AntdDraggableModal>
      }
    </div>
  );
});

const PersonCenterOnlineUser = Form.create({
  mapPropsToFields(props) {
  },
})((props) => {
  const {
    handleCancel,
    onlineUserVisible,
    onlineUserData,
    onSaveState,
    onlineUserState = {},
    onExitTbRow,
    app,
  } = props;
  const { userinfo } = app;
  const BtnSure =commonFunc.showMessage(app.commonConst, 'BtnSure') || '确认';
  const BtnCancel  =commonFunc.showMessage(app.commonConst, 'BtnCancel') || '取消';
  const OnlineUsers = commonFunc.showMessage(props.app.commonConst, 'OnlineUsers');/* 在线用户 */

  const Website = commonFunc.showMessage(props.app.commonConst, 'Website');/* 站点数 */
  const ExpirationDate = commonFunc.showMessage(props.app.commonConst, 'ExpirationDate');/* ExpirationDate */

  const OnlineUserName = OnlineUsers;
  // const ModifyPassword = commonFunc.showMessage(app.commonConst, 'ModifyPassword');/* 修改密码 */
  const onlineUserDataNew = commonUtils.isNotEmptyObject(onlineUserData) ? onlineUserData : {};
  const onlineUserConfig = {
    sId: commonUtils.createSid(),
    bisMutiSelect: false,
    bMutiSelect: false,
  };
  /* eslint-disable */
  const gdsconfigformslave = [
    { sId: commonUtils.createSid(), sName: 'sId', showName: '主键', sChinese: '主键', sEnglishName: 'Primary Key', sBig5Name: '主鍵',  bVisible: false, iFitWidth: 0 },
    { sId: commonUtils.createSid(), sName: 'iRowNum', showName: '行号',sChinese: '行号', sEnglishName: 'Row Number', sBig5Name: '行号',  bVisible: true, iFitWidth: 60, bNotSort: true },
    { sId: commonUtils.createSid(), sName: 'sUserNo', showName: '用户号', sChinese: '用户号', sEnglishName: 'User ID', sBig5Name: '用戶号',  bVisible: true, iFitWidth: 100, bFind: true },
    { sId: commonUtils.createSid(), sName: 'sUserName', showName: '用户名',sChinese: '用户名', sEnglishName: 'User Name',sBig5Name: '用戶名',  bVisible: true, iFitWidth: 100, bFind: true },
    { sId: commonUtils.createSid(), sName: 'sEmployeeNo', showName: '员工编号', sChinese: '员工编号', sEnglishName: 'Employee ID', sBig5Name: '員工編號', bVisible: true, iFitWidth: 100, bFind: true },
    { sId: commonUtils.createSid(), sName: 'sDepartName', showName: '部门', sChinese: '部门', sEnglishName: 'Department',sBig5Name: '部門',  bVisible: true, iFitWidth: 100 },
    { sId: commonUtils.createSid(), sName: 'sUserType', showName: '用户类型',sChinese: '用户类型', sEnglishName: 'User Type', sBig5Name: '用戶類型', bVisible: true, iFitWidth: 100 },
    { sId: commonUtils.createSid(), sName: 'sUserLoginTypeName', showName: '登陆类型', sChinese: '登陆类型', sEnglishName: 'Login Type',sBig5Name: '登陸類型',  bVisible: true, iFitWidth: 100 },
    { sId: commonUtils.createSid(), sName: 'tLoginDate', showName: '登陆时间',sChinese: '登陆时间', sEnglishName: 'Login Time', sBig5Name: '登陸時間', bVisible: true, iFitWidth: 150 },
  ];
    const gdsconfigformslaveNew = gdsconfigformslave.map(column => {
    const { sLanguage } = userinfo || {};
    let showName = column.sChinese; // 默认中文

    if (sLanguage === 'sEnglish' && column.sEnglishName) {
      showName = column.sEnglishName;
    } else if (sLanguage === 'sBig5' && column.sBig5Name) {
      showName = column.sBig5Name;
    }

    return {
      ...column,
      showName
    };
  });
  /* eslint-disable array-callback-return,no-undef,no-unused-vars */
  onlineUserConfig.gdsconfigformslave = gdsconfigformslaveNew;

  const headerColumn = commonFunc.getHeaderConfig(onlineUserConfig);

  const { sLanguage } = userinfo || {};
  const { sType } = props.app?.userinfo || {};
  // 根据用户语言处理表头显示名称
  headerColumn.forEach(column => {
    if (sLanguage === 'sEnglish' && column.sEnglishName) {
      column.showName = column.sEnglishName; // 使用英文显示名称
    }else if (sLanguage === 'sBig5' && column.sBig5Name) {
      column.showName = column.sBig5Name; // 使用繁体显示名称
    }
  });


  const onlineUserProps = {
    ...commonBusiness.getTableTypes('onlineUser', props),
    formId: commonUtils.createSid(),
    tableProps: { AutoTableHeight: '100%', setNoCommonOperate: true, setExit: ['sysadmin'].includes(sType), },
    config: onlineUserConfig,
    headerColumn,
    data: commonUtils.isNotEmptyObject(onlineUserDataNew) ? onlineUserDataNew.data : [],
    onSaveState,
    onSelectRowChange: () => { },
    onExitTbRow,
    getDateFormat: () => 'YYYY-MM-DD hh:mm:ss',
    ...onlineUserState
  };

  const tableHeight = 500;
  const title = `${OnlineUserName}${commonUtils.isNotEmptyObject(onlineUserDataNew) ? `【 ${Website}${onlineUserDataNew.consumerCount}\xa0\xa0\xa0\xa0\xa0${ExpirationDate}${onlineUserDataNew.afterTime}` : ''} 】`;
  return (
    <div>
      {onlineUserVisible ? (
        <AntdDraggableModal title={title} width="80%" visible={onlineUserVisible} onCancel={handleCancel} afterClose={handleCancel} footer={null}>
          <div
            style={{ width: "100%", height: tableHeight + "px" }}
            ref={ref => {
              if (ref) {
                ref.querySelector(".ant-table-container").style.height = tableHeight + "px";
                ref.querySelector(".ant-table-body").style.height = tableHeight - 30 + "px";
                // ref.querySelectorAll('.ant-table-cell-fix-right').forEach(item => {
                //   if (item.previousSibling) {
                //     item.previousSibling.style.display = 'none';
                //   }
                // });
              }
            }}
          >
            <StaticEditTable {...onlineUserProps} setOpterationColumn="Y" noVlist />
          </div>
          <div className="ant-modal-footer" style={{ padding: "8px 0 0 0" }}>
            <Button key="back" onClick={handleCancel}>
              {BtnCancel}
            </Button>
            <Button key="submit" type="primary" onClick={handleCancel}>
              {BtnSure}
            </Button>
          </div>
        </AntdDraggableModal>
      ) : (
        ""
      )}
    </div>
  );
});

// 新增公告弹窗组件
const PersonCenterNotice = Form.create({
  mapPropsToFields(props) {
  },
})((props) => {
  const {
    handleNoticeConfirm,
    handleNoticeCancel,
    handleNoticeCheckChange,
    noticeVisible,
    noticeData = {},
    noticeChecked,
    app,
  } = props;

  const noticeMsgData = noticeData?.msgData ;


  const noticeFileData = noticeData?.fileData || [] ;


  const NoticeTitle = noticeMsgData?.sTitle;
  const NoticeContent = noticeMsgData?.sAbstractfullmemo || '暂无内容';

  const Confirm = commonUtils.isNotEmptyObject(commonFunc.showMessage(app.commonConst, 'Confirm'))
    ? commonFunc.showMessage(app.commonConst, 'Confirm')
    : '确定';
  const Cancel = commonUtils.isNotEmptyObject(commonFunc.showMessage(app.commonConst, 'Cancel'))
    ? commonFunc.showMessage(app.commonConst, 'Cancel')
    : '取消';
  const NoticeAgree = commonUtils.isNotEmptyObject(commonFunc.showMessage(app.commonConst, 'NoticeAgree'))
    ? commonFunc.showMessage(app.commonConst, 'NoticeAgree')
    : '我已阅读并同意';

  return (
    <div>
      {
        noticeVisible ?
          <AntdDraggableModal
            title={
              <div style={{ textAlign: 'center', width: '100%', fontSize: '18px' }}>
                {NoticeTitle}
              </div>
            }
            width={1200}
            visible={noticeVisible}
            onCancel={handleNoticeCancel}
            closable={false}
            footer={[
              // 外层容器控制整体边距和左对齐
              <div
                style={{
                  display: 'flex',
                  alignItems: 'center',
                  width: '100%',
                  justifyContent: 'flex-end',
                  padding: '0px 24px 16px 16px',
                  margin: '0', // 清除外部默认边距
                }}
              >
                <Checkbox
                  key="agree"
                  checked={noticeChecked}
                  onChange={handleNoticeCheckChange}
                  style={{
                    marginRight: 16,
                    fontSize: 14,
                    color: '#333',
                    // 确保复选框与按钮垂直居中对齐
                    marginTop: -2
                  }}
                >
                  {NoticeAgree}
                </Checkbox>
                <Button
                  key="confirm"
                  type="primary"
                  onClick={handleNoticeConfirm}
                  disabled={!noticeChecked}
                  style={{
                    padding: '0px 20px', // 增加按钮内边距让文字居中更明显
                    fontSize: 14,
                    borderRadius: 4,
                    transition: 'all 0.2s',
                    opacity: noticeChecked ? 1 : 0.6,
                    cursor: noticeChecked ? 'pointer' : 'not-allowed',
                    // 确保按钮文字垂直居中
                    height: 30,
                    lineHeight: '30px'
                  }}
                >
                  {Confirm}
                </Button>
              </div>
            ]}
          >
            <div style={{
              maxHeight: '800px',
              overflowY: 'auto',
              padding: '20px',
              border: '1px solid #f0f0f0',
              borderRadius: '8px',
              backgroundColor: '#f5f7fa',
              boxShadow: '0 2px 8px rgba(0, 0, 0, 0.05)'
            }}>
              {/* 富文本内容区域 */}
              {NoticeContent ? (
                <div style={{
                  backgroundColor: '#fff',
                  borderRadius: '8px',
                  padding: '20px',
                  minHeight: '200px',
                  border: '1px solid #e8e8e8',
                  transition: 'border-color 0.3s'
                }}>
                  <BraftEditor
                    value={BraftEditor.createEditorState(noticeMsgData?.sAbstractfullmemo)}
                    readOnly
                    controls={[]}
                    contentStyle={{
                      height: 'auto',
                      minHeight: '400px',
                      maxHeight: '600px',
                      lineHeight: '1.8',
                      fontSize: '15px'
                    }}
                    style={{
                      border: 'none',
                      borderRadius: '4px'
                    }}
                  />
                </div>
              ) : (
                <div style={{
                  lineHeight: '1.8',
                  fontSize: '15px',
                  whiteSpace: 'pre-wrap',
                  wordBreak: 'break-word',
                  padding: '20px',
                  backgroundColor: '#fff',
                  border: '1px solid #e8e8e8',
                  borderRadius: '8px',
                  minHeight: '200px',
                  color: '#666',
                  textAlign: 'center'
                }}>
                  暂无公告内容
                </div>
              )}

              {/* 附件区域 - 与富文本区域明显分隔 */}
              {commonUtils.isNotEmptyArr(noticeFileData) && (
                <div style={{
                  marginTop: '20px',
                  padding: '15px 20px',
                  backgroundColor: '#fff',
                  borderRadius: '8px',
                  border: '1px solid #e8e8e8',
                }}>
                  <div style={{
                    display: 'flex',
                    alignItems: 'center',
                    flexWrap: 'wrap'
                  }}>
                    {/* 左侧"附件"文字 */}
                    <div style={{
                      fontSize: '14px',
                      color: '#333',
                      fontWeight: 500,
                      marginRight: '15px',
                      padding: '3px 0',
                      minWidth: '50px'
                    }}>
                      附件:
                    </div>

                    {/* 右侧附件链接区域 */}
                    <div style={{
                      display: 'flex',
                      gap: '16px',
                      flexWrap: 'wrap',
                      flexGrow: 1
                    }}>
                      {noticeFileData.map(item => {
                        const {sId: uid, sFileName: name, sPicturePath} = item;
                        const fileUrl = `${commonConfig.server_host}file/download?savePathStr=${sPicturePath}&sModelsId=100`;

                        return (
                          <a
                            key={uid}
                            href={fileUrl}
                            target="_blank"
                            rel="noopener noreferrer"
                            style={{
                              display: 'inline-flex',
                              alignItems: 'center',
                              color: '#1890ff',
                              fontSize: '14px',
                              textDecoration: 'none',
                              padding: '3px 0',
                              transition: 'color 0.2s',
                              whiteSpace: 'nowrap'
                            }}
                            onMouseOver={(e) => e.currentTarget.style.textDecoration = 'underline'}
                            onMouseOut={(e) => e.currentTarget.style.textDecoration = 'none'}
                          >
                <span style={{marginRight: '5px'}}>
                  <i className="fa fa-file-o" aria-hidden="true"></i>
                </span>
                            {name}
                          </a>
                        );
                      })}
                    </div>
                  </div>
                </div>
              )}
            </div>

          </AntdDraggableModal>
          : ''
      }
    </div>
  );
});

export default PersonCenter;