king
2023-06-12 f7d523cf17268148b92d9e3932c476b1172bfb7c
Merge branch 'develop'
2个文件已修改
116 ■■■■■ 已修改文件
src/tabviews/custom/components/table/edit-table/normalTable/index.jsx 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/table/edit-table/normalTable/index.scss 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
@@ -2,7 +2,7 @@
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { Table, Typography, Modal, Input, InputNumber, Button, notification, message, Select } from 'antd'
import { EditOutlined } from '@ant-design/icons'
import { EditOutlined, QuestionCircleOutlined } from '@ant-design/icons'
import moment from 'moment'
import Api from '@/api'
@@ -918,7 +918,9 @@
    orderfields: {},      // 排序id与field转换
    loading: false,
    pageOptions: [],
    deForms: null
    deForms: null,
    visible: false,
    midData: null
  }
  UNSAFE_componentWillMount () {
@@ -1074,23 +1076,18 @@
  }
  transferData = (menuid, data, type) => {
    const { MenuID, setting } = this.props
    const { MenuID } = this.props
    const { edData } = this.state
    if (menuid !== MenuID) return
    if (type !== 'line') {
      if (setting.editType === 'multi' && data.length > 0) {
        this.setState({edData: []}, () => {
          this.setState({edData: data})
        })
      } else {
        this.setState({edData: data})
      }
      let index = edData.findIndex(item => !item.$origin && !item.$forbid)
      if (setting.addable && data.length === 0) {
        setTimeout(() => {
          this.plusLine(true)
        }, 10)
      if (index > -1) {
        this.setState({visible: true, midData: data})
      } else {
        this.updateMutil(data)
      }
    } else if (type === 'line') {
      let _edData = this.state.edData.map(item => {
@@ -1102,6 +1099,24 @@
      })
      this.setState({edData: _edData})
    }
  }
  updateMutil = (data) => {
    const { setting } = this.props
    if (setting.editType === 'multi' && data.length > 0) {
      this.setState({edData: []}, () => {
        this.setState({edData: data, visible: false, midData: null})
      })
    } else {
      this.setState({edData: data, visible: false, midData: null})
    }
    if (setting.addable && data.length === 0) {
      setTimeout(() => {
        this.plusLine(true)
      }, 10)
    }
  }
@@ -1597,6 +1612,8 @@
    const { submit, BID, setting } = this.props
    const { forms } = this.state
    this.setState({visible: false, midData: null})
    if (setting.supModule && !BID) {
      notification.warning({
        top: 92,
@@ -1672,27 +1689,9 @@
    }
  }
  updataLine = (item) => {
    if (item.$type === 'del') {
      let _data = this.state.edData.filter(m => m.$$uuid !== item.$$uuid)
      this.setState({edData: _data})
    } else {
      let _data = this.state.edData.map(m => {
        if (m.$$uuid === item.$$uuid) {
          item.$origin = true
          return item
        }
        return m
      })
      this.setState({edData: _data})
    }
    MKEmitter.emit('reloadData', this.props.MenuID, item.$$uuid)
  }
  execSuccess = (res) => {
    const { submit } = this.props
    const { edData } = this.state
    if (res && res.ErrCode === 'S') { // 执行成功
      notification.success({
@@ -1708,8 +1707,18 @@
    }
    let _edData = fromJS(edData).toJS()
    _edData = _edData.map(item => {
      if (!item.$forbid) {
        item.$origin = true
      }
      return item
    })
    this.setState({
      loading: false
      loading: false,
      edData: _edData
    })
    if (submit.closetab === 'true') {
@@ -1858,7 +1867,7 @@
  render() {
    const { setting, lineMarks, submit } = this.props
    const { tableId, edData, columns, loading, pageOptions, selectedRowKeys } = this.state
    const { tableId, edData, columns, loading, pageOptions, selectedRowKeys, visible, midData } = this.state
    const components = {
      body: {
@@ -1867,7 +1876,6 @@
      }
    }
    // 数据收起时,过滤已选数据
    let _data = edData.filter(item => !item.$deleted)
    // 设置表格选择属性:单选、多选、不可选
@@ -1926,6 +1934,21 @@
          />
          {setting.hasSubmit && _data.length > 10 ? <Button style={submit.style} onClick={() => setTimeout(() => {this.submit()}, 10)} loading={loading} className="submit-footer-table" type="link">提交</Button> : null}
        </div>
        <Modal
          className="mk-user-confirm"
          visible={visible}
          width={450}
          maskClosable={false}
          closable={false}
          footer={[
            <Button key="cancel" onClick={() => { this.setState({ visible: false, midData: null }) }}>取消</Button>,
            <Button key="refresh" className="table-refresh" onClick={() => { midData && this.updateMutil(midData) }}>刷新表格</Button>,
            <Button key="confirm" type="primary" onClick={() => setTimeout(() => {this.submit()}, 10)}>提交数据</Button>
          ]}
          destroyOnClose
        >
          <div><QuestionCircleOutlined />表格中有数据尚未提交</div>
        </Modal>
      </>
    )
  }
src/tabviews/custom/components/table/edit-table/normalTable/index.scss
@@ -398,3 +398,24 @@
    margin-bottom: 10px!important;
  }
}
.mk-user-confirm {
  top: 30vh;
  .ant-modal-body {
    font-size: 16px;
  }
  .anticon-question-circle {
    color: orange;
    font-size: 16px;
    margin-right: 5px;
  }
  .ant-modal-footer {
    border-top: 0px;
    padding: 10px 20px 25px 0px;
    .table-refresh, .table-refresh:hover, .table-refresh:active, .table-refresh:focus {
      color: #fff!important;
      background-color: #ff4d4f!important;
      border-color: #ff4d4f!important;
    }
  }
}