From 3c3c5b4e5f239b712eb837af7f732ce5ab3e859f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 17 二月 2022 13:34:08 +0800 Subject: [PATCH] 2022-02-17 --- src/templates/zshare/editTable/index.jsx | 19 ++++++++++++++++++- 1 files changed, 18 insertions(+), 1 deletions(-) diff --git a/src/templates/zshare/editTable/index.jsx b/src/templates/zshare/editTable/index.jsx index 9e5ab27..6869200 100644 --- a/src/templates/zshare/editTable/index.jsx +++ b/src/templates/zshare/editTable/index.jsx @@ -3,7 +3,7 @@ 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 { CopyOutlined, EditOutlined, DeleteOutlined, SnippetsOutlined } from '@ant-design/icons' +import { CopyOutlined, EditOutlined, DeleteOutlined, SnippetsOutlined, SwapOutlined } from '@ant-design/icons' import Utils from '@/utils/utils.js' import ColorSketch from '@/mob/colorsketch' @@ -221,6 +221,7 @@ <div className={'edit-operation-btn' + (editingKey !== '' ? ' disabled' : '')} style={{minWidth: '110px', whiteSpace: 'nowrap'}}> {actions.includes('edit') ? <span className="primary" onClick={() => {editingKey === '' && this.edit(record.uuid)}}><EditOutlined /></span> : null} {actions.includes('copy') ? <span className="copy" onClick={() => {editingKey === '' && this.copy(record)}}><CopyOutlined /></span> : null} + {actions.includes('status') ? <span className="status" onClick={() => {editingKey === '' && this.handleStatus(record)}}><SwapOutlined /></span> : null} {actions.includes('del') && editingKey === '' ? <Popconfirm overlayClassName="popover-confirm" title={eTDict['model.query.delete']} @@ -412,6 +413,22 @@ }) } + handleStatus = (record) => { + const { data } = this.state + + record.status = record.status === 'false' ? 'true' : 'false' + + let newData = data.map(item => { + if (record.uuid === item.uuid) return record + + return item + }) + + this.setState({ data: newData }, () => { + this.props.onChange(newData) + }) + } + onSave = (record) => { const { columns } = this.state const newData = [...this.state.data] -- Gitblit v1.8.0