Commit e2294523ff4d5a77fea588788eb5f0132dc9018e
1 parent
f57bc259
登录缓存
Showing
6 changed files
with
145 additions
and
94 deletions
package.json
| @@ -27,7 +27,7 @@ | @@ -27,7 +27,7 @@ | ||
| 27 | "babel-runtime": "6.26.0", | 27 | "babel-runtime": "6.26.0", |
| 28 | "classnames": "^2.2.6", | 28 | "classnames": "^2.2.6", |
| 29 | "copy-to-clipboard": "^3.3.1", | 29 | "copy-to-clipboard": "^3.3.1", |
| 30 | - "core-js": "2.5.7", | 30 | + "core-js": "3.47.0", |
| 31 | "dhtmlx-gantt": "^7.1.6", | 31 | "dhtmlx-gantt": "^7.1.6", |
| 32 | "dva": "^2.4.1", | 32 | "dva": "^2.4.1", |
| 33 | "dva-router-config": "^1.1.0", | 33 | "dva-router-config": "^1.1.0", |
src/components/Common/CommonComponent/index.js
| @@ -271,7 +271,7 @@ export default class CommonComponent extends Component { | @@ -271,7 +271,7 @@ export default class CommonComponent extends Component { | ||
| 271 | const { sOnChangeInstruct } = this.props.showConfig; | 271 | const { sOnChangeInstruct } = this.props.showConfig; |
| 272 | const sInstruct = commonUtils.convertStrToObj(sOnChangeInstruct, {}); | 272 | const sInstruct = commonUtils.convertStrToObj(sOnChangeInstruct, {}); |
| 273 | if (sInstruct.blur) { | 273 | if (sInstruct.blur) { |
| 274 | - this.props.app.globalFun.onSetMask(true); | 274 | + this.props.app?.globalFun?.onSetMask(true); |
| 275 | } | 275 | } |
| 276 | } | 276 | } |
| 277 | clearTimeout(this.leaveTimer); | 277 | clearTimeout(this.leaveTimer); |
| @@ -310,7 +310,7 @@ export default class CommonComponent extends Component { | @@ -310,7 +310,7 @@ export default class CommonComponent extends Component { | ||
| 310 | onBlurText = (event, timeout = 0) => { | 310 | onBlurText = (event, timeout = 0) => { |
| 311 | const currentValue = event?.target?.value; | 311 | const currentValue = event?.target?.value; |
| 312 | if (currentValue == this.lastValue) { | 312 | if (currentValue == this.lastValue) { |
| 313 | - this.props.app.globalFun?.onSetMask(false); | 313 | + this.props.app?.globalFun?.onSetMask(false); |
| 314 | return; | 314 | return; |
| 315 | } | 315 | } |
| 316 | if (this.onExecInstructSet('blur')) { | 316 | if (this.onExecInstructSet('blur')) { |
| @@ -1649,6 +1649,7 @@ export default class CommonComponent extends Component { | @@ -1649,6 +1649,7 @@ export default class CommonComponent extends Component { | ||
| 1649 | if (this.props.bPassWord) { | 1649 | if (this.props.bPassWord) { |
| 1650 | obj.type = 'password'; /* 文本密码类型 */ | 1650 | obj.type = 'password'; /* 文本密码类型 */ |
| 1651 | obj.autocomplete = 'off'; /* 禁止浏览器自动填充到表单 */ | 1651 | obj.autocomplete = 'off'; /* 禁止浏览器自动填充到表单 */ |
| 1652 | + obj.value = this.props.dataValue | ||
| 1652 | } | 1653 | } |
| 1653 | /* 最大值最小值 */ | 1654 | /* 最大值最小值 */ |
| 1654 | if (typeof commonUtils.convertStrToNumber(this.max) === 'number' && commonUtils.convertStrToNumber(this.max) !== 0 && this.max.indexOf('.d') === -1 && this.max.indexOf('.i') === -1) { | 1655 | if (typeof commonUtils.convertStrToNumber(this.max) === 'number' && commonUtils.convertStrToNumber(this.max) !== 0 && this.max.indexOf('.d') === -1 && this.max.indexOf('.i') === -1) { |
| @@ -2958,10 +2959,10 @@ export default class CommonComponent extends Component { | @@ -2958,10 +2959,10 @@ export default class CommonComponent extends Component { | ||
| 2958 | } | 2959 | } |
| 2959 | /* 获取outformitem控件参数 */ | 2960 | /* 获取outformitem控件参数 */ |
| 2960 | const outFormItemProps = this.getOutFormItemProps(); | 2961 | const outFormItemProps = this.getOutFormItemProps(); |
| 2962 | + | ||
| 2961 | /* 获取fieldDecorator参数 */ | 2963 | /* 获取fieldDecorator参数 */ |
| 2962 | const fieldDecoratorProps = this.getFieldDecoratorProps(); | 2964 | const fieldDecoratorProps = this.getFieldDecoratorProps(); |
| 2963 | /* 通用组件(主表存在getFieldDecorator表单验证,而从表则不需要) */ | 2965 | /* 通用组件(主表存在getFieldDecorator表单验证,而从表则不需要) */ |
| 2964 | - | ||
| 2965 | const commonAssembly = this.props.bNewForm ? innerInput: ( | 2966 | const commonAssembly = this.props.bNewForm ? innerInput: ( |
| 2966 | <FormItem {...outFormItemProps}> | 2967 | <FormItem {...outFormItemProps}> |
| 2967 | {viewInfo} | 2968 | {viewInfo} |
src/mes/common/commonOperationBarComponent/MesToolbar.js
| 1 | +/* eslint-disable */ | ||
| 1 | import { message } from "antd"; | 2 | import { message } from "antd"; |
| 2 | import * as commonUtils from "@/utils/utils"; | 3 | import * as commonUtils from "@/utils/utils"; |
| 3 | 4 | ||
| @@ -46,21 +47,32 @@ const handleAdd = (props) => { | @@ -46,21 +47,32 @@ const handleAdd = (props) => { | ||
| 46 | return result; | 47 | return result; |
| 47 | }, []); | 48 | }, []); |
| 48 | 49 | ||
| 49 | - const menu = menuList.find(item => item.sId === sActiveId); | ||
| 50 | - if (!menu) { | ||
| 51 | - message.error('弹窗界面不在MES菜单中'); | ||
| 52 | - return; | ||
| 53 | - } | ||
| 54 | - | ||
| 55 | - app.globalFun.onChangeRouter({ | ||
| 56 | - type: "id", | ||
| 57 | - path: [menu.sParentId, menu.sId], | ||
| 58 | - sModelType: menu.sName, | ||
| 59 | - // sParentConditions, | ||
| 60 | - copyTo: { | ||
| 61 | - master: { maxBillNo: 'sBillNo' } | 50 | + // const menu = menuList.find(item => item.sId === sActiveId); |
| 51 | + // if (!menu) { | ||
| 52 | + // message.error('弹窗界面不在MES菜单中'); | ||
| 53 | + // return; | ||
| 54 | + // } | ||
| 55 | + props.onOpenCommonModal({ | ||
| 56 | + type: "commonModal", | ||
| 57 | + sActiveId, | ||
| 58 | + title: props?.btnConfig?.showName, | ||
| 59 | + parentProps: props, | ||
| 60 | + onOk: data => { | ||
| 61 | + window.debugger && console.log("=====onOk", data); | ||
| 62 | + }, | ||
| 63 | + onCancel: () => { | ||
| 64 | + window.debugger && console.log("=====onCancel"); | ||
| 62 | } | 65 | } |
| 63 | }); | 66 | }); |
| 67 | + // app.globalFun.onChangeRouter({ | ||
| 68 | + // type: "id", | ||
| 69 | + // path: [menu.sParentId, menu.sId], | ||
| 70 | + // sModelType: menu.sName, | ||
| 71 | + // // sParentConditions, | ||
| 72 | + // copyTo: { | ||
| 73 | + // master: { maxBillNo: 'sBillNo' } | ||
| 74 | + // } | ||
| 75 | + // }); | ||
| 64 | } | 76 | } |
| 65 | 77 | ||
| 66 | // 保存 | 78 | // 保存 |
src/mes/common/routerComponent/index.js
| @@ -66,7 +66,7 @@ const RouterComponent = props => { | @@ -66,7 +66,7 @@ const RouterComponent = props => { | ||
| 66 | ); | 66 | ); |
| 67 | 67 | ||
| 68 | const selectedType = Object.keys(types).find(type => | 68 | const selectedType = Object.keys(types).find(type => |
| 69 | - sModelType.includes(type) | 69 | + sModelType?.includes(type) |
| 70 | ); | 70 | ); |
| 71 | 71 | ||
| 72 | if (selectedType) { | 72 | if (selectedType) { |
src/mes/indexMes/index.js
| @@ -103,12 +103,11 @@ const OpenModalEditPwd = props => { | @@ -103,12 +103,11 @@ const OpenModalEditPwd = props => { | ||
| 103 | const oldPassword = commonFunc.showLocalMessage(props, 'oldPassword', '请输入原密码'); | 103 | const oldPassword = commonFunc.showLocalMessage(props, 'oldPassword', '请输入原密码'); |
| 104 | const newPassword = commonFunc.showLocalMessage(props, 'newPassword', '请输入新密码'); | 104 | const newPassword = commonFunc.showLocalMessage(props, 'newPassword', '请输入新密码'); |
| 105 | const passswordAgain = commonFunc.showLocalMessage(props, 'passswordAgain', '请再次输入密码'); | 105 | const passswordAgain = commonFunc.showLocalMessage(props, 'passswordAgain', '请再次输入密码'); |
| 106 | - const ModifyPassword = commonFunc.showLocalMessage(props, 'ModifyPassword','修改密码');/* 修改 */ | 106 | + const ModifyPassword = commonFunc.showLocalMessage(props, 'ModifyPassword', '修改密码');/* 修改 */ |
| 107 | // 确认修改密码 | 107 | // 确认修改密码 |
| 108 | const handleOk = () => { | 108 | const handleOk = () => { |
| 109 | - const url = `${ | ||
| 110 | - commonConfig.server_host | ||
| 111 | - }sftlogininfo/updatePasswordUserName/update?sModelsId=${100}`; | 109 | + const url = `${commonConfig.server_host |
| 110 | + }sftlogininfo/updatePasswordUserName/update?sModelsId=${100}`; | ||
| 112 | props.dispatch({ | 111 | props.dispatch({ |
| 113 | type: "app/editPwd", | 112 | type: "app/editPwd", |
| 114 | payload: { | 113 | payload: { |
| @@ -411,7 +410,6 @@ const IndexMes = baseProps => { | @@ -411,7 +410,6 @@ const IndexMes = baseProps => { | ||
| 411 | const handleColseOee = () => { | 410 | const handleColseOee = () => { |
| 412 | const { app, sModelsId } = props; | 411 | const { app, sModelsId } = props; |
| 413 | const { sId } = app.userinfo; | 412 | const { sId } = app.userinfo; |
| 414 | - | ||
| 415 | const iPlcNo = commonUtils.isNotEmptyObject(app.iPlcNo) | 413 | const iPlcNo = commonUtils.isNotEmptyObject(app.iPlcNo) |
| 416 | ? commonUtils.convertStrToNumber(app.iPlcNo) | 414 | ? commonUtils.convertStrToNumber(app.iPlcNo) |
| 417 | : 0; | 415 | : 0; |
| @@ -442,9 +440,8 @@ const IndexMes = baseProps => { | @@ -442,9 +440,8 @@ const IndexMes = baseProps => { | ||
| 442 | token, | 440 | token, |
| 443 | sModelsId | 441 | sModelsId |
| 444 | ) => { | 442 | ) => { |
| 445 | - const url = `${ | ||
| 446 | - commonConfig.server_host | ||
| 447 | - }procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`; | 443 | + const url = `${commonConfig.server_host |
| 444 | + }procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`; | ||
| 448 | const returnData = (await commonServices.postValueService( | 445 | const returnData = (await commonServices.postValueService( |
| 449 | token, | 446 | token, |
| 450 | value, | 447 | value, |
| @@ -461,16 +458,16 @@ const IndexMes = baseProps => { | @@ -461,16 +458,16 @@ const IndexMes = baseProps => { | ||
| 461 | }; | 458 | }; |
| 462 | const currentLanguage = props?.app?.userinfo?.sLanguage || 'zhCN'; // 默认为中文 | 459 | const currentLanguage = props?.app?.userinfo?.sLanguage || 'zhCN'; // 默认为中文 |
| 463 | const getLocale = () => { | 460 | const getLocale = () => { |
| 464 | - switch(currentLanguage) { | 461 | + switch (currentLanguage) { |
| 465 | case 'sEnglish': | 462 | case 'sEnglish': |
| 466 | return enUS; | 463 | return enUS; |
| 467 | case 'sBig5': | 464 | case 'sBig5': |
| 468 | return zhTW; | 465 | return zhTW; |
| 469 | default: | 466 | default: |
| 470 | - { | ||
| 471 | - moment.locale('zh-cn'); | ||
| 472 | - return zhCN; | ||
| 473 | - } | 467 | + { |
| 468 | + moment.locale('zh-cn'); | ||
| 469 | + return zhCN; | ||
| 470 | + } | ||
| 474 | } | 471 | } |
| 475 | }; | 472 | }; |
| 476 | const bExsitLogin = commonFunc.showLocalMessage(props, 'bExsitLogin', '是否退出登录'); | 473 | const bExsitLogin = commonFunc.showLocalMessage(props, 'bExsitLogin', '是否退出登录'); |
| @@ -522,7 +519,7 @@ const HeaderConponent = () => { | @@ -522,7 +519,7 @@ const HeaderConponent = () => { | ||
| 522 | const { sUserNameBak: sUserName, sShift } = userinfo; | 519 | const { sUserNameBak: sUserName, sShift } = userinfo; |
| 523 | const sLanguage = userinfo.sLanguage; | 520 | const sLanguage = userinfo.sLanguage; |
| 524 | let weekday = ["日", "一", "二", "三", "四", "五", "六"]; | 521 | let weekday = ["日", "一", "二", "三", "四", "五", "六"]; |
| 525 | - const sunTitle = sLanguage ==='sChinese' ? '星期' : ''; | 522 | + const sunTitle = sLanguage === 'sChinese' ? '星期' : ''; |
| 526 | const [time, setTime] = useState("0000-00-00 00:00:00"); | 523 | const [time, setTime] = useState("0000-00-00 00:00:00"); |
| 527 | const { logout } = useContext(myContext); | 524 | const { logout } = useContext(myContext); |
| 528 | useEffect(() => { | 525 | useEffect(() => { |
| @@ -544,8 +541,8 @@ const HeaderConponent = () => { | @@ -544,8 +541,8 @@ const HeaderConponent = () => { | ||
| 544 | 541 | ||
| 545 | 542 | ||
| 546 | const logoTitle = commonFunc.showLocalMessage(props, 'EBC-MES', '小羚羊生产执行系统'); | 543 | const logoTitle = commonFunc.showLocalMessage(props, 'EBC-MES', '小羚羊生产执行系统'); |
| 547 | - const account= commonFunc.showLocalMessage(props, 'account', '账号'); | ||
| 548 | - const machine= commonFunc.showLocalMessage(props, 'machine', '机台'); | 544 | + const account = commonFunc.showLocalMessage(props, 'account', '账号'); |
| 545 | + const machine = commonFunc.showLocalMessage(props, 'machine', '机台'); | ||
| 549 | const classGroup = commonFunc.showLocalMessage(props, 'classGroup', '班组'); | 546 | const classGroup = commonFunc.showLocalMessage(props, 'classGroup', '班组'); |
| 550 | const dayShift = commonFunc.showLocalMessage(props, 'dayShift', '白班'); | 547 | const dayShift = commonFunc.showLocalMessage(props, 'dayShift', '白班'); |
| 551 | const nightShift = commonFunc.showLocalMessage(props, 'nightShift', '夜班'); | 548 | const nightShift = commonFunc.showLocalMessage(props, 'nightShift', '夜班'); |
| @@ -628,19 +625,19 @@ const HeaderConponent = () => { | @@ -628,19 +625,19 @@ const HeaderConponent = () => { | ||
| 628 | // 左侧侧边栏 | 625 | // 左侧侧边栏 |
| 629 | const SiderComponent = () => { | 626 | const SiderComponent = () => { |
| 630 | const { dispatch, hooksProps, props, ...rest } = useContext(myContext); | 627 | const { dispatch, hooksProps, props, ...rest } = useContext(myContext); |
| 631 | - const { currentContent, menuMap } = hooksProps; | 628 | + const { currentContent, menuMap, menuMapOpposite } = hooksProps; |
| 632 | 629 | ||
| 633 | - const teamInformation= commonFunc.showLocalMessage(props, 'teamInformation', '班组信息'); | 630 | + const teamInformation = commonFunc.showLocalMessage(props, 'teamInformation', '班组信息'); |
| 634 | 631 | ||
| 635 | - const scheduledTask= commonFunc.showLocalMessage(props, 'scheduledTask', '计划任务'); | 632 | + const scheduledTask = commonFunc.showLocalMessage(props, 'scheduledTask', '计划任务'); |
| 636 | 633 | ||
| 637 | - const productionExecution= commonFunc.showLocalMessage(props, 'productionExecution', '生产执行'); | 634 | + const productionExecution = commonFunc.showLocalMessage(props, 'productionExecution', '生产执行'); |
| 638 | 635 | ||
| 639 | - const maintenanceRepair= commonFunc.showLocalMessage(props, 'maintenanceRepair', '维修保养'); | 636 | + const maintenanceRepair = commonFunc.showLocalMessage(props, 'maintenanceRepair', '维修保养'); |
| 640 | 637 | ||
| 641 | - const queryTracing= commonFunc.showLocalMessage(props, 'queryTracing', '查询追踪'); | 638 | + const queryTracing = commonFunc.showLocalMessage(props, 'queryTracing', '查询追踪'); |
| 642 | 639 | ||
| 643 | - const operationGuide= commonFunc.showLocalMessage(props, 'teamInformation', '操作指南'); | 640 | + const operationGuide = commonFunc.showLocalMessage(props, 'teamInformation', '操作指南'); |
| 644 | 641 | ||
| 645 | const menuList = [ | 642 | const menuList = [ |
| 646 | { | 643 | { |
| @@ -686,12 +683,24 @@ const SiderComponent = () => { | @@ -686,12 +683,24 @@ const SiderComponent = () => { | ||
| 686 | c_icon: c_guideIcon | 683 | c_icon: c_guideIcon |
| 687 | } | 684 | } |
| 688 | ]; | 685 | ]; |
| 686 | + const allowedIds = new Set(Object.values(menuMapOpposite)); | ||
| 687 | + const filteredMenuList = [ | ||
| 688 | + ...menuList.filter(item => allowedIds.has(item.id)), | ||
| 689 | + { | ||
| 690 | + id: "operationGuide", | ||
| 691 | + title: operationGuide, | ||
| 692 | + path: "/indexMes/operationGuide", | ||
| 693 | + icon: guideIcon, | ||
| 694 | + c_icon: c_guideIcon | ||
| 695 | + } | ||
| 696 | + ]; | ||
| 697 | + console.log(filteredMenuList, 'menuList'); | ||
| 689 | 698 | ||
| 690 | let [hoverState, setHoverState] = useState(null); | 699 | let [hoverState, setHoverState] = useState(null); |
| 691 | 700 | ||
| 692 | return ( | 701 | return ( |
| 693 | <div className="sider"> | 702 | <div className="sider"> |
| 694 | - {menuList.map(item => ( | 703 | + {filteredMenuList.map(item => ( |
| 695 | <div | 704 | <div |
| 696 | className={`menu ${item.id === currentContent ? "checked" : ""}`} | 705 | className={`menu ${item.id === currentContent ? "checked" : ""}`} |
| 697 | key={item.id} | 706 | key={item.id} |
| @@ -820,9 +829,8 @@ const SystemFunComponent = () => { | @@ -820,9 +829,8 @@ const SystemFunComponent = () => { | ||
| 820 | value.iFlag = iFlag; | 829 | value.iFlag = iFlag; |
| 821 | } | 830 | } |
| 822 | 831 | ||
| 823 | - const url = `${ | ||
| 824 | - commonConfig.server_host | ||
| 825 | - }procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`; | 832 | + const url = `${commonConfig.server_host |
| 833 | + }procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`; | ||
| 826 | const returnData = (await commonServices.postValueService( | 834 | const returnData = (await commonServices.postValueService( |
| 827 | token, | 835 | token, |
| 828 | value, | 836 | value, |
| @@ -839,7 +847,7 @@ const SystemFunComponent = () => { | @@ -839,7 +847,7 @@ const SystemFunComponent = () => { | ||
| 839 | onOk() { | 847 | onOk() { |
| 840 | handleProcedureCall(params, 1); | 848 | handleProcedureCall(params, 1); |
| 841 | }, | 849 | }, |
| 842 | - onCancel() {} | 850 | + onCancel() { } |
| 843 | }); | 851 | }); |
| 844 | } else if (code === -8) { | 852 | } else if (code === -8) { |
| 845 | Modal.info({ | 853 | Modal.info({ |
| @@ -896,9 +904,8 @@ const SystemFunComponent = () => { | @@ -896,9 +904,8 @@ const SystemFunComponent = () => { | ||
| 896 | value.iFlag = iFlag; | 904 | value.iFlag = iFlag; |
| 897 | } | 905 | } |
| 898 | 906 | ||
| 899 | - const url = `${ | ||
| 900 | - commonConfig.server_host | ||
| 901 | - }procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`; | 907 | + const url = `${commonConfig.server_host |
| 908 | + }procedureCall/doGenericProcedureCall?sModelsId=${sModelsId}`; | ||
| 902 | const returnData = (await commonServices.postValueService( | 909 | const returnData = (await commonServices.postValueService( |
| 903 | token, | 910 | token, |
| 904 | value, | 911 | value, |
| @@ -915,7 +922,7 @@ const SystemFunComponent = () => { | @@ -915,7 +922,7 @@ const SystemFunComponent = () => { | ||
| 915 | onOk() { | 922 | onOk() { |
| 916 | handleProcedureCall1(params, 1); | 923 | handleProcedureCall1(params, 1); |
| 917 | }, | 924 | }, |
| 918 | - onCancel() {} | 925 | + onCancel() { } |
| 919 | }); | 926 | }); |
| 920 | } else if (code === -8) { | 927 | } else if (code === -8) { |
| 921 | Modal.info({ | 928 | Modal.info({ |
| @@ -973,14 +980,14 @@ const SystemFunComponent = () => { | @@ -973,14 +980,14 @@ const SystemFunComponent = () => { | ||
| 973 | 980 | ||
| 974 | const getSystemFunContent = () => { | 981 | const getSystemFunContent = () => { |
| 975 | const userinfo = commonUtils.getAppData("userinfo"); | 982 | const userinfo = commonUtils.getAppData("userinfo"); |
| 976 | - const ModifyPassword = commonFunc.showLocalMessage(props, 'ModifyPassword','修改密码');/* 修改密码 */ | 983 | + const ModifyPassword = commonFunc.showLocalMessage(props, 'ModifyPassword', '修改密码');/* 修改密码 */ |
| 977 | const faceCollection = commonFunc.showLocalMessage(props, 'faceCollection', '人脸采集'); | 984 | const faceCollection = commonFunc.showLocalMessage(props, 'faceCollection', '人脸采集'); |
| 978 | const moreFunctions = commonFunc.showLocalMessage(props, 'moreFunctions', '更多功能'); | 985 | const moreFunctions = commonFunc.showLocalMessage(props, 'moreFunctions', '更多功能'); |
| 979 | const Logout = commonFunc.showLocalMessage(props, 'Logout', '退出登录'); | 986 | const Logout = commonFunc.showLocalMessage(props, 'Logout', '退出登录'); |
| 980 | - const shutDown= commonFunc.showLocalMessage(props, 'shutDown', '关机'); | ||
| 981 | - const resetDailyReport= commonFunc.showLocalMessage(props, 'resetDailyReport', '关机'); | ||
| 982 | - const switchToManual= commonFunc.showLocalMessage(props, 'switchToManual', '切换手动'); | ||
| 983 | - const SwitchAuto= commonFunc.showLocalMessage(props, 'SwitchAuto', '切换自动'); | 987 | + const shutDown = commonFunc.showLocalMessage(props, 'shutDown', '关机'); |
| 988 | + const resetDailyReport = commonFunc.showLocalMessage(props, 'resetDailyReport', '关机'); | ||
| 989 | + const switchToManual = commonFunc.showLocalMessage(props, 'switchToManual', '切换手动'); | ||
| 990 | + const SwitchAuto = commonFunc.showLocalMessage(props, 'SwitchAuto', '切换自动'); | ||
| 984 | 991 | ||
| 985 | 992 | ||
| 986 | const { bPlcSd } = userinfo; | 993 | const { bPlcSd } = userinfo; |
src/mes/login/index.js
| 1 | -import React, { useEffect, useState } from "react"; | 1 | +import React, { useEffect, useState, useMemo, useRef } from "react"; |
| 2 | import { cloneDeep } from "lodash"; | 2 | import { cloneDeep } from "lodash"; |
| 3 | import { Form, Button, message } from "antd"; | 3 | import { Form, Button, message } from "antd"; |
| 4 | 4 | ||
| @@ -29,18 +29,20 @@ const useLoginEvent = props => { | @@ -29,18 +29,20 @@ const useLoginEvent = props => { | ||
| 29 | payload: {} | 29 | payload: {} |
| 30 | }); | 30 | }); |
| 31 | sessionStorage.clear(); | 31 | sessionStorage.clear(); |
| 32 | + // localStorage.clear(); | ||
| 33 | + const masterValue = localStorage.getItem(`${commonConfig.prefix}masterData`); | ||
| 32 | localStorage.clear(); | 34 | localStorage.clear(); |
| 35 | + localStorage.setItem(`${commonConfig.prefix}masterData`, masterValue); | ||
| 36 | + | ||
| 33 | ipAddress && localStorage.setItem("ipAddress", ipAddress); | 37 | ipAddress && localStorage.setItem("ipAddress", ipAddress); |
| 34 | tempFaceData && localStorage.setItem("tempFaceData", tempFaceData); | 38 | tempFaceData && localStorage.setItem("tempFaceData", tempFaceData); |
| 35 | }, []); | 39 | }, []); |
| 36 | - | ||
| 37 | // 获取登录配置 | 40 | // 获取登录配置 |
| 38 | const [loginConfig, setLoginConfig] = useState([]); | 41 | const [loginConfig, setLoginConfig] = useState([]); |
| 39 | useEffect(async () => { | 42 | useEffect(async () => { |
| 40 | const { sModelsId } = initValue; | 43 | const { sModelsId } = initValue; |
| 41 | - const configUrl = `${ | ||
| 42 | - commonConfig.server_host | ||
| 43 | - }business/getModelBysId/${sModelsId}?sModelsId=${sModelsId}&sName=/commonAuto`; | 44 | + const configUrl = `${commonConfig.server_host |
| 45 | + }business/getModelBysId/${sModelsId}?sModelsId=${sModelsId}&sName=/commonAuto`; | ||
| 44 | const configReturn = (await commonServices.getService("", configUrl)).data; | 46 | const configReturn = (await commonServices.getService("", configUrl)).data; |
| 45 | if (configReturn.code === 1) { | 47 | if (configReturn.code === 1) { |
| 46 | const dataReturn = configReturn.dataset.rows; | 48 | const dataReturn = configReturn.dataset.rows; |
| @@ -78,9 +80,8 @@ const useLoginEvent = props => { | @@ -78,9 +80,8 @@ const useLoginEvent = props => { | ||
| 78 | 80 | ||
| 79 | // 获取公司信息 | 81 | // 获取公司信息 |
| 80 | useEffect(async () => { | 82 | useEffect(async () => { |
| 81 | - const companysConfigUrl = `${ | ||
| 82 | - commonConfig.server_host | ||
| 83 | - }sysbrands/getSysbrands`; | 83 | + const companysConfigUrl = `${commonConfig.server_host |
| 84 | + }sysbrands/getSysbrands`; | ||
| 84 | const companysConfigReturn = (await commonServices.getService( | 85 | const companysConfigReturn = (await commonServices.getService( |
| 85 | null, | 86 | null, |
| 86 | companysConfigUrl | 87 | companysConfigUrl |
| @@ -108,9 +109,8 @@ const useLoginEvent = props => { | @@ -108,9 +109,8 @@ const useLoginEvent = props => { | ||
| 108 | 109 | ||
| 109 | // 获取开工人员信息 | 110 | // 获取开工人员信息 |
| 110 | const handleGetTeamEmployee = async (sTeamId, token) => { | 111 | const handleGetTeamEmployee = async (sTeamId, token) => { |
| 111 | - const url = `${ | ||
| 112 | - commonConfig.server_host | ||
| 113 | - }oee/getTeamEmployee/${sTeamId}?sModelsId=100`; | 112 | + const url = `${commonConfig.server_host |
| 113 | + }oee/getTeamEmployee/${sTeamId}?sModelsId=100`; | ||
| 114 | const dataReturn = (await commonServices.getService(token, url)).data; | 114 | const dataReturn = (await commonServices.getService(token, url)).data; |
| 115 | if (dataReturn.code === 1) { | 115 | if (dataReturn.code === 1) { |
| 116 | const returnData = dataReturn.dataset.rows; | 116 | const returnData = dataReturn.dataset.rows; |
| @@ -134,29 +134,42 @@ const useLoginEvent = props => { | @@ -134,29 +134,42 @@ const useLoginEvent = props => { | ||
| 134 | // 登录事件 | 134 | // 登录事件 |
| 135 | const handleSubmit = async ({ faceLoginValue = {}, sEmployeeNo } = {}, configsData) => { | 135 | const handleSubmit = async ({ faceLoginValue = {}, sEmployeeNo } = {}, configsData) => { |
| 136 | const bFaceLogin = commonUtils.isNotEmptyObject(faceLoginValue); | 136 | const bFaceLogin = commonUtils.isNotEmptyObject(faceLoginValue); |
| 137 | - | 137 | + let masterNewData = {} |
| 138 | let dataReturn = {}; | 138 | let dataReturn = {}; |
| 139 | if (!bFaceLogin) { | 139 | if (!bFaceLogin) { |
| 140 | // 账号密码登录 | 140 | // 账号密码登录 |
| 141 | const { masterData, companys } = props; | 141 | const { masterData, companys } = props; |
| 142 | + const masterLocal = commonUtils.convertStrToObj( | ||
| 143 | + localStorage.getItem(`${commonConfig.prefix}masterData`) | ||
| 144 | + ) | ||
| 145 | + if (masterLocal) { | ||
| 146 | + masterNewData = { | ||
| 147 | + ...masterLocal, | ||
| 148 | + ...masterData, | ||
| 149 | + } | ||
| 150 | + }else { | ||
| 151 | + masterNewData = { | ||
| 152 | + ...masterData | ||
| 153 | + } | ||
| 154 | + } | ||
| 142 | // 新增方法:根据sName过滤configs | 155 | // 新增方法:根据sName过滤configs |
| 143 | const getConfigByName = (name, configs, sLanguage) => { | 156 | const getConfigByName = (name, configs, sLanguage) => { |
| 144 | const configObj = configs?.find(item => item.sName === name) || {}; | 157 | const configObj = configs?.find(item => item.sName === name) || {}; |
| 145 | - const showName = sLanguage === 'sChinese' ? configObj.sChinese : sLanguage ==='sEnglish' ? configObj.sEnglish : | 158 | + const showName = sLanguage === 'sChinese' ? configObj.sChinese : sLanguage === 'sEnglish' ? configObj.sEnglish : |
| 146 | sLanguage === 'sBig5' ? configObj.sBig5 : configObj.sChinese; | 159 | sLanguage === 'sBig5' ? configObj.sBig5 : configObj.sChinese; |
| 147 | return showName; | 160 | return showName; |
| 148 | }; | 161 | }; |
| 149 | const sLanguage = commonUtils.isNotEmptyArr(companys) ? companys[0].sLanguage : 'sEnglish'; | 162 | const sLanguage = commonUtils.isNotEmptyArr(companys) ? companys[0].sLanguage : 'sEnglish'; |
| 150 | 163 | ||
| 151 | - const pleaseSelectUser = getConfigByName('pleaseSelectUser', configsData, sLanguage); | 164 | + const pleaseSelectUser = getConfigByName('pleaseSelectUser', configsData, sLanguage); |
| 152 | 165 | ||
| 153 | - const pleaseInputPassword = getConfigByName('pleaseInputPassword', configsData, sLanguage); | 166 | + const pleaseInputPassword = getConfigByName('pleaseInputPassword', configsData, sLanguage); |
| 154 | 167 | ||
| 155 | - const pleaseSelectTeam = getConfigByName('pleaseSelectTeam', configsData, sLanguage); | 168 | + const pleaseSelectTeam = getConfigByName('pleaseSelectTeam', configsData, sLanguage); |
| 156 | 169 | ||
| 157 | - const pleaseselectShift = getConfigByName('pleaseselectShift', configsData, sLanguage); | 170 | + const pleaseselectShift = getConfigByName('pleaseselectShift', configsData, sLanguage); |
| 158 | 171 | ||
| 159 | - const pleaseSelectMachine = getConfigByName('pleaseSelectMachine', configsData, sLanguage); | 172 | + const pleaseSelectMachine = getConfigByName('pleaseSelectMachine', configsData, sLanguage); |
| 160 | 173 | ||
| 161 | 174 | ||
| 162 | const { | 175 | const { |
| @@ -172,7 +185,7 @@ const useLoginEvent = props => { | @@ -172,7 +185,7 @@ const useLoginEvent = props => { | ||
| 172 | sMachineName, | 185 | sMachineName, |
| 173 | iPlcNo, | 186 | iPlcNo, |
| 174 | sShift | 187 | sShift |
| 175 | - } = masterData; | 188 | + } = masterNewData; |
| 176 | 189 | ||
| 177 | const value = { | 190 | const value = { |
| 178 | userId, | 191 | userId, |
| @@ -215,17 +228,15 @@ const useLoginEvent = props => { | @@ -215,17 +228,15 @@ const useLoginEvent = props => { | ||
| 215 | return; | 228 | return; |
| 216 | } | 229 | } |
| 217 | 230 | ||
| 218 | - const url = `${ | ||
| 219 | - commonConfig.server_host | ||
| 220 | - }userOeelogin/${sParentId}/${sId}/${sTeamId}/${sMachineId}`; | 231 | + const url = `${commonConfig.server_host |
| 232 | + }userOeelogin/${sParentId}/${sId}/${sTeamId}/${sMachineId}`; | ||
| 221 | dataReturn = (await commonServices.postValueService(null, value, url)) | 233 | dataReturn = (await commonServices.postValueService(null, value, url)) |
| 222 | .data; | 234 | .data; |
| 223 | } else { | 235 | } else { |
| 224 | // 人脸登录 | 236 | // 人脸登录 |
| 225 | const { sBrandsId, sSubsidiaryId, sEmployeeNo } = faceLoginValue; | 237 | const { sBrandsId, sSubsidiaryId, sEmployeeNo } = faceLoginValue; |
| 226 | - const url = `${ | ||
| 227 | - commonConfig.server_host | ||
| 228 | - }userOeelogin/${sBrandsId}/${sSubsidiaryId}`; | 238 | + const url = `${commonConfig.server_host |
| 239 | + }userOeelogin/${sBrandsId}/${sSubsidiaryId}`; | ||
| 229 | const value = { sEmployeeNo, sParentId: sBrandsId, sId: sSubsidiaryId }; | 240 | const value = { sEmployeeNo, sParentId: sBrandsId, sId: sSubsidiaryId }; |
| 230 | dataReturn = (await commonServices.postValueService(null, value, url)) | 241 | dataReturn = (await commonServices.postValueService(null, value, url)) |
| 231 | .data; | 242 | .data; |
| @@ -306,6 +317,11 @@ const useLoginEvent = props => { | @@ -306,6 +317,11 @@ const useLoginEvent = props => { | ||
| 306 | `${commonConfig.prefix}statusData_${sMachineId}`, | 317 | `${commonConfig.prefix}statusData_${sMachineId}`, |
| 307 | JSON.stringify(statusData) | 318 | JSON.stringify(statusData) |
| 308 | ); | 319 | ); |
| 320 | + const { masterData = {} } = props; | ||
| 321 | + localStorage.setItem( | ||
| 322 | + `${commonConfig.prefix}masterData`, | ||
| 323 | + JSON.stringify(masterNewData) | ||
| 324 | + ) | ||
| 309 | 325 | ||
| 310 | handleUserlogin({ | 326 | handleUserlogin({ |
| 311 | token, | 327 | token, |
| @@ -346,7 +362,7 @@ const useLoginEvent = props => { | @@ -346,7 +362,7 @@ const useLoginEvent = props => { | ||
| 346 | 362 | ||
| 347 | return { | 363 | return { |
| 348 | ...props, | 364 | ...props, |
| 349 | - companys, // 确保返回companys | 365 | + companys, // 确保返回companys |
| 350 | configs, | 366 | configs, |
| 351 | onSubmit: handleSubmit, | 367 | onSubmit: handleSubmit, |
| 352 | onFaceLogin: handleFaceLogin, | 368 | onFaceLogin: handleFaceLogin, |
| @@ -359,9 +375,22 @@ const handleGetFormItem = (props, item) => { | @@ -359,9 +375,22 @@ const handleGetFormItem = (props, item) => { | ||
| 359 | 375 | ||
| 360 | const { sModelsId } = initValue; | 376 | const { sModelsId } = initValue; |
| 361 | const { masterData = {}, companys } = props; | 377 | const { masterData = {}, companys } = props; |
| 378 | + | ||
| 379 | + const userInfo = commonUtils.convertStrToObj( | ||
| 380 | + localStorage.getItem(`${commonConfig.prefix}masterData`) | ||
| 381 | + ); | ||
| 382 | + let masterNewData = masterData | ||
| 383 | + if (userInfo) { | ||
| 384 | + masterNewData = { | ||
| 385 | + ...userInfo, | ||
| 386 | + ...masterData, | ||
| 387 | + } | ||
| 388 | + } | ||
| 389 | + | ||
| 390 | + | ||
| 362 | const sLanguage = commonUtils.isNotEmptyArr(companys) && companys[0].sLanguage || 'sEnglish'; | 391 | const sLanguage = commonUtils.isNotEmptyArr(companys) && companys[0].sLanguage || 'sEnglish'; |
| 363 | let enabledNew = true; | 392 | let enabledNew = true; |
| 364 | - if(item.sName?.includes('please') || item.sName?.includes('请')) { | 393 | + if (item.sName?.includes('please') || item.sName?.includes('请')) { |
| 365 | return; | 394 | return; |
| 366 | } | 395 | } |
| 367 | if (item.iTag === 1) { | 396 | if (item.iTag === 1) { |
| @@ -369,10 +398,11 @@ const handleGetFormItem = (props, item) => { | @@ -369,10 +398,11 @@ const handleGetFormItem = (props, item) => { | ||
| 369 | } else if (item.iTag === 3) { | 398 | } else if (item.iTag === 3) { |
| 370 | enabledNew = true; | 399 | enabledNew = true; |
| 371 | } | 400 | } |
| 401 | + | ||
| 372 | const showTypeProps = { | 402 | const showTypeProps = { |
| 373 | bNewForm: true, | 403 | bNewForm: true, |
| 374 | iColValue: 24, | 404 | iColValue: 24, |
| 375 | - record: masterData, | 405 | + record: masterNewData, |
| 376 | name: "master", | 406 | name: "master", |
| 377 | formId: sModelsId, | 407 | formId: sModelsId, |
| 378 | getSqlDropDownData: props.getSqlDropDownData, | 408 | getSqlDropDownData: props.getSqlDropDownData, |
| @@ -397,7 +427,7 @@ const handleGetFormItem = (props, item) => { | @@ -397,7 +427,7 @@ const handleGetFormItem = (props, item) => { | ||
| 397 | formItemLayout: { labelCol: { span: 0 }, wrapperCol: { span: 24 } }, | 427 | formItemLayout: { labelCol: { span: 0 }, wrapperCol: { span: 24 } }, |
| 398 | textArea: false, | 428 | textArea: false, |
| 399 | enabled: enabledNew, | 429 | enabled: enabledNew, |
| 400 | - dataValue: masterData[item.sName], | 430 | + dataValue: masterNewData[item.sName], |
| 401 | bTable: item.sName !== "sPassWord", | 431 | bTable: item.sName !== "sPassWord", |
| 402 | bViewTable: true, | 432 | bViewTable: true, |
| 403 | onFilterDropDownData: props.onFilterDropDownData, | 433 | onFilterDropDownData: props.onFilterDropDownData, |
| @@ -405,7 +435,9 @@ const handleGetFormItem = (props, item) => { | @@ -405,7 +435,9 @@ const handleGetFormItem = (props, item) => { | ||
| 405 | bPassWord: item.sName === "sPassWord", | 435 | bPassWord: item.sName === "sPassWord", |
| 406 | style: { backgroundColor: "#eaeaea" } | 436 | style: { backgroundColor: "#eaeaea" } |
| 407 | }; | 437 | }; |
| 408 | - const showName = sLanguage === 'sChinese' ? item.sChinese : sLanguage ==='sEnglish' ? item.sEnglish | 438 | + console.log(showTypeProps, 'showTypeProps'); |
| 439 | + | ||
| 440 | + const showName = sLanguage === 'sChinese' ? item.sChinese : sLanguage === 'sEnglish' ? item.sEnglish | ||
| 409 | : item.sBig5; | 441 | : item.sBig5; |
| 410 | return ( | 442 | return ( |
| 411 | <Form.Item label={showName} key={item.sName}> | 443 | <Form.Item label={showName} key={item.sName}> |
| @@ -417,9 +449,8 @@ const handleGetFormItem = (props, item) => { | @@ -417,9 +449,8 @@ const handleGetFormItem = (props, item) => { | ||
| 417 | // 主入口 | 449 | // 主入口 |
| 418 | const login = baseProps => { | 450 | const login = baseProps => { |
| 419 | const props = useLoginEvent(useCommonBase(baseProps)); | 451 | const props = useLoginEvent(useCommonBase(baseProps)); |
| 420 | - const { configs , app, companys } = props; | ||
| 421 | - const sysObj = commonUtils.isNotEmptyArr(companys) ? companys[0] : []; | ||
| 422 | - console.log('222', sysObj); | 452 | + const { configs, app, companys } = props; |
| 453 | + const sysObj = commonUtils.isNotEmptyArr(companys) ? companys[0] : []; | ||
| 423 | const sLanguage = sysObj?.sLanguage || 'sEnglish'; | 454 | const sLanguage = sysObj?.sLanguage || 'sEnglish'; |
| 424 | 455 | ||
| 425 | const oeeTitle = | 456 | const oeeTitle = |
| @@ -464,7 +495,7 @@ const login = baseProps => { | @@ -464,7 +495,7 @@ const login = baseProps => { | ||
| 464 | : sLanguage === "sEnglish" | 495 | : sLanguage === "sEnglish" |
| 465 | ? "Close" | 496 | ? "Close" |
| 466 | : "關 閉"; /* 关 闭 */ | 497 | : "關 閉"; /* 关 闭 */ |
| 467 | - const btnFace = sLanguage === "sChinese"? "人 脸 登 录" : sLanguage === "sEnglish" ? "FaceLogin" : "人 臉 登 錄"; /* 人 脸 */ | 498 | + const btnFace = sLanguage === "sChinese" ? "人 脸 登 录" : sLanguage === "sEnglish" ? "FaceLogin" : "人 臉 登 錄"; /* 人 脸 */ |
| 468 | 499 | ||
| 469 | const btnNormal = | 500 | const btnNormal = |
| 470 | sLanguage === "sChinese" | 501 | sLanguage === "sChinese" |
| @@ -539,7 +570,7 @@ const FaceLoginModal = props => { | @@ -539,7 +570,7 @@ const FaceLoginModal = props => { | ||
| 539 | if (!faceLoginModalVisible) return ""; | 570 | if (!faceLoginModalVisible) return ""; |
| 540 | const { companys } = props; | 571 | const { companys } = props; |
| 541 | const sLanguage = commonUtils.isNotEmptyArr(companys) ? companys[0].sLanguage : 'English'; | 572 | const sLanguage = commonUtils.isNotEmptyArr(companys) ? companys[0].sLanguage : 'English'; |
| 542 | - const btnFace = sLanguage === "sChinese"? "人 脸 登 录" : sLanguage === "sEnglish" ? "FaceLogin" : "人 臉 登 錄"; /* 人 脸 */ | 573 | + const btnFace = sLanguage === "sChinese" ? "人 脸 登 录" : sLanguage === "sEnglish" ? "FaceLogin" : "人 臉 登 錄"; /* 人 脸 */ |
| 543 | 574 | ||
| 544 | return ( | 575 | return ( |
| 545 | <Modal | 576 | <Modal |
| @@ -571,13 +602,13 @@ const FaceLoginModal = props => { | @@ -571,13 +602,13 @@ const FaceLoginModal = props => { | ||
| 571 | 602 | ||
| 572 | // 人脸弹窗后选择其他内容 | 603 | // 人脸弹窗后选择其他内容 |
| 573 | const FaceLoginAfterModal = props => { | 604 | const FaceLoginAfterModal = props => { |
| 574 | - const { faceLoginAfterModalVisible , companys } = props; | 605 | + const { faceLoginAfterModalVisible, companys } = props; |
| 575 | 606 | ||
| 576 | if (!faceLoginAfterModalVisible) return ""; | 607 | if (!faceLoginAfterModalVisible) return ""; |
| 577 | const sLanguage = commonUtils.isNotEmptyArr(companys) ? companys[0].sLanguage : 'English'; | 608 | const sLanguage = commonUtils.isNotEmptyArr(companys) ? companys[0].sLanguage : 'English'; |
| 578 | - const sLoginConfirm = sLanguage === "sChinese"? "登陆信息确认" : sLanguage === "sEnglish" ? "Login Information Confirmation" : "登陸信息確認"; /* 人 脸 */ | ||
| 579 | - const btnConfirm = sLanguage === "sChinese"? "确认" : sLanguage === "sEnglish" ? "Confirm" : "確認"; /* 人 脸 */ | ||
| 580 | - const btnCancel = sLanguage === "sChinese"? "取消" : sLanguage === "sEnglish" ? "Cancel" : "取消"; /* 取消 */ | 609 | + const sLoginConfirm = sLanguage === "sChinese" ? "登陆信息确认" : sLanguage === "sEnglish" ? "Login Information Confirmation" : "登陸信息確認"; /* 人 脸 */ |
| 610 | + const btnConfirm = sLanguage === "sChinese" ? "确认" : sLanguage === "sEnglish" ? "Confirm" : "確認"; /* 人 脸 */ | ||
| 611 | + const btnCancel = sLanguage === "sChinese" ? "取消" : sLanguage === "sEnglish" ? "Cancel" : "取消"; /* 取消 */ | ||
| 581 | 612 | ||
| 582 | 613 | ||
| 583 | const { | 614 | const { |