king
2024-09-10 4d6b9f8a2d7b316633e43b489eae9ada949c07b5
src/pc/components/navbar/normal-navbar/menusetting/menutable/index.jsx
@@ -1,11 +1,11 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { Table, Button, Modal, Icon } from 'antd'
import { Table, Button, Modal } from 'antd'
import { PlusOutlined, ArrowUpOutlined, ArrowDownOutlined } from '@ant-design/icons'
import MenuForm from '../menuform'
import Utils from '@/utils/utils.js'
// import MKEmitter from '@/utils/events.js'
import './index.scss'
const { confirm } = Modal
@@ -21,7 +21,7 @@
    editMenu: null,
    columns: [
      { title: '菜单名称', dataIndex: 'name', key: 'name' },
      { title: '菜单参数', dataIndex: 'MenuNo', key: 'MenuNo' },
      // { title: '菜单参数', dataIndex: 'MenuNo', key: 'MenuNo' },
      { title: '菜单属性', dataIndex: 'property', key: 'property',  render: text => {
        const trans = {menu: '菜单', link: '链接', linkmenu: '关联菜单', classify: '分类'}
@@ -42,8 +42,8 @@
        (<div>
          <Button type="link" style={{padding: '0 5px', marginRight: '5px'}} onClick={() => this.editMenu(record)}>编辑</Button>
          <Button type="link" style={{color: '#ff4d4f', padding: '0 5px', marginRight: '5px'}} onClick={() => this.delMenu(record)}>删除</Button>
          <Icon type="arrow-up" style={{color: '#26C281', cursor: 'pointer', padding: '0 5px', marginRight: '5px'}} onClick={() => this.moveUp(record)}/>
          <Icon type="arrow-down" style={{color: '#ff4d4f', cursor: 'pointer', padding: '0 5px'}} onClick={() => this.moveDown(record)}/>
          <ArrowUpOutlined style={{color: '#26C281', cursor: 'pointer', padding: '0 5px', marginRight: '5px'}} onClick={() => this.moveUp(record)}/>
          <ArrowDownOutlined style={{color: '#ff4d4f', cursor: 'pointer', padding: '0 5px'}} onClick={() => this.moveDown(record)}/>
        </div>)
      }
    ]
@@ -88,15 +88,15 @@
  delMenu = (record) => {
    const { menu } = this.props
    const _this = this
    const that = this
    
    confirm({
      title: '确定删除吗?',
      content: '',
      onOk() {
        let _data = _this.state.data.filter(item => item.MenuID !== record.MenuID)
        _this.setState({data: _data})
        _this.props.menuUpdate({...menu, sublist: _data})
        let _data = that.state.data.filter(item => item.MenuID !== record.MenuID)
        that.setState({data: _data})
        that.props.menuUpdate({...menu, sublist: _data})
      },
      onCancel() {}
    })
@@ -137,9 +137,9 @@
        })
      }
      if (editMenu.MenuID && editMenu.property === 'menu' && _menu.property !== 'menu') {
        const _this = this
        const that = this
        confirm({
          content: '菜单属性由“菜单”切换至其他类型时,菜单将被重置,即解除之前菜单的绑定关系,确定修改吗?',
          content: '菜单将被重置,确定修改吗?',
          onOk() {
            _data = _data.map(item => {
              if (item.MenuID === _menu.MenuID) {
@@ -147,8 +147,8 @@
              }
              return item
            })
            _this.setState({data: _data, editMenu: null, visible: false})
            _this.props.menuUpdate({...menu, sublist: _data})
            that.setState({data: _data, editMenu: null, visible: false})
            that.props.menuUpdate({...menu, sublist: _data})
          },
          onCancel() {}
        })
@@ -164,7 +164,7 @@
    return (
      <div className="thdmenu-control-wrap">
        <Icon type="plus" style={{color: '#26C281', padding: '5px', fontSize: '16px'}} onClick={this.plusMenu}/>
        <PlusOutlined style={{color: '#26C281', padding: '5px', fontSize: '16px'}} onClick={this.plusMenu}/>
        <Table
          rowKey="MenuID"
          size="small"
@@ -203,7 +203,7 @@
    editMenu: null,
    columns: [
      { title: '菜单名称', dataIndex: 'name', key: 'name' },
      { title: '菜单参数', dataIndex: 'MenuNo', key: 'MenuNo' },
      // { title: '菜单参数', dataIndex: 'MenuNo', key: 'MenuNo' },
      { title: '菜单属性', dataIndex: 'property', key: 'property',  render: text => {
        const trans = {menu: '菜单', link: '链接', linkmenu: '关联菜单', classify: '分类'}
@@ -224,8 +224,8 @@
        (<div>
          <Button type="link" style={{padding: '0 5px', marginRight: '5px'}} onClick={() => this.editMenu(record)}>编辑</Button>
          <Button type="link" style={{color: '#ff4d4f', padding: '0 5px', marginRight: '5px'}} onClick={() => this.delMenu(record)}>删除</Button>
          <Icon type="arrow-up" style={{color: '#26C281', cursor: 'pointer', padding: '0 5px', marginRight: '5px'}} onClick={() => this.moveUp(record)}/>
          <Icon type="arrow-down" style={{color: '#ff4d4f', cursor: 'pointer', padding: '0 5px'}} onClick={() => this.moveDown(record)}/>
          <ArrowUpOutlined style={{color: '#26C281', cursor: 'pointer', padding: '0 5px', marginRight: '5px'}} onClick={() => this.moveUp(record)}/>
          <ArrowDownOutlined style={{color: '#ff4d4f', cursor: 'pointer', padding: '0 5px'}} onClick={() => this.moveDown(record)}/>
        </div>)
      }
    ]
@@ -271,15 +271,15 @@
  delMenu = (record) => {
    const { menu } = this.props
    const _this = this
    const that = this
    
    confirm({
      title: (record.property === 'classify' && record.sublist.length > 0 ? '菜单下含有子菜单,' : '') + '确定删除吗?',
      content: '',
      onOk() {
        let _data = _this.state.data.filter(item => item.MenuID !== record.MenuID)
        _this.setState({data: _data})
        _this.props.menuUpdate({...menu, sublist: _data})
        let _data = that.state.data.filter(item => item.MenuID !== record.MenuID)
        that.setState({data: _data})
        that.props.menuUpdate({...menu, sublist: _data})
      },
      onCancel() {}
    })
@@ -320,9 +320,9 @@
        })
      }
      if (editMenu.MenuID && editMenu.property === 'menu' && _menu.property !== 'menu') {
        const _this = this
        const that = this
        confirm({
          content: '菜单属性由“菜单”切换至其他类型时,菜单将被重置,即解除之前菜单的绑定关系,确定修改吗?',
          content: '菜单将被重置,确定修改吗?',
          onOk() {
            _data = _data.map(item => {
              if (item.MenuID === _menu.MenuID) {
@@ -330,8 +330,8 @@
              }
              return item
            })
            _this.setState({data: _data, editMenu: null, visible: false})
            _this.props.menuUpdate({...menu, sublist: _data})
            that.setState({data: _data, editMenu: null, visible: false})
            that.props.menuUpdate({...menu, sublist: _data})
          },
          onCancel() {}
        })
@@ -362,7 +362,7 @@
    return (
      <div className="submenu-control-wrap">
        <Icon type="plus" style={{color: '#26C281', padding: '5px', fontSize: '16px'}} onClick={this.plusMenu}/>
        <PlusOutlined style={{color: '#26C281', padding: '5px', fontSize: '16px'}} onClick={this.plusMenu}/>
        <Table
          size="middle"
          rowKey="MenuID"
@@ -402,7 +402,7 @@
    editMenu: null,
    columns: [
      { title: '菜单名称', dataIndex: 'name', key: 'name' },
      { title: '菜单参数', dataIndex: 'MenuNo', key: 'MenuNo' },
      // { title: '菜单参数', dataIndex: 'MenuNo', key: 'MenuNo' },
      { title: '菜单属性', dataIndex: 'property', key: 'property',  render: text => {
        const trans = {menu: '菜单', link: '链接', linkmenu: '关联菜单', classify: '分类'}
@@ -423,8 +423,8 @@
        (<div>
          <Button type="link" style={{padding: '0 5px', marginRight: '5px'}} onClick={() => this.editMenu(record)}>编辑</Button>
          <Button type="link" style={{color: '#ff4d4f', padding: '0 5px', marginRight: '5px'}} onClick={() => this.delMenu(record)}>删除</Button>
          <Icon type="arrow-up" style={{color: '#26C281', cursor: 'pointer', padding: '0 5px', marginRight: '5px'}} onClick={() => this.moveUp(record)}/>
          <Icon type="arrow-down" style={{color: '#ff4d4f', cursor: 'pointer', padding: '0 5px'}} onClick={() => this.moveDown(record)}/>
          <ArrowUpOutlined style={{color: '#26C281', cursor: 'pointer', padding: '0 5px', marginRight: '5px'}} onClick={() => this.moveUp(record)}/>
          <ArrowDownOutlined style={{color: '#ff4d4f', cursor: 'pointer', padding: '0 5px'}} onClick={() => this.moveDown(record)}/>
        </div>)
      }
    ]
@@ -466,13 +466,13 @@
  delMenu = (record) => {
    const { data } = this.state
    const _this = this
    const that = this
    confirm({
      title: (record.property === 'classify' && record.sublist.length > 0 ? '菜单下含有子菜单,' : '') + '确定删除吗?',
      content: '',
      onOk() {
        _this.setState({data: data.filter(item => item.MenuID !== record.MenuID)})
        that.setState({data: data.filter(item => item.MenuID !== record.MenuID)})
      },
      onCancel() {}
    })
@@ -513,9 +513,9 @@
      }
      if (editMenu.MenuID && editMenu.property === 'menu' && _menu.property !== 'menu') {
        const _this = this
        const that = this
        confirm({
          content: '菜单属性由“菜单”切换至其他类型时,菜单将被重置,即解除之前菜单的绑定关系,确定修改吗?',
          content: '菜单将被重置,确定修改吗?',
          onOk() {
            _data = _data.map(item => {
              if (item.MenuID === _menu.MenuID) {
@@ -523,7 +523,7 @@
              }
              return item
            })
            _this.setState({data: _data, editMenu: null, visible: false})
            that.setState({data: _data, editMenu: null, visible: false})
          },
          onCancel() {}
        })