| | |
| | | |
| | | if (result.status) { |
| | | let _permAction = {} |
| | | let _permRoles = [] |
| | | let _permFuncField = [] |
| | | if (result.UserRoles && result.UserRoles[0] && result.UserRoles[0].RoleMenu) { |
| | | result.UserRoles[0].RoleMenu.forEach(menu => { |
| | | if (!menu.MenuID) return |
| | | _permAction[menu.MenuID] = true |
| | | if (result.UserRoles) { |
| | | result.UserRoles.forEach(role => { |
| | | _permRoles.push(role.RoleID) |
| | | |
| | | role.RoleMenu.forEach(menu => { |
| | | if (!menu.MenuID) return |
| | | _permAction[menu.MenuID] = true |
| | | }) |
| | | }) |
| | | } |
| | | |
| | |
| | | _permFuncField = _permFuncField.sort() |
| | | } |
| | | |
| | | this.props.initPermission(_permAction, _permFuncField) |
| | | this.props.initPermission(_permRoles, _permAction, _permFuncField) |
| | | } |
| | | } |
| | | |
| | |
| | | sysMenu: false, // 添加或编辑菜单(角色权限分配等) |
| | | optionLibs: [], // 自定义下拉选项库 |
| | | fstMenuId: null, // 一级菜单Id |
| | | fstMenuList: null // 一级菜单列表 |
| | | fstMenuList: null, // 一级菜单列表 |
| | | roleList: null // 角色列表,建立黑名单 |
| | | } |
| | | |
| | | /** |
| | |
| | | delete _menu.src |
| | | delete _menu.text |
| | | |
| | | if (!this.state.fstMenuId) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未获取到一级菜单信息,请稍等或刷新重试。', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | _menu.ParentID = this.props.supMenu.MenuID |
| | | _menu.supMenuList = this.props.supMenuList |
| | | _menu.fstMenuId = this.state.fstMenuId |
| | | _menu.fstMenuList = this.state.fstMenuList |
| | | _menu.roleList = this.state.roleList |
| | | |
| | | if (_menu.PageParam && _menu.PageParam.Template === 'RolePermission') { // 单页面修改 |
| | | let _menu_ = { |
| | | ..._menu, |
| | | ParentID: this.props.supMenu.MenuID, |
| | | Template: _menu.PageParam.Template |
| | | } |
| | | _menu.Template = _menu.PageParam.Template |
| | | |
| | | this.setState({ |
| | | handleMVisible: true, |
| | | sysMenu: _menu_ |
| | | sysMenu: _menu |
| | | }) |
| | | |
| | | return |
| | |
| | | } |
| | | |
| | | _menu.LongParam = _LongParam |
| | | _menu.ParentID = this.props.supMenu.MenuID |
| | | _menu.supMenuList = this.props.supMenuList |
| | | |
| | | |
| | | // 检测模板是否存在 |
| | | let _Template = this.state.sysTemplates.filter(temp => temp.type === _menu.PageParam.Template) |
| | |
| | | document.getElementById('root').style.overflowY = 'hidden' |
| | | }) |
| | | } else { |
| | | if (this.state.fstMenuId) { |
| | | _menu.fstMenuId = this.state.fstMenuId |
| | | _menu.fstMenuList = this.state.fstMenuList |
| | | |
| | | this.setState({ |
| | | type: 'edit', |
| | | editMenu: _menu, |
| | | loading: false, |
| | | optionLibs: new Map(), // 编辑时,初始化为空 |
| | | tabview: _menu.PageParam.Template |
| | | }, () => { |
| | | document.getElementById('root').style.overflowY = 'hidden' |
| | | }) |
| | | } else { |
| | | let _param = { |
| | | func: 's_Get_FSMenusForOpen', |
| | | SndMenuID: this.props.supMenu.MenuID, |
| | | TYPE: 20, |
| | | TypeCharOne: 'PC' |
| | | } |
| | | |
| | | Api.getSystemConfig(_param).then(result => { |
| | | if (result.status) { |
| | | _menu.fstMenuId = result.FstIDSeleted |
| | | _menu.fstMenuList = result.data.map(smenu => { |
| | | let _smenu = { |
| | | MenuID: smenu.FstID, |
| | | text: smenu.FstName, |
| | | options: smenu.SndData.map(menu => { |
| | | return { |
| | | MenuID: menu.SndID, |
| | | text: menu.SndName, |
| | | } |
| | | }) |
| | | } |
| | | return _smenu |
| | | }) |
| | | |
| | | this.setState({ |
| | | type: 'edit', |
| | | editMenu: _menu, |
| | | loading: false, |
| | | optionLibs: new Map(), // 编辑时,初始化为空 |
| | | tabview: _menu.PageParam.Template |
| | | }, () => { |
| | | document.getElementById('root').style.overflowY = 'hidden' |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | this.setState({ |
| | | type: 'edit', |
| | | editMenu: _menu, |
| | | loading: false, |
| | | optionLibs: new Map(), // 编辑时,初始化为空 |
| | | tabview: _menu.PageParam.Template |
| | | }, () => { |
| | | document.getElementById('root').style.overflowY = 'hidden' |
| | | }) |
| | | } |
| | | } else { |
| | | this.setState({ |
| | |
| | | return |
| | | } |
| | | |
| | | if (this.state.fstMenuId) { |
| | | this.setState({ |
| | | tabview: 'template', |
| | | editMenu: { |
| | | MenuID: Utils.getuuid(), |
| | | MenuName: '', |
| | | MenuNo: '', |
| | | type: '', |
| | | PageParam: '', |
| | | LongParam: '', |
| | | isSubtable: '', // 是否为主子表 |
| | | ParentID: this.props.supMenu.MenuID, |
| | | supMenuList: this.props.supMenuList, |
| | | fstMenuId: this.state.fstMenuId, |
| | | fstMenuList: this.state.fstMenuList |
| | | } |
| | | }, () => { |
| | | document.getElementById('root').style.overflowY = 'hidden' |
| | | if (!this.state.fstMenuId) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未获取到一级菜单信息,请稍等或刷新重试', |
| | | duration: 10 |
| | | }) |
| | | } else { |
| | | let _param = { |
| | | func: 's_Get_FSMenusForOpen', |
| | | SndMenuID: this.props.supMenu.MenuID, |
| | | TYPE: 20, |
| | | TypeCharOne: 'PC' |
| | | } |
| | | |
| | | Api.getSystemConfig(_param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | tabview: 'template', |
| | | editMenu: { |
| | | MenuID: Utils.getuuid(), |
| | | MenuName: '', |
| | | MenuNo: '', |
| | | type: '', |
| | | PageParam: '', |
| | | LongParam: '', |
| | | isSubtable: '', // 是否为主子表 |
| | | ParentID: this.props.supMenu.MenuID, |
| | | supMenuList: this.props.supMenuList, |
| | | fstMenuId: result.FstIDSeleted, |
| | | fstMenuList: result.data.map(smenu => { |
| | | let _smenu = { |
| | | MenuID: smenu.FstID, |
| | | text: smenu.FstName, |
| | | options: smenu.SndData.map(menu => { |
| | | return { |
| | | MenuID: menu.SndID, |
| | | text: menu.SndName, |
| | | } |
| | | }) |
| | | } |
| | | return _smenu |
| | | }) |
| | | } |
| | | }, () => { |
| | | document.getElementById('root').style.overflowY = 'hidden' |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | return |
| | | } |
| | | |
| | | |
| | | this.setState({ |
| | | tabview: 'template', |
| | | editMenu: { |
| | | MenuID: Utils.getuuid(), |
| | | MenuName: '', |
| | | MenuNo: '', |
| | | type: '', |
| | | PageParam: '', |
| | | LongParam: '', |
| | | isSubtable: '', // 是否为主子表 |
| | | ParentID: this.props.supMenu.MenuID, |
| | | supMenuList: this.props.supMenuList, |
| | | roleList: this.state.roleList, |
| | | fstMenuId: this.state.fstMenuId, |
| | | fstMenuList: this.state.fstMenuList |
| | | } |
| | | }, () => { |
| | | document.getElementById('root').style.overflowY = 'hidden' |
| | | }) |
| | | } else if (type === 'thaw') { |
| | | if (!is(fromJS(this.props.menulist), fromJS(this.state.menulist))) { |
| | | notification.warning({ |
| | |
| | | |
| | | let param = { |
| | | func: 'sPC_TrdMenu_AddUpt', |
| | | FstID: res.fstMenuId, |
| | | SndID: res.ParentID, |
| | | ParentID: res.ParentID, |
| | | MenuID: sysMenu.MenuID, |
| | |
| | | TYPE: 20, |
| | | TypeCharOne: 'PC' |
| | | } |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | |
| | | Api.getSystemConfig(_param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | fstMenuId: result.FstIDSeleted, |
| | | fstMenuList: result.data.map(smenu => { |
| | | let _smenu = { |
| | | MenuID: smenu.FstID, |
| | | text: smenu.FstName, |
| | | options: smenu.SndData.map(menu => { |
| | | return { |
| | | MenuID: menu.SndID, |
| | | text: menu.SndName, |
| | | } |
| | | }) |
| | | } |
| | | |
| | | return _smenu |
| | | let menuDefer = new Promise(resolve => { |
| | | Api.getSystemConfig(_param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | fstMenuId: result.FstIDSeleted, |
| | | fstMenuList: result.data.map(smenu => { |
| | | let _smenu = { |
| | | MenuID: smenu.FstID, |
| | | text: smenu.FstName, |
| | | options: smenu.SndData.map(menu => { |
| | | return { |
| | | MenuID: menu.SndID, |
| | | text: menu.SndName, |
| | | } |
| | | }) |
| | | } |
| | | |
| | | return _smenu |
| | | }) |
| | | }) |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | resolve() |
| | | }) |
| | | }) |
| | | |
| | | let roleDefer = new Promise(resolve => { |
| | | Api.getSystemConfig({func: 'sPC_Get_RolesMenu'}).then(res => { |
| | | if (res.status) { |
| | | this.setState({ |
| | | roleList: res.Roles.map(role => { |
| | | return { |
| | | value: role.RoleID, |
| | | text: role.RoleName |
| | | } |
| | | }) |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | resolve() |
| | | }) |
| | | }) |
| | | |
| | | Promise.all([menuDefer, roleDefer]).then(() => { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }) |
| | | } |
| | | |
| | |
| | | {!this.state.thawmenulist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />} |
| | | {this.state.thawmenulist && <TransferForm ref="trawmenu" dict={this.state.dict} menulist={this.state.thawmenulist}/>} |
| | | </Modal> |
| | | {/* 解冻菜单模态框 */} |
| | | {/* 添加系统菜单 */} |
| | | <Modal |
| | | title={this.state.sysMenu && this.state.sysMenu.isSystem ? this.state.dict['header.menu.tadd'] : this.state.dict['header.menu.tupdate']} |
| | | okText={this.state.dict['header.confirm']} |
| | |
| | | <MenuForm |
| | | menu={this.state.sysMenu} |
| | | dict={this.state.dict} |
| | | supMenuList={this.props.supMenuList} |
| | | wrappedComponentRef={(inst) => this.menuFormRef = inst} |
| | | /> |
| | | </Modal> |
| | |
| | | supMenuList: PropTypes.any // 表格数据 |
| | | } |
| | | |
| | | state = {} |
| | | state = { |
| | | menu: null |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | this.setState({ |
| | | menu: this.props.menu |
| | | }) |
| | | } |
| | | |
| | | changeMenu = (val) => { |
| | | const { menu } = this.state |
| | | |
| | | let submenu = menu.fstMenuList.filter(item => item.MenuID === val)[0] |
| | | |
| | | if (submenu) { |
| | | this.setState({ |
| | | menu: {...menu, supMenuList: submenu.options} |
| | | }, () => { |
| | | this.props.form.setFieldsValue({ParentID: submenu.options[0] ? submenu.options[0].MenuID : ''}) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | // 表单提交时检查输入值是否正确 |
| | |
| | | |
| | | render() { |
| | | const { getFieldDecorator } = this.props.form |
| | | const { menu } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | sm: { span: 16 } |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <Form {...formItemLayout} style={{paddingRight: '20px'}}> |
| | | <Row gutter={24}> |
| | | <Col span={24}> |
| | | <Form.Item label={'上级菜单'}> |
| | | <Form.Item label={'一级菜单'}> |
| | | {getFieldDecorator('fstMenuId', { |
| | | initialValue: menu.fstMenuId, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.select'] + '上级菜单!' |
| | | } |
| | | ] |
| | | })( |
| | | <Select |
| | | showSearch |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onChange={this.changeMenu} |
| | | > |
| | | {menu.fstMenuList.map(option => |
| | | <Select.Option id={option.MenuID} title={option.text} key={option.MenuID} value={option.MenuID}>{option.text}</Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | <Form.Item label={'二级菜单'}> |
| | | {getFieldDecorator('ParentID', { |
| | | initialValue: this.props.menu.ParentID, |
| | | initialValue: menu.ParentID, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | showSearch |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | > |
| | | {this.props.supMenuList.map(option => |
| | | <Select.Option id={option.id} title={option.text} key={option.id} value={option.id}>{option.text}</Select.Option> |
| | | {menu.supMenuList.map(option => |
| | | <Select.Option id={option.MenuID} title={option.text} key={option.MenuID} value={option.MenuID}>{option.text}</Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | |
| | | <Col span={24}> |
| | | <Form.Item label={'菜单名称'}> |
| | | {getFieldDecorator('MenuName', { |
| | | initialValue: this.props.menu.MenuName || '', |
| | | initialValue: menu.MenuName || '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | <Col span={24}> |
| | | <Form.Item label={'菜单参数'}> |
| | | {getFieldDecorator('MenuNo', { |
| | | initialValue: this.props.menu.MenuNo || '', |
| | | initialValue: menu.MenuNo || '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | } |
| | | |
| | | // 初始化按钮权限及创建存储过程可用字段 |
| | | export const initPermission = (permAction, permFuncField) => { |
| | | export const initPermission = (permRoles, permAction, permFuncField) => { |
| | | return { |
| | | type: user.INIT_PERMISSION, |
| | | permRoles: permRoles, |
| | | permAction: permAction, |
| | | permFuncField: permFuncField |
| | | } |
| | |
| | | editState: false, // 是否为编辑状态,值为false、true |
| | | editLevel: null, // 编辑菜单级别,值为level1、level2、level3。。。 |
| | | refreshTab: null, // 刷新tabview页面信息 |
| | | permRoles: [], |
| | | permAction: {}, |
| | | permFuncField: [] |
| | | } |
| | |
| | | // 初始化按钮权限及创建存储过程可用字段 |
| | | return { |
| | | ...state, |
| | | permRoles: action.permRoles, |
| | | permAction: action.permAction, |
| | | permFuncField: action.permFuncField |
| | | } |
| | |
| | | config = '' |
| | | } |
| | | |
| | | try { // 配置信息解析 |
| | | userConfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParamUser))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | userConfig = '' |
| | | if (result.LongParamUser) { |
| | | try { // 配置信息解析 |
| | | userConfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParamUser))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | userConfig = '' |
| | | } |
| | | } |
| | | |
| | | // 页面配置解析错误时提示 |
| | |
| | | } |
| | | |
| | | // 权限过滤 |
| | | config.action = config.action.filter(item => permAction[item.uuid] || (item.linkTab && permAction[item.linkTab])) |
| | | config.action = config.action.filter(item => permAction[item.uuid]) |
| | | config.tabgroups.forEach(group => { |
| | | if (!config[group]) return |
| | | |
| | |
| | | </div> |
| | | ) |
| | | } else if (item.type === 'colspan') { |
| | | let contents = '' |
| | | if (item.subColumn.length > 0) { |
| | | contents = item.subColumn.map(col => { |
| | | let content = '' |
| | | if (col.type === 'text' || col.type === 'textarea') { |
| | | if (col.field && record.hasOwnProperty(col.field)) { |
| | | content = `${record[col.field]}` |
| | | } |
| | | if (item.subColumn.length === 0) return '' |
| | | |
| | | content = (col.prefix || '') + content + (col.postfix || '') |
| | | } else if (col.type === 'number') { |
| | | if (col.field && record.hasOwnProperty(col.field)) { |
| | | content = +record[col.field] |
| | | } |
| | | if (content && col.format === 'thdSeparator') { |
| | | content = `${content}` |
| | | content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') |
| | | } |
| | | content = (col.prefix || '') + content + (col.postfix || '') |
| | | let contents = item.subColumn.map(col => { |
| | | let content = '' |
| | | if (col.type === 'text' || col.type === 'textarea') { |
| | | if (col.field && record.hasOwnProperty(col.field)) { |
| | | content = `${record[col.field]}` |
| | | } |
| | | return content |
| | | }) |
| | | } |
| | | |
| | | content = (col.prefix || '') + content + (col.postfix || '') |
| | | } else if (col.type === 'number') { |
| | | if (col.field && record.hasOwnProperty(col.field)) { |
| | | content = +record[col.field] |
| | | } |
| | | if (content && col.format === 'thdSeparator') { |
| | | content = `${content}` |
| | | content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') |
| | | } |
| | | content = (col.prefix || '') + content + (col.postfix || '') |
| | | } else if (col.type === 'picture') { |
| | | let photos = '' |
| | | if (col.field && record.hasOwnProperty(col.field)) { |
| | | photos = record[col.field].split(',') |
| | | } else { |
| | | photos = '' |
| | | } |
| | | content = <div className="picture-col"> |
| | | {photos && photos.map((url, i) => { |
| | | return <img key={`${i}`} src={url} alt=""/> |
| | | })} |
| | | </div> |
| | | } |
| | | |
| | | return content |
| | | }) |
| | | |
| | | if (contents && item.order === 'vertical2') { |
| | | let _contents = [] |
| | |
| | | |
| | | // 权限过滤 |
| | | if (this.props.menuType !== 'HS') { |
| | | config.action = config.action.filter(item => permAction[item.uuid] || (item.linkTab && permAction[item.linkTab])) |
| | | config.action = config.action.filter(item => permAction[item.uuid]) |
| | | } |
| | | |
| | | // 1、筛选字段集,2、过滤隐藏列及合并列中的字段uuid |
| | |
| | | label: item.label, |
| | | sort: _sort |
| | | }) |
| | | } else { |
| | | 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 ') |
| | |
| | | config.action.forEach((item, index) => { |
| | | if (item.OpenType === 'popview') { |
| | | btntabs.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${(index + 1) * 10}' as Sort`) |
| | | } else { |
| | | btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort`) |
| | | } |
| | | btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort`) |
| | | }) |
| | | |
| | | btnParam.LText = btnParam.LText.join(' union all ') |
| | |
| | | |
| | | let Ltext = `create proc ${param.innerFunc} |
| | | ( /*${menu.MenuName}*/ |
| | | @appkey nvarchar(50)='', |
| | | @BID nvarchar(50)='',${formParam} |
| | | @PageIndex nvarchar(50)='', |
| | | @PageSize nvarchar(50)='', |
| | |
| | | |
| | | let Ltext = `create proc ${param.funcName} |
| | | ( /*${menu.MenuName} ${btn.label}*/ |
| | | @appkey nvarchar(50)='', |
| | | @BID nvarchar(50)='',${formParam} |
| | | @sEPTMenuNo nvarchar(50)='${param.menuNo}', |
| | | @lang nvarchar(50)='', |
| | |
| | | |
| | | let Ltext = `create proc ${param.funcName} |
| | | ( /*${menu.MenuName} ${btn.label}*/ |
| | | @appkey nvarchar(50)='', |
| | | @ID nvarchar(50)='', |
| | | @BID nvarchar(50)='', |
| | | @Ltext nvarchar(max)='', |
| | |
| | | document.getElementById('darea').style.width = '700px' |
| | | } else if (document.body.offsetWidth < 1920) { |
| | | document.getElementById('darea').style.width = '800px' |
| | | } else { |
| | | document.getElementById('darea').style.width = '1000px' |
| | | } |
| | | } |
| | | |
| | |
| | | this.loadFields(result.data[0].TableName) |
| | | } |
| | | |
| | | this.handleResize() |
| | | this.setState({ |
| | | config: _config, |
| | | editItemId: _config.uuid, |
| | |
| | | static cachesketch (context, resolve) { |
| | | let cacheCanvas = context.canvas |
| | | let canvas = document.getElementById('darea') |
| | | |
| | | canvas.width = cacheCanvas.width |
| | | canvas.height = cacheCanvas.height |
| | | let ctx = canvas.getContext('2d') |