| | |
| | | defaultLang -- 默认打开的子应用语言类型,填入defaultApp时有效 |
| | | WXAppID -- 使用公众号时,绑定的公众号ID |
| | | debugger -- debugger模式是否开启,开启后移动端子应用中会有控制台 |
| | | licenseKey -- 许可密钥,在内部网络中使用系统时,会跳过epc验证 |
| | | licenseKey -- 许可密钥,在内部网络中使用系统时,会跳过epc验证 |
| | | probation -- 试用期(YYYY-MM-DD),在正式系统中,试用期内调用系统接口的脚本会记录下来 |
| | |
| | | "WXAppID": "", |
| | | "debugger": false, |
| | | "licenseKey": "E1A8FE", |
| | | "probation": "", |
| | | "host": "http://qingqiumarket.cn", |
| | | "service": "mkwms/" |
| | | } |
| | |
| | | import React, {Component} from 'react' |
| | | import {connect} from 'react-redux' |
| | | import { is, fromJS } from 'immutable' |
| | | import { BackTop, Breadcrumb, Icon, notification} from 'antd' |
| | | import moment from 'moment' |
| | | import 'moment/locale/zh-cn' |
| | |
| | | this.setState({tabview: home}) |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (nextProps.tabviews && !is(fromJS(this.state.tabviews), fromJS(nextProps.tabviews))) { |
| | | // 保存修改标签集 |
| | | this.setState({ |
| | | tabview: nextProps.tabviews[nextProps.tabviews.length - 1] |
| | | }) |
| | | modifyTabs = (tab, type) => { |
| | | if (!tab || type !== 'replace') return |
| | | |
| | | let node = document.getElementById('root').parentNode.parentNode |
| | | if (node) { |
| | | node.scrollTop = 0 |
| | | } |
| | | this.setState({ |
| | | tabview: tab, |
| | | }) |
| | | |
| | | let node = document.getElementById('root').parentNode.parentNode |
| | | if (node) { |
| | | node.scrollTop = 0 |
| | | } |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('modifyTabs', this.modifyTabs) |
| | | } |
| | | |
| | | /** |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('modifyTabs', this.modifyTabs) |
| | | } |
| | | |
| | | render () { |
| | |
| | | } |
| | | } |
| | | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | tabviews: state.tabviews |
| | | } |
| | | const mapStateToProps = () => { |
| | | return {} |
| | | } |
| | | |
| | | const mapDispatchToProps = (dispatch) => { |
| | |
| | | if (mainMenu === '') return (<span className="mk-side-menu-hidden"></span>) |
| | | |
| | | return ( |
| | | <aside id="mk-sidemenu-wrap" className={'mk-side-menu ant-menu-dark' + (this.props.collapse ? ' collapsed' : '') + (this.props.isiframe ? ' mk-iframe' : '')}> |
| | | <aside id="mk-sidemenu-wrap" className={'mk-side-menu ant-menu-dark' + (this.props.collapse ? ' collapsed' : '')}> |
| | | <Menu openKeys={this.state.openKeys} onOpenChange={this.onOpenChange} mode="inline" theme="dark" inlineCollapsed={this.props.collapse}> |
| | | {this.state.subMenulist && this.state.subMenulist.map((item) => { |
| | | return ( |
| | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | collapse: state.collapse, |
| | | isiframe: state.isiframe, |
| | | mainMenu: state.mainMenu, |
| | | menuTree: state.menuTree, |
| | | } |
| | | } |
| | | |
| | | const mapDispatchToProps = (dispatch) => { |
| | | const mapDispatchToProps = () => { |
| | | return {} |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | .mk-side-menu.mk-iframe { // tab页中为iframe时 |
| | | max-height: 100vh; |
| | | overflow-y: scroll; |
| | | &::-webkit-scrollbar { |
| | | display: none; |
| | | } |
| | | } |
| | | // .mk-side-menu.mk-iframe { // tab页中为iframe时 |
| | | // max-height: 100vh; |
| | | // overflow-y: scroll; |
| | | // &::-webkit-scrollbar { |
| | | // display: none; |
| | | // } |
| | | // } |
| | | .mk-side-menu.collapsed { // 左侧菜单合并时 |
| | | flex: 0 0 80px; |
| | | width: 80px; |
| | |
| | | import moment from 'moment' |
| | | import 'moment/locale/zh-cn' |
| | | |
| | | import { toggleIsiframe, initActionPermission } from '@/store/action' |
| | | import { initActionPermission } from '@/store/action' |
| | | import asyncComponent from '@/utils/asyncLoadComponent' |
| | | import NotFount from '@/components/404' |
| | | import options from '@/store/options.js' |
| | |
| | | |
| | | if (index > -1) { |
| | | let activeId = '' |
| | | if (index > 0) { |
| | | if (id !== this.state.activeId) { |
| | | activeId = this.state.activeId |
| | | } else if (index > 0) { |
| | | activeId = tabs[index - 1].MenuID || '' |
| | | } else if (tabs[index]) { |
| | | activeId = tabs[index].MenuID || '' |
| | |
| | | activeId, |
| | | tabviews: tabs |
| | | }) |
| | | |
| | | if (this.props.isiframe) { |
| | | this.props.toggleIsiframe(false) |
| | | } |
| | | |
| | | let node = document.getElementById('root').parentNode.parentNode |
| | | if (node) { |
| | |
| | | changeTab = (e, menu) => { |
| | | e.stopPropagation() |
| | | // 窗口切换 |
| | | let _isiframe = this.props.isiframe |
| | | if (menu.type === 'iframe') { |
| | | _isiframe = true |
| | | } else { |
| | | _isiframe = false |
| | | } |
| | | |
| | | if (_isiframe !== this.props.isiframe) { |
| | | this.props.toggleIsiframe(_isiframe) |
| | | } |
| | | |
| | | this.setState({ |
| | | activeId: menu.MenuID || '' |
| | |
| | | MKEmitter.addListener('closeTabView', this.closeTabView) |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | collapse: state.collapse, |
| | | isiframe: state.isiframe |
| | | } |
| | | } |
| | | |
| | | const mapDispatchToProps = (dispatch) => { |
| | | return { |
| | | initActionPermission: (permAction) => dispatch(initActionPermission(permAction)), |
| | | toggleIsiframe: (isiframe) => dispatch(toggleIsiframe(isiframe)) |
| | | initActionPermission: (permAction) => dispatch(initActionPermission(permAction)) |
| | | } |
| | | } |
| | | |
| | |
| | | GLOB.appId = config.appId || '' |
| | | GLOB.lineColor = config.lineColor || '' |
| | | GLOB.licenseKey = config.licenseKey || '' |
| | | GLOB.probation = false |
| | | |
| | | if (config.externalDatabase !== false && config.externalDatabase !== 'false' && config.externalDatabase !== undefined) { |
| | | GLOB.externalDatabase = config.externalDatabase ? `[${config.externalDatabase}]..` : '' |
| | |
| | | // 只有业务系统才可以设置为正式系统 |
| | | if (options.sysType === 'local' && (config.systemType === 'official' || config.systemType === 'production')) { |
| | | GLOB.systemType = 'production' |
| | | if (config.probation && /^20\d{2}-\d{2}-\d{2}$/.test(config.probation) && new Date(config.probation).getTime() > new Date().getTime()) { |
| | | GLOB.probation = true |
| | | } |
| | | } else { |
| | | GLOB.systemType = '' |
| | | } |
| | |
| | | type: 'number', |
| | | key: 'barHeight', |
| | | min: 5, |
| | | max: 50, |
| | | max: 500, |
| | | label: '高度', |
| | | initVal: card.barHeight || 25, |
| | | required: true, |
| | |
| | | type: 'number', |
| | | key: 'qrWidth', |
| | | min: 5, |
| | | max: 500, |
| | | max: 1000, |
| | | label: '宽度', |
| | | initVal: card.qrWidth || 50, |
| | | required: true, |
| | |
| | | |
| | | class ClockComponent extends Component { |
| | | static propTpyes = { |
| | | btnlog: PropTypes.array, |
| | | updateConfig: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | visible: false, |
| | | timer: '', |
| | | visible: false |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | } |
| | | |
| | | trigger = () => { |
| | | const { config } = this.props |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | timer: config.timer || '' |
| | | visible: true |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { visible, loading, timer } = this.state |
| | | const { config } = this.props |
| | | const { visible, loading } = this.state |
| | | |
| | | return ( |
| | | <div className="clock-component-wrap"> |
| | |
| | | onCancel={() => this.setState({ visible: false })} |
| | | destroyOnClose |
| | | > |
| | | <ClockForm timer={timer} inputSubmit={this.submit} wrappedComponentRef={(inst) => this.verifyRef = inst}/> |
| | | <ClockForm config={config} inputSubmit={this.submit} wrappedComponentRef={(inst) => this.verifyRef = inst}/> |
| | | </Modal> |
| | | </div> |
| | | ) |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Select } from 'antd' |
| | | import { Form, Row, Col, Select, Tooltip, Icon, Input } from 'antd' |
| | | |
| | | import './index.scss' |
| | | |
| | | class SettingForm extends Component { |
| | | static propTpyes = { |
| | | timer: PropTypes.string, // 组件名称 |
| | | inputSubmit: PropTypes.func // 回车事件 |
| | | config: PropTypes.string, |
| | | inputSubmit: PropTypes.func |
| | | } |
| | | |
| | | state = {} |
| | | state = { |
| | | clearField: this.props.config.clearField || '' |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | // 表单提交时检查输入值是否正确 |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { config } = this.props |
| | | const { clearField } = this.state |
| | | const { getFieldDecorator } = this.props.form |
| | | |
| | | const formItemLayout = { |
| | |
| | | <Col span={22}> |
| | | <Form.Item label="定时器"> |
| | | {getFieldDecorator('timer', { |
| | | initialValue: this.props.timer || '' |
| | | initialValue: config.timer || '' |
| | | })( |
| | | <Select> |
| | | <Select.Option value=""> 无 </Select.Option> |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | {config.subtype === 'balcony' || config.subtype === 'propcard' ? <Col span={22}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="可以指定字段用于控制定时器的关闭。"> |
| | | <Icon type="question-circle" style={{marginRight: '3px', color: '#c49f47'}} /> |
| | | 关闭定时 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('clearField', { |
| | | initialValue: clearField || '' |
| | | })( |
| | | <Select allowClear onChange={(val) => this.setState({clearField: val})}> |
| | | {config.columns.map(col => (<Select.Option key={col.uuid} value={col.field}>{col.label}</Select.Option>))} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {(config.subtype === 'balcony' || config.subtype === 'propcard') && clearField ? <Col span={22}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="当字段值与关闭值相等时,关闭定时器,多个值可用逗号分隔。"> |
| | | <Icon type="question-circle" style={{marginRight: '3px', color: '#c49f47'}} /> |
| | | 关闭值 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('clearValue', { |
| | | initialValue: config.clearValue || '' |
| | | })(<Input placeholder="" autoComplete="off" onPressEnter={this.props.inputSubmit}/>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | </Row> |
| | | </Form> |
| | | </div> |
| | |
| | | // 展开合并菜单栏 |
| | | export const Toggle_COLLAPSE = 'Toggle_COLLAPSE' |
| | | |
| | | // 修改窗口样式,区分iframe与正常页面 |
| | | export const TOGGLE_ISIFRAME = 'TOGGLE_ISIFRAME' |
| | | |
| | | // 刷新tab页面 |
| | | export const REFRESH_TABVIEW = 'REFRESH_TABVIEW' |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | // 修改窗口样式,区分iframe与正常页面 |
| | | export const toggleIsiframe = (isiframe) => { |
| | | return { |
| | | type: user.TOGGLE_ISIFRAME, |
| | | isiframe |
| | | } |
| | | } |
| | | |
| | | // 重置编辑级别 |
| | | export const resetEditLevel = (editLevel) => { |
| | | return { |
| | |
| | | menuTree: null, // 菜单结构树 |
| | | mainMenu: _mainMenu, // 已选主菜单 |
| | | collapse: _collapse, // 是否收起侧边栏导航 |
| | | isiframe: false, // 是否为iframe窗口 |
| | | editLevel: null, // 编辑菜单级别,值为level1、level2、level3、HS |
| | | permAction: {}, // 用户按钮权限 |
| | | permMenus: [], // 用户三级菜单列表 |
| | |
| | | return { |
| | | ...state, |
| | | mainMenu: action.mainMenu |
| | | } |
| | | case Type.TOGGLE_ISIFRAME: |
| | | // 切换是否为iframe状态 |
| | | return { |
| | | ...state, |
| | | isiframe: action.isiframe |
| | | } |
| | | case Type.RESET_EDITLEVEL: |
| | | // 重置编辑级别 |
| | |
| | | menuTree: null, |
| | | mainMenu: null, |
| | | collapse: localStorage.getItem('collapse') === 'true', |
| | | isiframe: false, |
| | | editLevel: null, |
| | | permAction: {}, |
| | | permMenus: [], |
| | |
| | | this.loadconfig() |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | if (!is(fromJS(this.props.tabviews), fromJS(nextProps.tabviews))) { |
| | | let selectTab = nextProps.tabviews.filter(tab => tab.selected)[0] |
| | | if (selectTab && selectTab.MenuID === this.props.MenuID) { |
| | | this.setShortcut() |
| | | } |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | menuType: state.editLevel, |
| | | tabviews: state.tabviews, |
| | | permAction: state.permAction, |
| | | permMenus: state.permMenus |
| | | } |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Spin, notification, Checkbox } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import MKEmitter from '@/utils/events.js' |
| | |
| | | MKEmitter.addListener('syncBalconyData', this.syncBalconyData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | this.handleTimer() |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | } |
| | | |
| | | componentWillUnmount () { |
| | | clearTimeout(this.timer) |
| | | this.setState = () => { |
| | | return |
| | | } |
| | |
| | | |
| | | this.setState({sync: false, data: _data}) |
| | | } |
| | | } |
| | | |
| | | handleTimer = () => { |
| | | const { config } = this.state |
| | | |
| | | if (!config.timer) return |
| | | |
| | | const _change = { '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } |
| | | |
| | | let timer = _change[config.timer] |
| | | |
| | | if (!timer) return |
| | | |
| | | let _param = { |
| | | func: 's_get_timers_role', |
| | | LText: `select '${window.GLOB.appkey || ''}','${config.uuid}'`, |
| | | timer_type: config.timer, |
| | | component_id: config.uuid |
| | | } |
| | | |
| | | _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') // 时间戳 |
| | | _param.LText = Utils.formatOptions(_param.LText) // 关键字符替换,base64加密 |
| | | _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) // md5密钥 |
| | | |
| | | Api.getSystemConfig(_param).then(result => { |
| | | if (!result.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (result.run_type) { |
| | | this.setState({timer}) |
| | | this.timer = setTimeout(() => { |
| | | this.timerTask() |
| | | }, timer) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | timerTask = () => { |
| | | const { timer } = this.state |
| | | if (!timer) return |
| | | |
| | | this.loadData(true) |
| | | |
| | | this.timer = setTimeout(() => { |
| | | this.timerTask() |
| | | }, timer) |
| | | } |
| | | |
| | | /** |
| | |
| | | this.loadData() |
| | | } |
| | | |
| | | async loadData () { |
| | | async loadData (hastimer) { |
| | | const { menuType } = this.props |
| | | const { config, arr_field, BID, BData } = this.state |
| | | |
| | |
| | | |
| | | let searches = [] |
| | | |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | if (!hastimer) { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | } |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, 1, BID, menuType) |
| | |
| | | data: _data, |
| | | loading: false |
| | | }) |
| | | |
| | | if (config.timer && config.clearField) { |
| | | let vals = (config.clearValue || '').split(',') |
| | | if (vals.includes(_data[config.clearField])) { |
| | | clearTimeout(this.timer) |
| | | } |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false, |
| | |
| | | data: _data, |
| | | loading: false |
| | | }) |
| | | |
| | | if (config.timer && config.clearField) { |
| | | let vals = (config.clearValue || '').split(',') |
| | | if (vals.includes(_data[config.clearField])) { |
| | | clearTimeout(this.timer) |
| | | } |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false, |
| | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | menuType: state.editLevel, |
| | | tabviews: state.tabviews, |
| | | permAction: state.permAction, |
| | | permMenus: state.permMenus |
| | | } |
| | |
| | | |
| | | param.menuname = btn.logLabel |
| | | |
| | | if (window.GLOB.probation) { |
| | | param.s_debug_type = 'Y' |
| | | } |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | | if (res.status) { |
| | | this.execSuccess(res) |
| | |
| | | param.exec_type = 'y' // 后台解码 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.LText = Utils.formatOptions(script) |
| | | |
| | | if (this.props.menuType === 'HS') { // 函数 sPC_TableData_InUpDe 云端验证 |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | } |
| | | |
| | | if (window.GLOB.probation) { |
| | | param.s_debug_type = 'Y' |
| | | } |
| | | |
| | | Api.genericInterface(param).then((res) => { |
| | | if (res.status) { |
| | | this.execSuccess({ErrCode: 'S', ErrMesg: '导出成功!'}) |
| | |
| | | |
| | | param.menuname = btn.logLabel |
| | | |
| | | if (window.GLOB.probation) { |
| | | param.s_debug_type = 'Y' |
| | | } |
| | | |
| | | if (check_param) { |
| | | check_param.menuname = btn.logLabel |
| | | this.setState({checkParam: check_param}) |
| | |
| | | |
| | | if (param.func === 'sPC_TableData_InUpDe') { |
| | | param.menuname = btn.logLabel |
| | | if (window.GLOB.probation) { |
| | | param.s_debug_type = 'Y' |
| | | } |
| | | } |
| | | |
| | | return param |
| | |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.menuname = btn.logLabel |
| | | |
| | | if (window.GLOB.probation) { |
| | | param.s_debug_type = 'Y' |
| | | } |
| | | |
| | | if (this.props.menuType === 'HS') { // 函数 sPC_TableData_InUpDe 云端验证 |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | |
| | | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | tabviews: state.tabviews, |
| | | menuType: state.editLevel |
| | | } |
| | | } |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import {connect} from 'react-redux' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Button, Modal, notification, Icon, Drawer } from 'antd' |
| | | |
| | |
| | | ) |
| | | } |
| | | } |
| | | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | tabviews: state.tabviews, |
| | | } |
| | | } |
| | | |
| | | const mapDispatchToProps = () => { |
| | | return {} |
| | | } |
| | | |
| | | export default connect(mapStateToProps, mapDispatchToProps)(PopupButton) |
| | | export default PopupButton |
| | |
| | | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | tabviews: state.tabviews, |
| | | menuType: state.editLevel |
| | | } |
| | | } |
| | |
| | | |
| | | render () { |
| | | return ( |
| | | <aside id="mk-sidemenu-wrap" className="mk-sys-side-menu ant-menu-dark mk-edit"> |
| | | <aside className="mk-sys-side-menu ant-menu-dark mk-edit"> |
| | | {!(this.props.editLevel === 'level2' || this.props.editLevel === 'level3') && |
| | | <Menu openKeys={this.state.openKeys} onOpenChange={this.onOpenChange} mode="inline" theme="dark"> |
| | | {!this.props.editLevel && <li className="sup-menu"><Icon onClick={this.enterSubEdit} className="edit-check" type="edit" /></li>} |