| | |
| | | if (result.status) { |
| | | let config = '' |
| | | let shortcuts = [] |
| | | let _curUserConfig = '' |
| | | |
| | | try { // 配置信息解析 |
| | | config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | config.MenuID = this.props.MenuID |
| | | config.MenuName = MenuName |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | config = '' |
| | |
| | | if (result.LongParamUser && this.props.menuType !== 'HS') { |
| | | try { // 配置信息解析 |
| | | let userConfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParamUser))) |
| | | userConfig = [] |
| | | if (userConfig && !userConfig.version) { |
| | | Object.keys(userConfig).forEach(key => { |
| | | let component = userConfig[key] |
| | | |
| | | // if (window.GLOB.UserCacheMap.has(_param)) { |
| | | // return Promise.resolve(window.GLOB.UserCacheMap.get(_param)) |
| | | // } else { |
| | | // param = this.encryptParam(param) |
| | | // return new Promise(resolve => { |
| | | // axios({ |
| | | // url: `/webapi/dostars${param.func ? '/' + param.func : ''}`, |
| | | // data: param |
| | | // }).then(res => { |
| | | // if (res.status) { |
| | | // window.GLOB.UserCacheMap.set(_param, res) |
| | | // } |
| | | // resolve(res) |
| | | // }) |
| | | // }) |
| | | // } |
| | | _curUserConfig = userConfig[this.props.MenuID] |
| | | if (!component.action) return |
| | | |
| | | Object.keys(component.action).forEach(uuid => { |
| | | let item = {uuid: uuid, parentId: key, shortcut: component.action[uuid].shortcut} |
| | | let printer = component.action[uuid].printer |
| | | |
| | | if (item.shortcut) { |
| | | item.$shortcut = item.shortcut.join('+') |
| | | shortcuts.push(item) |
| | | } |
| | | if (printer) { |
| | | item.printer = printer.defaultPrinter || '' |
| | | item.printerList = printer.printerList || '' |
| | | window.GLOB.UserCacheMap.set(key + uuid, item) |
| | | } |
| | | }) |
| | | }) |
| | | } else if (userConfig) { |
| | | shortcuts = userConfig.action |
| | | userConfig.printers.forEach(item => { |
| | | window.GLOB.UserCacheMap.set(item.parentId + item.uuid, item) |
| | | }) |
| | | } |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | } |
| | | } |
| | | console.log(config) |
| | | console.log(shortcuts) |
| | | |
| | | // 页面配置解析错误时提示 |
| | | if (!config) { |
| | |
| | | } |
| | | } |
| | | |
| | | if (_curUserConfig) { |
| | | config.action = config.action.map(item => { |
| | | if (_curUserConfig.action[item.uuid]) { |
| | | delete _curUserConfig.action[item.uuid].label |
| | | item = {...item, ..._curUserConfig.action[item.uuid]} |
| | | } |
| | | |
| | | if (item.OpenType === 'funcbutton' && item.funcType === 'print' && item.verify && item.printer) { |
| | | item.verify.defaultPrinter = item.printer.defaultPrinter || '' |
| | | if (item.verify.printerTypeList && item.printer.printerList) { |
| | | item.verify.printerTypeList = item.verify.printerTypeList.map(cell => { |
| | | cell.printer = item.printer.printerList[cell.Value] || '' |
| | | |
| | | return cell |
| | | }) |
| | | } |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | let _arrField = [] // 字段集 |
| | | let _columns = [] // 显示列 |
| | | let _hideCol = [] // 隐藏及合并列中字段的uuid集 |
| | |
| | | config.action.forEach(item => { |
| | | item.logLabel = MenuName + '-' + item.label // 用于sPC_TableData_InUpDe记录操作按钮 |
| | | item.$menuId = this.props.MenuID |
| | | |
| | | if (item.OpenType === 'funcbutton' && item.funcType === 'print' && item.verify) { // 打印机设置 |
| | | let _item = window.GLOB.UserCacheMap.get(this.props.MenuID + item.uuid) |
| | | |
| | | if (_item) { |
| | | item.printer = _item.printer || '' |
| | | item.verify.defaultPrinter = _item.printer || '' |
| | | if (item.verify.printerTypeList && _item.printerList) { |
| | | item.verify.printerTypeList = item.verify.printerTypeList.map(cell => { |
| | | cell.printer = _item.printerList[cell.Value] || '' |
| | | |
| | | return cell |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (item.position === 'toolbar') { |
| | | _actions.push(item) |
| | |
| | | |
| | | if (!preKey || !keyCode) return |
| | | |
| | | let _shortcut = preKey + keyCode |
| | | let _shortcut = `${preKey}+${keyCode}` |
| | | |
| | | shortcuts.some(item => { |
| | | if (item.shortcut === _shortcut) { |
| | | if (item.$shortcut === _shortcut) { |
| | | MKEmitter.emit('triggerBtnId', item.uuid) |
| | | |
| | | let element = item.parentId ? document.getElementById(item.parentId) : '' // 标签切换 |
| | | let element = item.parentId && item.parentId !== this.props.MenuID ? document.getElementById(item.parentId) : '' // 标签切换 |
| | | if (element && element.click) { |
| | | element.click() |
| | | } |
| | |
| | | */ |
| | | reloadview = () => { |
| | | this.setState({ loadingview: true, viewlost: false, config: {}, setting: null, |
| | | data: null, total: 0, loading: false, pageIndex: 1, |
| | | data: null, total: 0, loading: false, pageIndex: 1, shortcuts: null, |
| | | pageSize: 10, orderBy: '', search: '', BIDs: {}, pickup: false |
| | | }, () => { |
| | | this.loadconfig() |
| | |
| | | |
| | | render() { |
| | | const { menuType } = this.props |
| | | const { BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, chartId, search, selectedData } = this.state |
| | | const { BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, chartId, search, selectedData, shortcuts } = this.state |
| | | |
| | | return ( |
| | | <div className="commontable" id={this.state.ContainerId}> |
| | | {loadingview && <Spin size="large" />} |
| | | {loadingview ? <Spin size="large" /> : null} |
| | | {searchlist && searchlist.length ? |
| | | <MainSearch BID={BID} searchlist={searchlist} menuType={this.props.menuType} refreshdata={this.refreshbysearch}/> : null |
| | | } |
| | |
| | | </Tabs>)) |
| | | } |
| | | {menuType !== 'HS' ? <PagemsgComponent menu={{MenuName: this.props.MenuName, MenuNo: this.props.MenuNo}} config={config} dict={this.state.dict} /> : null} |
| | | {menuType !== 'HS' ? <SettingComponent config={config} dict={this.state.dict} MenuID={this.props.MenuID} permAction={this.props.permAction}/> : null} |
| | | {menuType !== 'HS' && shortcuts ? <SettingComponent config={config} dict={this.state.dict} shortcuts={shortcuts} permAction={this.props.permAction}/> : null} |
| | | {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} |
| | | </div> |
| | | ) |