| | |
| | | import SearchComponent from '@/templates/sharecomponent/searchcomponent' |
| | | |
| | | import MenuForm from '@/templates/comtableconfig/menuform' |
| | | // import EditComponent from '@/templates/zshare/editcomponent' |
| | | import SourceElement from '@/templates/zshare/dragsource' |
| | | import Source from './source' |
| | | import './index.scss' |
| | |
| | | const { Panel } = Collapse |
| | | const { confirm } = Modal |
| | | |
| | | const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) |
| | | const SettingComponent = asyncComponent(() => import('@/templates/sharecomponent/settingcalcomponent')) |
| | | const TabComponent = asyncComponent(() => import('./tabcomponent')) |
| | | const CalComponent = asyncComponent(() => import('./calcomponent')) |
| | |
| | | class SubTableConfig extends Component { |
| | | static propTpyes = { |
| | | menu: PropTypes.any, |
| | | optionLibs: PropTypes.any, |
| | | reloadmenu: PropTypes.func, |
| | | handleView: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, // 字典 |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, // 字典 |
| | | config: null, // 页面配置 |
| | | visible: false, // 搜索条件、按钮、显示列,模态框显示控制 |
| | | tableFields: [], // 已选表字段集 |
| | | fields: null, // 搜索条件及显示列,可选字段 |
| | | formlist: null, // 搜索条件、按钮、显示列表单字段 |
| | | menuloading: false, // 菜单保存中 |
| | |
| | | closeVisible: false, // 关闭模态框 |
| | | originConfig: null, // 原配置 |
| | | tabviews: [], // 所有标签页 |
| | | optionLibs: null, // 自定义下拉选项库 |
| | | activeKey: '0', // 默认展开基本信息 |
| | | pasteContent: null, // 粘贴内容 |
| | | openEdition: '', // 编辑版本标记,防止多人操作 |
| | | mockdata: [], // 测试数据 |
| | | } |
| | |
| | | * 2、设置操作类型、原始菜单信息(每次保存后重置)、已使用表及基本信息表单 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const { menu, optionLibs } = this.props |
| | | const { menu } = this.props |
| | | let _LongParam = menu.LongParam |
| | | let _config = '' |
| | | |
| | |
| | | _config.isAdd = true |
| | | } else { |
| | | _config = _LongParam |
| | | _config.search.forEach(item => { |
| | | if ( |
| | | (item.type === 'select' || item.type === 'multiselect' || item.type === 'link') && |
| | | item.resourceType === '0' && |
| | | item.options && item.options.length > 0 |
| | | ) { |
| | | optionLibs.set(menu.MenuID + item.uuid, { |
| | | uuid: menu.MenuID + item.uuid, |
| | | label: item.label, |
| | | parname: menu.MenuName, |
| | | type: 'search', |
| | | options: item.options |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (_config.type === 'user') { |
| | |
| | | _config.OpenType = menu.PageParam ? menu.PageParam.OpenType : '' |
| | | _config.easyCode = _config.easyCode || '' |
| | | |
| | | // 数据源 |
| | | if (_config.setting.interType === 'inner' && !_config.setting.innerFunc) { |
| | | _config.setting.interType = 'system' |
| | | } |
| | | |
| | | this.setState({ |
| | | openEdition: menu.open_edition || '', |
| | | optionLibs: optionLibs, |
| | | activeKey: menu.activeKey || '0', |
| | | config: _config, |
| | | originMenu: fromJS(_config).toJS(), |
| | |
| | | handleViewBack = () => { |
| | | let param = { |
| | | editMenu: null, |
| | | optionLibs: null, |
| | | editTab: null, |
| | | tabConfig: null, |
| | | subTabConfig: null, |
| | |
| | | |
| | | getFuncNames = (data, funcNames, tableNames) => { |
| | | data.forEach(item => { |
| | | if (item.subfuncs) { |
| | | this.getFuncNames(item.subfuncs, funcNames, tableNames) |
| | | } else { |
| | | if (item.tableName) { |
| | | tableNames.push(item.tableName) |
| | | } |
| | | if (item.innerFunc) { |
| | | funcNames.push({func: item.innerFunc, label: item.label || ''}) |
| | | } |
| | | // if (item.subfuncs) { |
| | | // this.getFuncNames(item.subfuncs, funcNames, tableNames) |
| | | // return |
| | | // } |
| | | |
| | | if (item.callbackFunc) { |
| | | funcNames.push({func: item.callbackFunc, label: item.label || ''}) |
| | | } |
| | | if (item.tableName) { |
| | | tableNames.push(item.tableName) |
| | | } |
| | | if (item.innerFunc) { |
| | | funcNames.push({func: item.innerFunc, label: item.label || ''}) |
| | | } |
| | | |
| | | if (item.callbackFunc) { |
| | | funcNames.push({func: item.callbackFunc, label: item.label || ''}) |
| | | } |
| | | }) |
| | | |
| | |
| | | } |
| | | |
| | | new Promise(resolve => { |
| | | if (_config.tab) { |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: _config.tab.linkTab |
| | | }).then(result => { |
| | | if (result.status && result.LongParam) { |
| | | let _LongParam = '' |
| | | // if (_config.tab) { |
| | | // Api.getSystemConfig({ |
| | | // func: 'sPC_Get_LongParam', |
| | | // MenuID: _config.tab.linkTab |
| | | // }).then(result => { |
| | | // if (result.status && result.LongParam) { |
| | | // let _LongParam = '' |
| | | |
| | | if (result.LongParam) { |
| | | try { |
| | | _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | // if (result.LongParam) { |
| | | // try { |
| | | // _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | // } catch (e) { |
| | | // console.warn('Parse Failure') |
| | | // _LongParam = '' |
| | | // } |
| | | // } |
| | | |
| | | if (_LongParam) { |
| | | _config.funcs[1].menuNo = _LongParam.tabNo || '' |
| | | _config.funcs[1].subfuncs = _LongParam.funcs || [] |
| | | } |
| | | } |
| | | resolve() |
| | | }) |
| | | } else { |
| | | resolve() |
| | | } |
| | | // if (_LongParam) { |
| | | // _config.funcs[1].menuNo = _LongParam.tabNo || '' |
| | | // _config.funcs[1].subfuncs = _LongParam.funcs || [] |
| | | // } |
| | | // } |
| | | // resolve() |
| | | // }) |
| | | // } else { |
| | | // resolve() |
| | | // } |
| | | resolve() |
| | | }).then(() => { |
| | | // 保存时删除配置类型,system 、user |
| | | delete _config.type |
| | |
| | | tabParam.LText = Utils.formatOptions(`select '${menu.MenuID}' as MenuID ,'' as Tabid,'' as TabName ,'0' as Sort`) |
| | | } |
| | | |
| | | tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) |
| | | |
| | | let _vals = this.getFuncNames(_config.funcs, [], []) |
| | |
| | | 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') + '.000' |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | if (openEdition) { // 版本管理 |
| | |
| | | */ |
| | | setSubConfig = () => { |
| | | const { menu } = this.props |
| | | const { config, originMenu, optionLibs, activeKey, openEdition } = this.state |
| | | const { config, originMenu, activeKey, openEdition } = this.state |
| | | |
| | | if (config.isAdd) { // 新建菜单,提示菜单尚未保存 |
| | | notification.warning({ |
| | |
| | | _Menu.open_edition = openEdition // 更新版本号 |
| | | |
| | | let param = { |
| | | optionLibs: optionLibs, |
| | | editMenu: _Menu, |
| | | editTab: fromJS(config.tab).toJS(), |
| | | tabConfig: null, |
| | |
| | | calvaild = false |
| | | } |
| | | |
| | | if (((config.setting.interType === 'inner' && !config.setting.innerFunc) || config.setting.interType === 'system') && config.setting.default !== 'false' && !config.setting.dataresource) { |
| | | if (config.setting.interType === 'system' && config.setting.default !== 'false' && !config.setting.dataresource) { |
| | | return '菜单尚未设置数据源,不可启用!' |
| | | } else if (config.columns.length === 0) { |
| | | return '菜单尚未设置数据字段,不可启用!' |
| | |
| | | config: res.config |
| | | }) |
| | | } else if (res.type === 'paste') { |
| | | this.setState({ |
| | | pasteContent: res.content |
| | | }, () => { |
| | | this.setState({ |
| | | pasteContent: null |
| | | }) |
| | | }) |
| | | this.setState({config: res.config}) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 更新搜索条件配置信息 |
| | | */ |
| | | updatesearch = (config, options) => { |
| | | const { optionLibs } = this.state |
| | | updatesearch = (config) => { |
| | | |
| | | this.setState({ |
| | | config: config, |
| | | optionLibs: options || optionLibs |
| | | config: config |
| | | }) |
| | | } |
| | | |
| | |
| | | updateconfig = (config) => { |
| | | this.setState({ |
| | | config: config |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 更新常用表信息,快捷添加后更新配置信息 |
| | | */ |
| | | updatetable = (config, fields) => { |
| | | const { tableFields } = this.state |
| | | |
| | | this.setState({ |
| | | config: config, |
| | | tableFields: fields ? fields : tableFields |
| | | }) |
| | | } |
| | | |
| | |
| | | <TableComponent |
| | | config={config} |
| | | containerId="subtable-basedata" |
| | | updatetable={this.updatetable} |
| | | updatetable={this.updateconfig} |
| | | /> |
| | | </Panel> |
| | | {/* 搜索条件添加 */} |
| | |
| | | <FieldsComponent |
| | | config={config} |
| | | type="search" |
| | | tableFields={this.state.tableFields} |
| | | updatefield={this.updateconfig} |
| | | /> |
| | | </Panel> |
| | |
| | | </div> |
| | | } bordered={false} extra={ |
| | | <div> |
| | | {/* <EditComponent dict={this.state.dict} type="subtable" config={this.state.config} refresh={this.updateConfig}/> */} |
| | | <EditComponent dict={this.state.dict} options={['search']} config={this.state.config} refresh={this.updateConfig}/> |
| | | <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> |
| | | <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['model.save']}</Button> |
| | | <Button onClick={this.cancelConfig}>{this.state.dict['model.back']}</Button> |
| | |
| | | <SettingComponent |
| | | config={config} |
| | | MenuID={menu.MenuID} |
| | | tableFields={this.state.tableFields} |
| | | permFuncField={this.props.permFuncField} |
| | | updateConfig={this.updateconfig} |
| | | /> |
| | | <SearchComponent |
| | | menu={{MenuID: menu.MenuID, MenuName: config.MenuName}} |
| | | config={config} |
| | | pasteContent={this.state.pasteContent} |
| | | sysRoles={this.props.sysRoles} |
| | | optionLibs={this.state.optionLibs} |
| | | updatesearch={this.updatesearch} |
| | | /> |
| | | <div className="calendar-wrap"> |
| | |
| | | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | sysRoles: state.sysRoles, |
| | | permFuncField: state.permFuncField, |
| | | memberLevel: state.memberLevel |
| | | } |
| | | } |