| | |
| | | import DragElement from '../menuelement' |
| | | import MenuForm from '../menuform' |
| | | import Api from '@/api' |
| | | import zhCN from '@/locales/zh-CN/header.js' |
| | | import enUS from '@/locales/en-US/header.js' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import './index.scss' |
| | | |
| | | import card1 from '@/assets/img/card-bg2.jpg' |
| | |
| | | } |
| | | |
| | | handleMenu = (menu) => { |
| | | const { dict } = this.state |
| | | |
| | | // 菜单编辑:修改、删除,如菜单顺序已改变,提示保存菜单顺序 |
| | | const _this = this |
| | | if (!is(fromJS(this.props.menulist), fromJS(this.state.menulist))) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['header.menu.presave'], |
| | | message: dict['model.menu.presave'], |
| | | duration: 5 |
| | | }) |
| | | } else if (menu.type === 'close') { |
| | | confirm({ |
| | | title: this.state.dict['header.menu.close'].replace('@M', menu.card.text), |
| | | title: dict['model.menu.close'].replace('@M', menu.card.text), |
| | | content: '', |
| | | okText: this.state.dict['header.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | okText: dict['model.confirm'], |
| | | cancelText: dict['model.cancel'], |
| | | onOk() { |
| | | let param = { |
| | | func: 'sPC_MainMenu_Del', |
| | |
| | | } else if (menu.type === 'edit') { |
| | | this.setState({ |
| | | visible: true, |
| | | title: this.state.dict['header.menu.editTitle'], |
| | | title: dict['model.edit'] + dict['model.menu'], |
| | | type: 'edit', |
| | | editMenu: menu.card, |
| | | formlist: [ |
| | | { // 父级菜单 |
| | | type: 'select', |
| | | key: 'parentId', |
| | | label: this.state.dict['header.menu.supMenu'], |
| | | label: dict['model.super'] + dict['model.menu'], |
| | | initVal: this.props.supMenu.MenuID, |
| | | required: true, |
| | | options: this.props.supMenuList |
| | |
| | | { // 菜单名称 |
| | | type: 'text', |
| | | key: 'menuName', |
| | | label: this.state.dict['header.menu.menuName'], |
| | | label: dict['model.menu'] + dict['model.name'], |
| | | initVal: menu.card.text, |
| | | required: true, |
| | | readonly: false |
| | |
| | | { // 菜单图标 |
| | | type: 'select', |
| | | key: 'icon', |
| | | label: this.state.dict['header.menu.icon'], |
| | | label: dict['model.icon'], |
| | | initVal: menu.card.PageParam.Icon, |
| | | required: true, |
| | | options: [{ |
| | |
| | | } |
| | | |
| | | handleSubBtn = (type) => { |
| | | const { dict } = this.state |
| | | |
| | | // 操作按钮 |
| | | if (type === 'add') { // 添加新菜单 |
| | | this.setState({ |
| | | visible: true, |
| | | title: this.state.dict['header.menu.addtitle'], |
| | | title: dict['model.add'] + dict['model.menu'], |
| | | type: 'add', |
| | | formlist: [ |
| | | { // 父级菜单 |
| | | type: 'select', |
| | | key: 'parentId', |
| | | label: this.state.dict['header.menu.supMenu'], |
| | | label: dict['model.super'] + dict['model.menu'], |
| | | initVal: this.props.supMenu.MenuID, |
| | | required: true, |
| | | options: this.props.supMenuList |
| | |
| | | { // 菜单名称 |
| | | type: 'text', |
| | | key: 'menuName', |
| | | label: this.state.dict['header.menu.menuName'], |
| | | label: dict['model.menu'] + dict['model.name'], |
| | | initVal: '', |
| | | required: true, |
| | | readonly: false |
| | |
| | | { // 菜单图标 |
| | | type: 'select', |
| | | key: 'icon', |
| | | label: this.state.dict['header.menu.icon'], |
| | | label: dict['model.icon'], |
| | | initVal: 'folder', |
| | | required: true, |
| | | options: [{ |
| | |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) // md5密钥 |
| | | |
| | | confirm({ |
| | | title: this.state.dict['header.menu.resetorder'], |
| | | title: this.state.dict['model.menu.resetorder'], |
| | | content: '', |
| | | okText: this.state.dict['header.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | return Api.getSystemConfig(param).then(res => { |
| | | if (res.status) { |
| | |
| | | if (this.refs.trawmenu.state.targetKeys.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['header.menu.thawmenu.select'], |
| | | message: this.state.dict['form.required.select'] + this.state.dict['model.menu'], |
| | | duration: 5 |
| | | }) |
| | | } else { |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { dict } = this.state |
| | | |
| | | return ( |
| | | <div className="second-edit-box"> |
| | | <div className="mask"> |
| | |
| | | <Icon type="plus" /> |
| | | </div> |
| | | <div className="menu-btn"> |
| | | <Button type="primary" onClick={() => {this.handleSubBtn('thaw')}}>{this.state.dict['header.thawmenu']}</Button> |
| | | <Button type="primary" onClick={() => {this.handleSubBtn('confirm')}}>{this.state.dict['header.confirm']}</Button> |
| | | <Button onClick={() => {this.handleSubBtn('close')}}>{this.state.dict['header.close']}</Button> |
| | | <Button type="primary" onClick={() => {this.handleSubBtn('thaw')}}>{dict['model.thaw'] + dict['model.menu']}</Button> |
| | | <Button type="primary" onClick={() => {this.handleSubBtn('confirm')}}>{dict['model.confirm']}</Button> |
| | | <Button onClick={() => {this.handleSubBtn('close')}}>{dict['model.close']}</Button> |
| | | </div> |
| | | <Modal |
| | | title={this.state.title} |
| | | okText={this.state.dict['header.confirm']} |
| | | cancelText={this.state.dict['header.cancel']} |
| | | okText={dict['model.confirm']} |
| | | cancelText={dict['model.cancel']} |
| | | visible={this.state.visible} |
| | | onOk={this.memuHandleSubmit} |
| | | confirmLoading={this.state.confirmLoading} |
| | |
| | | > |
| | | {this.state.formlist && |
| | | <MenuForm |
| | | dict={this.state.dict} |
| | | dict={dict} |
| | | formlist={this.state.formlist} |
| | | wrappedComponentRef={(inst) => this.menuFormRef = inst} |
| | | />} |
| | | </Modal> |
| | | <Modal |
| | | title={this.state.dict['header.thawmenu']} |
| | | okText={this.state.dict['header.confirm']} |
| | | cancelText={this.state.dict['header.cancel']} |
| | | title={dict['model.thaw'] + dict['model.menu']} |
| | | okText={dict['model.confirm']} |
| | | cancelText={dict['model.cancel']} |
| | | visible={this.state.thawMvisible} |
| | | onOk={this.thawMemuSubmit} |
| | | confirmLoading={this.state.confirmLoading} |