| | |
| | | import MenuForm from './menuform' |
| | | import Utils from '@/utils/utils.js' |
| | | import Api from '@/api' |
| | | import './index.scss' |
| | | // import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | | |
| | |
| | | editMenuModal = (Menu) => { |
| | | // 菜单编辑:修改 |
| | | const menu = fromJS(Menu).toJS() |
| | | if (!is(fromJS(this.state.menulist), fromJS(this.props.menulist))) { |
| | | if (this.state.change) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单顺序已调整,请保存!', |
| | | duration: 5 |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | visible: true, |
| | | editMenu: menu.card, |
| | | loading: false |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | editMenu: menu.card, |
| | | loading: false |
| | | }) |
| | | } |
| | | |
| | | editMemuSubmit = () => { |
| | |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | Api.getSystemConfig(param).then(res => { |
| | | Api.getCloudConfig(param).then(res => { |
| | | if (res.status) { |
| | | this.setState({ |
| | | loading: false, |
| | |
| | | } |
| | | |
| | | deleteMemu = (item) => { |
| | | if (this.state.change) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单顺序已调整,请保存!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let _this = this |
| | | confirm({ |
| | | title: `确定删除菜单《${item.MenuName}》吗?`, |
| | |
| | | func: 'sPC_MainMenu_Del', |
| | | MenuID: item.MenuID |
| | | } |
| | | return Api.getSystemConfig(param).then(res => { |
| | | return Api.getCloudConfig(param).then(res => { |
| | | if (res.status) { |
| | | _this.props.reload() |
| | | } else { |
| | |
| | | } |
| | | |
| | | handleButton = (type) => { |
| | | const that = this |
| | | // 菜单编辑:添加,确定,取消 |
| | | let _menuchange = !is(fromJS(this.state.menulist), fromJS(this.props.menulist)) |
| | | |
| | | if (type === 'confirm' && _menuchange) { |
| | | let _this = this |
| | | let param = { |
| | | func: 'sPC_Menu_SortUpt', |
| | | exec_type: 'x', |
| | | LText: this.state.menulist.map((item, index) => { |
| | | return 'select \'' + item.MenuID + '\' as Menuid,' + (index + 1) * 10 + ' as sort' |
| | | }) |
| | | } |
| | | |
| | | param.LText = param.LText.join(' union ') // sql拼接 |
| | | param.LText = Utils.formatOptions(param.LText) // 关键字符替换,base64加密 |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') // 时间戳 |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) // md5密钥 |
| | | param.LText = param.LText.join(' union ') |
| | | param.LText = Utils.formatOptions(param.LText, 'x') |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt('', param.timestamp) |
| | | |
| | | confirm({ |
| | | title: '确认调整菜单顺序吗?', |
| | | content: '', |
| | | onOk() { |
| | | return Api.getSystemConfig(param).then(res => { |
| | | return Api.getCloudConfig(param).then(res => { |
| | | if (res.status) { |
| | | _this.props.reload() |
| | | that.setState({ change: false }) |
| | | that.props.reload() |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | onCancel() {} |
| | | }) |
| | | } else if (type === 'cancel' && _menuchange) { |
| | | let _this = this |
| | | |
| | | confirm({ |
| | | title: '菜单顺序已调整,放弃保存吗?', |
| | | content: '', |
| | | onOk() { |
| | | _this.props.exitEdit() |
| | | that.props.exitEdit() |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | const { menulist, change } = this.state |
| | | |
| | | return ( |
| | | <div className="header-edit-box"> |
| | | <> |
| | | <DndProvider backend={HTML5Backend}> |
| | | <DragElement |
| | | change={change} |
| | |
| | | wrappedComponentRef={(inst) => this.editMenuFormRef = inst} |
| | | /> |
| | | </Modal> |
| | | </div> |
| | | </> |
| | | ) |
| | | } |
| | | } |