| | |
| | | import React, { Component } from 'react' |
| | | import { connect } from 'react-redux' |
| | | import { DndProvider } from 'react-dnd' |
| | | import { fromJS } from 'immutable' |
| | | import { is, fromJS } from 'immutable' |
| | | import moment from 'moment' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import { Icon, Tabs, notification, Modal } from 'antd' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import zhCN from '@/locales/zh-CN/mob.js' |
| | | import enUS from '@/locales/en-US/mob.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | appId: this.props.match.params.appId, |
| | | appType: this.props.match.params.appType, |
| | | appConfig: null, |
| | | appCode: this.props.match.params.appCode, |
| | | appName: this.props.match.params.appName, |
| | | oriConfig: null, |
| | | parentId: '', |
| | | openEdition: '', |
| | | saveIng: false, |
| | | config: null, |
| | | pageIndex: 0, |
| | |
| | | } |
| | | |
| | | jumpToManage = () => { |
| | | this.props.history.replace('/mobmanage') |
| | | // this.props.history.push('/mobdesign/sdafadjfidsf/dsfsdf') |
| | | const { oriConfig, config } = this.state |
| | | const _this = this |
| | | |
| | | if (!is(fromJS(oriConfig), fromJS(config))) { |
| | | confirm({ |
| | | title: '配置已修改,放弃保存吗?', |
| | | content: '', |
| | | okText: _this.state.dict['mob.confirm'], |
| | | cancelText: _this.state.dict['mob.cancel'], |
| | | onOk() { |
| | | _this.props.history.replace('/mobmanage') |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | _this.props.history.replace('/mobmanage') |
| | | } |
| | | } |
| | | |
| | | triggerSave = () => { |
| | | // const { config } = this.state |
| | | const { config, openEdition, parentId } = this.state |
| | | |
| | | this.setState({ |
| | | saveIng: true |
| | | }) |
| | | |
| | | let param = { |
| | | func: 'sPC_TrdMenu_AddUpt', |
| | | ParentID: config.entrance ? '' : parentId, |
| | | MenuID: config.uuid, |
| | | MenuNo: config.MenuNo, |
| | | EasyCode: '', |
| | | Template: '', |
| | | MenuName: '', |
| | | PageParam: '', |
| | | LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(config))), |
| | | // LText: _vals.func.map(item => `select '${menu.MenuID}' as MenuID,'${item.func}' as ProcName,'${item.label}' as MenuName`), |
| | | // LTexttb: _tables.map(item => `select '${menu.MenuID}' as MenuID,'${item}' as tbName`), |
| | | TypeCharOne: 'mob' |
| | | } |
| | | |
| | | let _LText = '' |
| | | // _LText = _LText.join(' union all ') |
| | | let _LTexttb = '' |
| | | // _LTexttb = _LTexttb.join(' union all ') |
| | | |
| | | param.LText = Utils.formatOptions(_LText) |
| | | param.LTexttb = Utils.formatOptions(_LTexttb) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | if (openEdition) { // 版本管理 |
| | | param.open_edition = openEdition |
| | | } |
| | | |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (response.status) { |
| | | this.setState({ |
| | | oriConfig: fromJS(config).toJS(), |
| | | openEdition: response.open_edition || '', |
| | | saveIng: false |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: response.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | } |
| | | |
| | | getAppParam = (id) => { |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: id |
| | | MenuID: id, |
| | | TypeCharOne: 'mob' |
| | | }).then(result => { |
| | | if (result.status) { |
| | | let appConfig = null |
| | | let config = null |
| | | |
| | | if (result.LongParam) { |
| | | try { |
| | | appConfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | appConfig = null |
| | | config = null |
| | | } |
| | | } |
| | | |
| | | if (!appConfig) { |
| | | appConfig = { |
| | | if (!config) { |
| | | config = { |
| | | version: 1.0, |
| | | entrance: true, |
| | | label: '', |
| | | uuid: this.props.match.params.appId, |
| | | pageIndex: 0, |
| | | MenuNo: this.props.match.params.appCode, |
| | | sourcelist: [], |
| | | components: [] |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | appConfig: appConfig, |
| | | config: fromJS(appConfig).toJS() |
| | | oriConfig: config, |
| | | config: fromJS(config).toJS(), |
| | | openEdition: result.open_edition || '', |
| | | }) |
| | | } else { |
| | | notification.warning({ |