From e8edfdadb561cd83bf6e1c3e00d55b8cc2aee6d5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 17 十月 2022 17:57:34 +0800 Subject: [PATCH] 2022-10-17 --- src/menu/components/table/base-table/columns/index.jsx | 73 +++--------------------------------- 1 files changed, 6 insertions(+), 67 deletions(-) diff --git a/src/menu/components/table/base-table/columns/index.jsx b/src/menu/components/table/base-table/columns/index.jsx index 44be56a..a928fa8 100644 --- a/src/menu/components/table/base-table/columns/index.jsx +++ b/src/menu/components/table/base-table/columns/index.jsx @@ -3,13 +3,11 @@ import { is, fromJS } from 'immutable' import { DndProvider, DragSource, DropTarget } from 'react-dnd' import { Table, Popover, Modal, message } from 'antd' -import { PlusOutlined, FileSyncOutlined, EditOutlined, CopyOutlined, DeleteOutlined, FontColorsOutlined, CloseCircleOutlined, AntDesignOutlined } from '@ant-design/icons' +import { PlusOutlined, EditOutlined, CopyOutlined, DeleteOutlined, FontColorsOutlined, CloseCircleOutlined, AntDesignOutlined } from '@ant-design/icons' import asyncComponent from '@/utils/asyncComponent' import asyncIconComponent from '@/utils/asyncIconComponent' import Utils from '@/utils/utils.js' -import zhCN from '@/locales/zh-CN/model.js' -import enUS from '@/locales/en-US/model.js' import MKEmitter from '@/utils/events.js' import './index.scss' @@ -194,7 +192,6 @@ } state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, appType: sessionStorage.getItem('appType'), tableId: '', data: [{uuid: Utils.getuuid()}], @@ -313,11 +310,10 @@ cell.uuid = Utils.getuuid() cell.focus = true - MKEmitter.emit('cardAddElement', [this.props.config.uuid, col.uuid], cell) + MKEmitter.emit('cardAddElement', col.uuid, cell) } addElement = (col) => { - const { config } = this.props let column = fromJS(col).toJS() if (column.type === 'colspan') { @@ -333,7 +329,7 @@ let newcard = {uuid: Utils.getuuid(), focus: true, width: 24, eleType: 'text', datatype: 'dynamic', style: {paddingLeft: '4px'}} // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 - MKEmitter.emit('cardAddElement', [config.uuid, column.uuid], newcard) + MKEmitter.emit('cardAddElement', column.uuid, newcard) } else if (column.type === 'action') { let newcard = { uuid: Utils.getuuid(), @@ -349,7 +345,7 @@ } // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 - MKEmitter.emit('cardAddElement', [config.uuid, column.uuid], newcard) + MKEmitter.emit('cardAddElement', column.uuid, newcard) } } @@ -502,61 +498,6 @@ }) } - syncfield = () => { - const { fields } = this.state - let columns = fromJS(this.state.columns).toJS() - - columns = columns.filter(c => !c.origin) - - let keys = columns.map(col => col.field) - - fields.forEach(item => { - if (keys.includes(item.field)) return - - let cell = { uuid: Utils.getuuid(), label: item.label, field: item.field, Align: 'left', Hide: 'false', IsSort: 'true', Width: 120, blacklist: [], postfix: '', prefix: '', linkmenu: [], marks: [], perspective: 'linkmenu' } - - if (/Nvarchar|date/ig.test(item.datatype)) { - cell.type = 'text' - cell.rowspan = 'false' - cell.textFormat = 'none' - } else { - cell.type = 'number' - cell.format = 'none' - cell.sum = 'false' - cell.decimal = item.decimal || 0 - cell.Width = 80 - } - - columns.push(cell) - }) - - const _this = this - - confirm({ - content: '纭畾鍚屾瀛楁闆嗗悧锛�', - onOk() { - _this.setState({columns}, () => { - _this.props.updatecolumn({..._this.props.config, cols: columns}) - }) - }, - onCancel() {} - }) - } - - clear = () => { - const _this = this - - confirm({ - content: '纭畾娓呯┖鏄剧ず鍒楀悧锛�', - onOk() { - _this.setState({columns: []}, () => { - _this.props.updatecolumn({..._this.props.config, cols: []}) - }) - }, - onCancel() {} - }) - } - /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆 */ @@ -568,7 +509,7 @@ render() { const { config } = this.props - const { fields, card, lineMarks, dict, tableId, appType } = this.state + const { fields, card, lineMarks, tableId, appType } = this.state const components = { header: { cell: DragableHeaderCol @@ -585,8 +526,6 @@ <div className="col-control"> <CopyOutlined title="澶嶅埗鏄剧ず鍒�" onClick={this.copycolumn} /> <MarkColumn columns={fields} type="line" marks={lineMarks} onSubmit={this.updateLineMarks} /> - <FileSyncOutlined title="鍚屾瀛楁闆�" onClick={this.syncfield} /> - <DeleteOutlined title="娓呯┖鏄剧ず鍒�" onClick={this.clear}/> </div> <DndProvider> <Table @@ -609,7 +548,7 @@ /> {appType === 'mob' && config.setting.laypage !== 'fasle' ? <MobPagination /> : null} </DndProvider> - <EditColumn column={card} dict={dict} fields={fields} submitCol={this.submitCol} cancelCol={this.cancelCol}/> + <EditColumn column={card} fields={fields} submitCol={this.submitCol} cancelCol={this.cancelCol}/> </div> ) } -- Gitblit v1.8.0