| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { DndProvider } from 'react-dnd' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import { Button, Card, Modal, Collapse, notification, Spin, Switch, Tooltip, Col } from 'antd' |
| | | import { Button, Card, Collapse, notification, Spin, Tooltip, Col } from 'antd' |
| | | import { QuestionCircleOutlined, RedoOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | import './index.scss' |
| | | |
| | | const { Panel } = Collapse |
| | | const { confirm } = Modal |
| | | |
| | | const Versions = asyncComponent(() => import('@/menu/versions')) |
| | | // const Versions = asyncComponent(() => import('@/menu/versions')) |
| | | const UrlFieldComponent = asyncComponent(() => import('@/menu/urlfieldcomponent')) |
| | | // const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) |
| | | const UpdateTable = asyncComponent(() => import('./updatetable')) |
| | | const Unattended = asyncComponent(() => import('@/templates/zshare/unattended')) |
| | | const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) |
| | | // const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) |
| | | const SettingComponent = asyncComponent(() => import('@/templates/sharecomponent/settingcomponent')) |
| | | const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent')) |
| | | const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent')) |
| | |
| | | /** |
| | | * @description 三级菜单保存 |
| | | */ |
| | | submitConfig = () => { |
| | | const { menu } = this.props |
| | | const { delActions, openEdition } = this.state |
| | | // submitConfig = () => { |
| | | // const { menu } = this.props |
| | | // const { delActions, openEdition } = this.state |
| | | |
| | | let _config = fromJS(this.state.config).toJS() |
| | | // let _config = fromJS(this.state.config).toJS() |
| | | |
| | | // 基本信息验证 |
| | | if (!_config.fstMenuId || !_config.ParentId || !_config.MenuName || !_config.MenuNo) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请完善菜单基本信息!', |
| | | duration: 5 |
| | | }) |
| | | this.setState({activeKey: '0'}) |
| | | return |
| | | } |
| | | // // 基本信息验证 |
| | | // if (!_config.fstMenuId || !_config.ParentId || !_config.MenuName || !_config.MenuNo) { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: '请完善菜单基本信息!', |
| | | // duration: 5 |
| | | // }) |
| | | // this.setState({activeKey: '0'}) |
| | | // return |
| | | // } |
| | | |
| | | // 新建菜单,清除默认项 |
| | | if (_config.isAdd) { |
| | | _config.search = _config.search.filter(item => !item.origin) |
| | | _config.action = _config.action.filter(item => !item.origin) |
| | | _config.columns = _config.columns.filter(item => !item.origin) |
| | | _config.tabgroups[0].sublist = _config.tabgroups[0].sublist.filter(item => !item.origin) |
| | | } |
| | | // // 新建菜单,清除默认项 |
| | | // if (_config.isAdd) { |
| | | // _config.search = _config.search.filter(item => !item.origin) |
| | | // _config.action = _config.action.filter(item => !item.origin) |
| | | // _config.columns = _config.columns.filter(item => !item.origin) |
| | | // _config.tabgroups[0].sublist = _config.tabgroups[0].sublist.filter(item => !item.origin) |
| | | // } |
| | | |
| | | // 使用已有菜单时,默认添加关联标签id |
| | | if (_config.type === 'user') { |
| | | _config.action = _config.action.map(item => { |
| | | if (item.OpenType === 'popview' && !item.linkTab) { |
| | | item.linkTab = Utils.getuuid() |
| | | } |
| | | return item |
| | | }) |
| | | // // 使用已有菜单时,默认添加关联标签id |
| | | // if (_config.type === 'user') { |
| | | // _config.action = _config.action.map(item => { |
| | | // if (item.OpenType === 'popview' && !item.linkTab) { |
| | | // item.linkTab = Utils.getuuid() |
| | | // } |
| | | // return item |
| | | // }) |
| | | |
| | | _config.tabgroups.forEach(group => { |
| | | group.sublist = group.sublist.map(tab => { |
| | | if (!tab.linkTab) { |
| | | tab.linkTab = Utils.getuuid() |
| | | } |
| | | return tab |
| | | }) |
| | | }) |
| | | } |
| | | // _config.tabgroups.forEach(group => { |
| | | // group.sublist = group.sublist.map(tab => { |
| | | // if (!tab.linkTab) { |
| | | // tab.linkTab = Utils.getuuid() |
| | | // } |
| | | // return tab |
| | | // }) |
| | | // }) |
| | | // } |
| | | |
| | | // 按钮不存在时,去掉绑定的双击按钮 |
| | | if (_config.setting.doubleClick && _config.action.findIndex((item) => item.uuid === _config.setting.doubleClick) === -1) { |
| | | _config.setting.doubleClick = '' |
| | | } |
| | | // // 按钮不存在时,去掉绑定的双击按钮 |
| | | // if (_config.setting.doubleClick && _config.action.findIndex((item) => item.uuid === _config.setting.doubleClick) === -1) { |
| | | // _config.setting.doubleClick = '' |
| | | // } |
| | | |
| | | // 未设置数据源或标签不合法时,启用状态为false |
| | | let vresult = this.verifyconfig(_config) |
| | | if (vresult !== true) { |
| | | _config.enabled = false |
| | | } |
| | | // // 未设置数据源或标签不合法时,启用状态为false |
| | | // let vresult = this.verifyconfig(_config) |
| | | // if (vresult !== true) { |
| | | // _config.enabled = false |
| | | // } |
| | | |
| | | if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态 |
| | | this.setState({ |
| | | menucloseloading: true |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: true |
| | | }) |
| | | } |
| | | // if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态 |
| | | // this.setState({ |
| | | // menucloseloading: true |
| | | // }) |
| | | // } else { |
| | | // this.setState({ |
| | | // menuloading: true |
| | | // }) |
| | | // } |
| | | |
| | | let _LongParam = '' |
| | | // let _LongParam = '' |
| | | |
| | | // 保存时删除配置类型,system 、user |
| | | delete _config.type |
| | | delete _config.isAdd |
| | | // // 保存时删除配置类型,system 、user |
| | | // delete _config.type |
| | | // delete _config.isAdd |
| | | |
| | | try { |
| | | _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) |
| | | } catch (e) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '编译错误', |
| | | duration: 5 |
| | | }) |
| | | this.setState({ |
| | | menucloseloading: false, |
| | | menuloading: false |
| | | }) |
| | | return |
| | | } |
| | | // try { |
| | | // _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) |
| | | // } catch (e) { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: '编译错误', |
| | | // duration: 5 |
| | | // }) |
| | | // this.setState({ |
| | | // menucloseloading: false, |
| | | // menuloading: false |
| | | // }) |
| | | // return |
| | | // } |
| | | |
| | | let _sort = 0 |
| | | // let btntabs = [] |
| | | // let _sort = 0 |
| | | // // let btntabs = [] |
| | | |
| | | let btnParam = { // 添加菜单按钮 |
| | | func: 'sPC_Button_AddUpt', |
| | | Type: 40, // 添加菜单下的按钮type为40,按钮下的按钮type为60 |
| | | ParentID: menu.MenuID, |
| | | MenuNo: _config.MenuNo, |
| | | Template: _config.Template || '', |
| | | PageParam: '', |
| | | LongParam: '', |
| | | LText: [] |
| | | } |
| | | // let btnParam = { // 添加菜单按钮 |
| | | // func: 'sPC_Button_AddUpt', |
| | | // Type: 40, // 添加菜单下的按钮type为40,按钮下的按钮type为60 |
| | | // ParentID: menu.MenuID, |
| | | // MenuNo: _config.MenuNo, |
| | | // Template: _config.Template || '', |
| | | // PageParam: '', |
| | | // LongParam: '', |
| | | // LText: [] |
| | | // } |
| | | |
| | | _config.action.forEach(item => { |
| | | if (item.hidden === 'true') return |
| | | _sort++ |
| | | // if (item.OpenType === 'popview') { |
| | | // btntabs.push({ |
| | | // uuid: item.uuid, |
| | | // linkTab: item.linkTab, |
| | | // label: item.label, |
| | | // sort: _sort |
| | | // }) |
| | | // } |
| | | // _config.action.forEach(item => { |
| | | // if (item.hidden === 'true') return |
| | | // _sort++ |
| | | // // if (item.OpenType === 'popview') { |
| | | // // btntabs.push({ |
| | | // // uuid: item.uuid, |
| | | // // linkTab: item.linkTab, |
| | | // // label: item.label, |
| | | // // sort: _sort |
| | | // // }) |
| | | // // } |
| | | |
| | | btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${_sort * 10}' as Sort`) |
| | | }) |
| | | // btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${_sort * 10}' as Sort`) |
| | | // }) |
| | | |
| | | btnParam.LText = btnParam.LText.join(' union all ') |
| | | btnParam.LText = Utils.formatOptions(btnParam.LText) |
| | | btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) |
| | | // btnParam.LText = btnParam.LText.join(' union all ') |
| | | // btnParam.LText = Utils.formatOptions(btnParam.LText) |
| | | // btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | // btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) |
| | | |
| | | // let tabParam = { // 添加菜单tab页 |
| | | // func: 'sPC_sMenusTab_AddUpt', |
| | | // MenuID: menu.MenuID |
| | | // } |
| | | // // let tabParam = { // 添加菜单tab页 |
| | | // // func: 'sPC_sMenusTab_AddUpt', |
| | | // // MenuID: menu.MenuID |
| | | // // } |
| | | |
| | | // let _LText = [] |
| | | // // let _LText = [] |
| | | |
| | | // btntabs.forEach(item => { |
| | | // _LText.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${item.sort * 10}' as Sort`) |
| | | // }) |
| | | // _config.tabgroups.forEach(group => { |
| | | // group.sublist.forEach(item => { |
| | | // _sort++ |
| | | // _LText.push(`select '${menu.MenuID}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${_sort * 10}' as Sort`) |
| | | // }) |
| | | // }) |
| | | // // btntabs.forEach(item => { |
| | | // // _LText.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${item.sort * 10}' as Sort`) |
| | | // // }) |
| | | // // _config.tabgroups.forEach(group => { |
| | | // // group.sublist.forEach(item => { |
| | | // // _sort++ |
| | | // // _LText.push(`select '${menu.MenuID}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${_sort * 10}' as Sort`) |
| | | // // }) |
| | | // // }) |
| | | |
| | | // _LText = _LText.join(' union all ') |
| | | // // _LText = _LText.join(' union all ') |
| | | |
| | | // 清空菜单下关联的标签 |
| | | // if (!_LText) { |
| | | // _LText = `select '${menu.MenuID}' as MenuID ,'' as Tabid,'' as TabName ,'0' as Sort` |
| | | // } |
| | | // // 清空菜单下关联的标签 |
| | | // // if (!_LText) { |
| | | // // _LText = `select '${menu.MenuID}' as MenuID ,'' as Tabid,'' as TabName ,'0' as Sort` |
| | | // // } |
| | | |
| | | // tabParam.LText = Utils.formatOptions(_LText) |
| | | // tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | // tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) |
| | | // // tabParam.LText = Utils.formatOptions(_LText) |
| | | // // tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | // // tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) |
| | | |
| | | let _vals = this.getFuncNames(_config) |
| | | // let _vals = this.getFuncNames(_config) |
| | | |
| | | let param = { |
| | | func: 'sPC_TrdMenu_AddUpt', |
| | | FstID: _config.fstMenuId, |
| | | SndID: _config.ParentId, |
| | | ParentID: _config.ParentId, |
| | | MenuID: menu.MenuID, |
| | | MenuNo: _config.MenuNo, |
| | | EasyCode: _config.easyCode || '', |
| | | Template: _config.Template || '', |
| | | MenuName: _config.MenuName, |
| | | PageParam: JSON.stringify({...menu.PageParam, Template: _config.Template, OpenType: _config.OpenType, hidden: _config.hidden || 'false'}), |
| | | LongParam: _LongParam, |
| | | LText: _vals.func.map(item => `select '${menu.MenuID}' as MenuID,'${item.func}' as ProcName,'${item.label}' as MenuName`), |
| | | LTexttb: _vals.table.map(item => `select '${menu.MenuID}' as MenuID,'${item}' as tbName`) |
| | | } |
| | | // let param = { |
| | | // func: 'sPC_TrdMenu_AddUpt', |
| | | // FstID: _config.fstMenuId, |
| | | // SndID: _config.ParentId, |
| | | // ParentID: _config.ParentId, |
| | | // MenuID: menu.MenuID, |
| | | // MenuNo: _config.MenuNo, |
| | | // EasyCode: _config.easyCode || '', |
| | | // Template: _config.Template || '', |
| | | // MenuName: _config.MenuName, |
| | | // PageParam: JSON.stringify({...menu.PageParam, Template: _config.Template, OpenType: _config.OpenType, hidden: _config.hidden || 'false'}), |
| | | // LongParam: _LongParam, |
| | | // LText: _vals.func.map(item => `select '${menu.MenuID}' as MenuID,'${item.func}' as ProcName,'${item.label}' as MenuName`), |
| | | // LTexttb: _vals.table.map(item => `select '${menu.MenuID}' as MenuID,'${item}' as tbName`) |
| | | // } |
| | | |
| | | if (menu.menuSort) { // 菜单新建时设置排序 |
| | | param.Sort = menu.menuSort |
| | | } |
| | | // if (menu.menuSort) { // 菜单新建时设置排序 |
| | | // param.Sort = menu.menuSort |
| | | // } |
| | | |
| | | param.LText = param.LText.join(' union all ') |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.LTexttb = param.LTexttb.join(' union all ') |
| | | param.LTexttb = Utils.formatOptions(param.LTexttb) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | // param.LText = param.LText.join(' union all ') |
| | | // param.LText = Utils.formatOptions(param.LText) |
| | | // param.LTexttb = param.LTexttb.join(' union all ') |
| | | // param.LTexttb = Utils.formatOptions(param.LTexttb) |
| | | // param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | // param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | if (openEdition) { // 版本管理 |
| | | param.open_edition = openEdition |
| | | } |
| | | // if (openEdition) { // 版本管理 |
| | | // param.open_edition = openEdition |
| | | // } |
| | | |
| | | setTimeout(() => { |
| | | // 有按钮或标签删除时,先进行删除操作 |
| | | // 删除成功后,保存页面配置 |
| | | new Promise(resolve => { |
| | | if (delActions.length > 0) { |
| | | let deffers = delActions.map(item => { |
| | | let _param = { |
| | | func: 'sPC_MainMenu_Del', |
| | | MenuID: item.card ? item.card.uuid : item.uuid |
| | | } |
| | | // setTimeout(() => { |
| | | // // 有按钮或标签删除时,先进行删除操作 |
| | | // // 删除成功后,保存页面配置 |
| | | // new Promise(resolve => { |
| | | // if (delActions.length > 0) { |
| | | // let deffers = delActions.map(item => { |
| | | // let _param = { |
| | | // func: 'sPC_MainMenu_Del', |
| | | // MenuID: item.card ? item.card.uuid : item.uuid |
| | | // } |
| | | |
| | | if (item.type === 'action') { |
| | | let _ParentParam = null |
| | | // if (item.type === 'action') { |
| | | // let _ParentParam = null |
| | | |
| | | try { |
| | | _ParentParam = window.btoa(window.encodeURIComponent(JSON.stringify(item.card))) |
| | | } catch (e) { |
| | | console.warn('Stringify Failure') |
| | | _ParentParam = null |
| | | } |
| | | // try { |
| | | // _ParentParam = window.btoa(window.encodeURIComponent(JSON.stringify(item.card))) |
| | | // } catch (e) { |
| | | // console.warn('Stringify Failure') |
| | | // _ParentParam = null |
| | | // } |
| | | |
| | | if (_ParentParam) { // 删除按钮时,保存按钮配置信息,用于恢复按钮 |
| | | _param.ParentParam = _ParentParam |
| | | } |
| | | } |
| | | // if (_ParentParam) { // 删除按钮时,保存按钮配置信息,用于恢复按钮 |
| | | // _param.ParentParam = _ParentParam |
| | | // } |
| | | // } |
| | | |
| | | return new Promise(resolve => { |
| | | Api.getCloudConfig(_param).then(response => { |
| | | resolve(response) |
| | | }) |
| | | }) |
| | | }) |
| | | Promise.all(deffers).then(result => { |
| | | let error = null |
| | | result.forEach(response => { |
| | | if (!response.status) { |
| | | error = response |
| | | } |
| | | }) |
| | | // return new Promise(resolve => { |
| | | // Api.getCloudConfig(_param).then(response => { |
| | | // resolve(response) |
| | | // }) |
| | | // }) |
| | | // }) |
| | | // Promise.all(deffers).then(result => { |
| | | // let error = null |
| | | // result.forEach(response => { |
| | | // if (!response.status) { |
| | | // error = response |
| | | // } |
| | | // }) |
| | | |
| | | if (error) { |
| | | this.setState({ |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: error.message, |
| | | duration: 5 |
| | | }) |
| | | resolve(false) |
| | | } else { |
| | | this.setState({ |
| | | delActions: [] |
| | | }) |
| | | resolve(true) |
| | | } |
| | | }) |
| | | } else if (delActions.length === 0) { |
| | | resolve(true) |
| | | } |
| | | }).then(resp => { |
| | | if (resp === false) return |
| | | // if (error) { |
| | | // this.setState({ |
| | | // menuloading: false, |
| | | // menucloseloading: false |
| | | // }) |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: error.message, |
| | | // duration: 5 |
| | | // }) |
| | | // resolve(false) |
| | | // } else { |
| | | // this.setState({ |
| | | // delActions: [] |
| | | // }) |
| | | // resolve(true) |
| | | // } |
| | | // }) |
| | | // } else if (delActions.length === 0) { |
| | | // resolve(true) |
| | | // } |
| | | // }).then(resp => { |
| | | // if (resp === false) return |
| | | |
| | | return true |
| | | }).then(res => { |
| | | if (res === true || res === false) return res |
| | | // return true |
| | | // }).then(res => { |
| | | // if (res === true || res === false) return res |
| | | |
| | | let msg = res.filter(Boolean)[0] |
| | | if (msg) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: msg, |
| | | duration: 5 |
| | | }) |
| | | return false |
| | | } else { |
| | | return true |
| | | } |
| | | }).then(resp => { |
| | | if (resp === false) return |
| | | Api.getCloudConfig(param).then(response => { |
| | | if (response.status) { |
| | | this.setState({ |
| | | config: _config, |
| | | openEdition: response.open_edition || '', |
| | | originMenu: fromJS(_config).toJS() |
| | | }) |
| | | // let msg = res.filter(Boolean)[0] |
| | | // if (msg) { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: msg, |
| | | // duration: 5 |
| | | // }) |
| | | // return false |
| | | // } else { |
| | | // return true |
| | | // } |
| | | // }).then(resp => { |
| | | // if (resp === false) return |
| | | // Api.getCloudConfig(param).then(response => { |
| | | // if (response.status) { |
| | | // this.setState({ |
| | | // config: _config, |
| | | // openEdition: response.open_edition || '', |
| | | // originMenu: fromJS(_config).toJS() |
| | | // }) |
| | | |
| | | this.submitAction(btnParam) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: response.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | }, +sessionStorage.getItem('mkDelay')) |
| | | } |
| | | // this.submitAction(btnParam) |
| | | // } else { |
| | | // this.setState({ |
| | | // menuloading: false, |
| | | // menucloseloading: false |
| | | // }) |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: response.message, |
| | | // duration: 5 |
| | | // }) |
| | | // } |
| | | // }) |
| | | // }) |
| | | // }, +sessionStorage.getItem('mkDelay')) |
| | | // } |
| | | |
| | | /** |
| | | * @description 保存或修改菜单按钮集 |
| | | */ |
| | | submitAction = (btnParam) => { |
| | | const { config } = this.state |
| | | // submitAction = (btnParam) => { |
| | | // const { config } = this.state |
| | | |
| | | new Promise(resolve => { |
| | | if (btnParam.LText) { |
| | | Api.getCloudConfig(btnParam).then(result => { |
| | | if (result.status) { |
| | | this.setState({ // 保存成功后清空复制列表 |
| | | copyActions: [] |
| | | }) |
| | | resolve(result) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 5 |
| | | }) |
| | | resolve(false) |
| | | } |
| | | }) |
| | | } else { |
| | | resolve(true) |
| | | } |
| | | }).then(response => { |
| | | if (response === false) return response |
| | | // new Promise(resolve => { |
| | | // if (btnParam.LText) { |
| | | // Api.getCloudConfig(btnParam).then(result => { |
| | | // if (result.status) { |
| | | // this.setState({ // 保存成功后清空复制列表 |
| | | // copyActions: [] |
| | | // }) |
| | | // resolve(result) |
| | | // } else { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: result.message, |
| | | // duration: 5 |
| | | // }) |
| | | // resolve(false) |
| | | // } |
| | | // }) |
| | | // } else { |
| | | // resolve(true) |
| | | // } |
| | | // }).then(response => { |
| | | // if (response === false) return response |
| | | |
| | | if (!this.state.originActions || this.state.originActions.length === 0) return 'true' |
| | | // if (!this.state.originActions || this.state.originActions.length === 0) return 'true' |
| | | |
| | | let oriActions = [] |
| | | this.state.originActions.forEach(item => { |
| | | let curBtn = config.action.filter(cell => item.curuuid === cell.uuid)[0] // 查看初始化按钮是否存在 |
| | | if (!curBtn) return |
| | | if (curBtn.OpenType !== item.prebtn.OpenType) return |
| | | if (curBtn.OpenType === 'funcbutton' && curBtn.execMode !== 'pop') return |
| | | // let oriActions = [] |
| | | // this.state.originActions.forEach(item => { |
| | | // let curBtn = config.action.filter(cell => item.curuuid === cell.uuid)[0] // 查看初始化按钮是否存在 |
| | | // if (!curBtn) return |
| | | // if (curBtn.OpenType !== item.prebtn.OpenType) return |
| | | // if (curBtn.OpenType === 'funcbutton' && curBtn.execMode !== 'pop') return |
| | | |
| | | oriActions.push({ |
| | | prebtn: item.prebtn, |
| | | curBtn: curBtn |
| | | }) |
| | | }) |
| | | // oriActions.push({ |
| | | // prebtn: item.prebtn, |
| | | // curBtn: curBtn |
| | | // }) |
| | | // }) |
| | | |
| | | if (oriActions.length === 0) return 'true' |
| | | // if (oriActions.length === 0) return 'true' |
| | | |
| | | oriActions.forEach(action => { |
| | | if (!action.prebtn || !action.prebtn.uuid) return |
| | | // oriActions.forEach(action => { |
| | | // if (!action.prebtn || !action.prebtn.uuid) return |
| | | |
| | | Api.getCloudConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: action.prebtn.uuid |
| | | }).then(result => { |
| | | if (result.status && result.LongParam) { |
| | | let _temp = '' |
| | | // Api.getCloudConfig({ |
| | | // func: 'sPC_Get_LongParam', |
| | | // MenuID: action.prebtn.uuid |
| | | // }).then(result => { |
| | | // if (result.status && result.LongParam) { |
| | | // let _temp = '' |
| | | |
| | | let _subconfig = '' |
| | | try { |
| | | _subconfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | _temp = _subconfig.type |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | _subconfig = '' |
| | | } |
| | | // let _subconfig = '' |
| | | // try { |
| | | // _subconfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | // _temp = _subconfig.type |
| | | // } catch (e) { |
| | | // console.warn('Parse Failure') |
| | | // _subconfig = '' |
| | | // } |
| | | |
| | | if (!_subconfig) return |
| | | // if (!_subconfig) return |
| | | |
| | | let param = { |
| | | func: 'sPC_ButtonParam_AddUpt', |
| | | ParentID: this.props.menu.MenuID, |
| | | MenuID: action.curBtn.uuid, |
| | | MenuNo: config.MenuNo, |
| | | Template: _temp, |
| | | MenuName: action.curBtn.label, |
| | | PageParam: JSON.stringify({Template: _temp}), |
| | | LongParam: result.LongParam |
| | | } |
| | | Api.getCloudConfig(param).then(() => {}) |
| | | } |
| | | }) |
| | | }) |
| | | return 'true' |
| | | }).then(response => { |
| | | if (response === 'true') { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '保存成功', |
| | | duration: 2 |
| | | }) |
| | | if (this.state.closeVisible) { |
| | | this.props.handleView() |
| | | } else { |
| | | this.setState({ |
| | | originActions: [], |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | } |
| | | this.props.reloadmenu() |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | // let param = { |
| | | // func: 'sPC_ButtonParam_AddUpt', |
| | | // ParentID: this.props.menu.MenuID, |
| | | // MenuID: action.curBtn.uuid, |
| | | // MenuNo: config.MenuNo, |
| | | // Template: _temp, |
| | | // MenuName: action.curBtn.label, |
| | | // PageParam: JSON.stringify({Template: _temp}), |
| | | // LongParam: result.LongParam |
| | | // } |
| | | // Api.getCloudConfig(param).then(() => {}) |
| | | // } |
| | | // }) |
| | | // }) |
| | | // return 'true' |
| | | // }).then(response => { |
| | | // if (response === 'true') { |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: '保存成功', |
| | | // duration: 2 |
| | | // }) |
| | | // if (this.state.closeVisible) { |
| | | // this.props.handleView() |
| | | // } else { |
| | | // this.setState({ |
| | | // originActions: [], |
| | | // menuloading: false, |
| | | // menucloseloading: false |
| | | // }) |
| | | // } |
| | | // this.props.reloadmenu() |
| | | // } else { |
| | | // this.setState({ |
| | | // menuloading: false, |
| | | // menucloseloading: false |
| | | // }) |
| | | // } |
| | | // }) |
| | | // } |
| | | |
| | | /** |
| | | * @description 点击返回时,判断配置保存状态 |
| | | */ |
| | | cancelConfig = () => { |
| | | const { config, originMenu } = this.state |
| | | // const { config, originMenu } = this.state |
| | | |
| | | let _this = this |
| | | // let _this = this |
| | | |
| | | if (config.isAdd) { |
| | | confirm({ |
| | | content: '菜单尚未提交,确定放弃保存吗?', |
| | | onOk() { |
| | | _this.props.handleView() |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | if (!is(fromJS(originMenu), fromJS(config))) { |
| | | this.setState({ |
| | | closeVisible: true |
| | | }) |
| | | } else { |
| | | this.props.handleView() |
| | | } |
| | | } |
| | | // if (config.isAdd) { |
| | | // confirm({ |
| | | // content: '菜单尚未提交,确定放弃保存吗?', |
| | | // onOk() { |
| | | // _this.props.handleView() |
| | | // }, |
| | | // onCancel() {} |
| | | // }) |
| | | // } else { |
| | | // if (!is(fromJS(originMenu), fromJS(config))) { |
| | | // this.setState({ |
| | | // closeVisible: true |
| | | // }) |
| | | // } else { |
| | | // this.props.handleView() |
| | | // } |
| | | // } |
| | | |
| | | this.props.handleView() |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | render () { |
| | | const { menu } = this.props |
| | | const { activeKey, config, chartview, openEdition } = this.state |
| | | const { activeKey, config, chartview } = this.state |
| | | |
| | | if (!config) return null |
| | | |
| | |
| | | } bordered={false} extra={ |
| | | <div> |
| | | <Unattended config={config} updateConfig={this.updateconfig}/> |
| | | <Versions MenuId={menu.MenuID} open_edition={openEdition} updateConfig={this.refreshConfig}/> |
| | | {/* <Versions MenuId={menu.MenuID} open_edition={openEdition} updateConfig={this.refreshConfig}/> */} |
| | | {/* <ReplaceField type="table" config={config} updateConfig={this.updateconfig}/> */} |
| | | <EditComponent type="table" options={['search', 'form', 'action', 'columns']} config={this.state.config} refresh={this.editConfig}/> |
| | | {/* <EditComponent type="table" options={['search', 'form', 'action', 'columns']} config={this.state.config} refresh={this.editConfig}/> */} |
| | | <UpdateTable config={config}/> |
| | | <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> |
| | | <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>保存</Button> |
| | | {/* <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> */} |
| | | {/* <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>保存</Button> */} |
| | | <Button onClick={this.cancelConfig}>关闭</Button> |
| | | </div> |
| | | } style={{ width: '100%' }}> |
| | |
| | | </div> |
| | | </DndProvider> |
| | | {/* 返回时未保存提示 */} |
| | | <Modal |
| | | {/* <Modal |
| | | bodyStyle={{textAlign: 'center', color: '#000000', fontSize: '16px'}} |
| | | closable={false} |
| | | maskClosable={false} |
| | |
| | | destroyOnClose |
| | | > |
| | | 配置已修改,是否保存配置信息? |
| | | </Modal> |
| | | </Modal> */} |
| | | {this.state.loading && <Spin size="large" />} |
| | | </div> |
| | | ) |