king
2023-10-19 20c83dab04d53d60b5fcd08aad3d5d9fbfb4fa5c
src/templates/zshare/editTable/index.jsx
@@ -2,13 +2,12 @@
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { DndProvider, DragSource, DropTarget } from 'react-dnd'
import { Table, Input, InputNumber, Popconfirm, Form, Select, Radio, Cascader, notification, message, Modal, Typography } from 'antd'
import { Table, Input, InputNumber, Popconfirm, Switch, Form, Select, Radio, Cascader, notification, message, Modal, Typography } from 'antd'
import { CopyOutlined, EditOutlined, DeleteOutlined, SwapOutlined, PlusOutlined } from '@ant-design/icons'
import Utils from '@/utils/utils.js'
import ColorSketch from '@/mob/colorsketch'
import asyncComponent from '@/utils/asyncComponent'
import CusSwitch from './cusSwitch'
import MKEmitter from '@/utils/events.js'
import './index.scss'
@@ -19,6 +18,52 @@
let dragingIndex = -1
const { Paragraph } = Typography
class CusSwitch extends Component {
  static propTpyes = {
    defaultValue: PropTypes.any,
    value: PropTypes.any,
    onChange: PropTypes.func
  }
  state = {
    status: true
  }
  UNSAFE_componentWillMount () {
    const { defaultValue, value } = this.props
    let initVal = 'true'
    if (this.props['data-__meta']) {
      initVal = this.props['data-__meta'].initialValue
    } else if (defaultValue) {
      initVal = defaultValue
    } else if (value) {
      initVal = value
    }
    if (initVal === 'false') {
      initVal = false
    } else {
      initVal = true
    }
    this.setState({status: initVal})
  }
  changeStatus = (val) => {
    this.setState({ status: val }, () => {
      let _val = val ? 'true' : 'false'
      this.props.onChange && this.props.onChange(_val)
    })
  }
  render() {
    const { status } = this.state
    return (
      <Switch checkedChildren="是" unCheckedChildren="否" checked={status} onChange={this.changeStatus} />
    )
  }
}
class BodyRow extends React.Component {
  render() {
    const { isOver, moveAble, connectDragSource, connectDropTarget, moveRow, ...restProps } = this.props