From ae170a9d58b4f91a225eada1dc83ed4a116b8d50 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 25 八月 2024 00:57:37 +0800 Subject: [PATCH] 2024-08-25 --- src/templates/sharecomponent/columncomponent/index.jsx | 63 +++++++++++++++---------------- 1 files changed, 31 insertions(+), 32 deletions(-) diff --git a/src/templates/sharecomponent/columncomponent/index.jsx b/src/templates/sharecomponent/columncomponent/index.jsx index 357dfd8..e488a3d 100644 --- a/src/templates/sharecomponent/columncomponent/index.jsx +++ b/src/templates/sharecomponent/columncomponent/index.jsx @@ -1,12 +1,10 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Tooltip, Modal, notification, Switch, message } from 'antd' -import { QuestionCircleOutlined, CopyOutlined } from '@ant-design/icons' +import { Modal, notification, Switch, message } from 'antd' +import { CopyOutlined } from '@ant-design/icons' -import zhCN from '@/locales/zh-CN/model.js' -import enUS from '@/locales/en-US/model.js' -import { getColumnForm } from '@/templates/zshare/formconfig' +import { getColumnForm } from './formconfig' import ColumnForm from './columnform' import ColspanForm from './colspanform' @@ -26,7 +24,6 @@ } state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, columnlist: null, // 鏄剧ず鍒� showField: true, // 鏄剧ず鍒楀瓧娈� modaltype: '', // 妯℃�佹鎺у埗 @@ -283,13 +280,12 @@ */ deleteElement = (card) => { const { config } = this.props - const { dict } = this.state - let _this = this + let that = this confirm({ - content: dict['model.confirm'] + dict['model.delete'] + ` - ${card.label} 锛焋, + content: `纭畾鍒犻櫎 - ${card.label} 锛焋, onOk() { - let _columnlist = fromJS(_this.state.columnlist).toJS() + let _columnlist = fromJS(that.state.columnlist).toJS() _columnlist = _columnlist.filter(item => item.uuid !== card.uuid) @@ -355,10 +351,10 @@ } } - _this.setState({ + that.setState({ columnlist: _columnlist }, ()=> { - _this.props.updatecolumn({...config, columns: _columnlist}) + that.props.updatecolumn({...config, columns: _columnlist}) }) }, onCancel() {} @@ -375,6 +371,11 @@ let val = { copyType: 'columns', columns: columnlist + } + + let srcid = localStorage.getItem(window.GLOB.sysSign + 'srcId') + if (srcid) { + val.$srcId = srcid } oInput.value = window.btoa(window.encodeURIComponent(JSON.stringify(val))) @@ -469,11 +470,18 @@ }) } + // revert = () => { + // this.setState({ + // columnlist: fromJS(this.props.config.columns).toJS() + // }) + // } + shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) } componentDidMount () { + // MKEmitter.addListener('revert', this.revert) MKEmitter.addListener('plusColumns', this.plusColumns) } @@ -484,22 +492,18 @@ this.setState = () => { return } + // MKEmitter.removeListener('revert', this.revert) MKEmitter.removeListener('plusColumns', this.plusColumns) } render() { const { config } = this.props - const { modaltype, columnlist, dict, card } = this.state + const { modaltype, columnlist, card } = this.state return ( <div className="model-table-column-list"> - <Tooltip placement="bottomLeft" overlayClassName="middle" title={dict['model.tooltip.column.guide']}> - <QuestionCircleOutlined style={{color: '#c49f47', position: 'relative', left: '-15px', top: '5px'}} /> - </Tooltip> - {columnlist && columnlist.length > 0 ? - <CopyOutlined className="column-copy" title="copy" onClick={this.copycolumn} /> : null - } - <Switch checkedChildren={dict['model.switch.open']} unCheckedChildren={dict['model.switch.close']} defaultChecked={this.state.showField} onChange={this.onFieldChange} /> + {columnlist && columnlist.length > 0 ? <CopyOutlined className="column-copy" title="copy" onClick={this.copycolumn} /> : null} + <Switch checkedChildren="寮�" unCheckedChildren="鍏�" defaultChecked={this.state.showField} onChange={this.onFieldChange} /> <DragElement list={columnlist} setting={config.setting} @@ -510,20 +514,18 @@ markMenu={this.markElement} handleGridBtn={this.handleGridBtn} showfield={this.state.showField} - placeholder={this.state.dict['header.form.column.placeholder']} /> {/* 鏄剧ず鍒楃紪杈� */} <Modal - title={dict['header.modal.column.edit']} + title="鏄剧ず鍒�-缂栬緫" visible={modaltype === 'columns'} - width={800} + width={850} maskClosable={false} onOk={this.handleSubmit} onCancel={this.editModalCancel} destroyOnClose > <ColumnForm - dict={dict} card={card} MenuID={this.props.menu.MenuID} inputSubmit={this.handleSubmit} @@ -533,16 +535,15 @@ </Modal> {/* 鍚堝苟鍒楃紪杈� */} <Modal - title={dict['model.form.colspan'] + '-' + dict['model.edit']} + title="鍚堝苟鍒�-缂栬緫" visible={modaltype === 'colspan'} - width={800} + width={850} maskClosable={false} onOk={this.handleSubmit} onCancel={this.editModalCancel} destroyOnClose > <ColspanForm - dict={dict} card={card} inputSubmit={this.handleSubmit} columns={columnlist} @@ -551,16 +552,15 @@ </Modal> {/* 鎿嶄綔鍒楃紪杈� */} <Modal - title={dict['header.modal.gridbtn.edit']} + title="鎿嶄綔鍒�-缂栬緫" visible={modaltype === 'gridbtn'} - width={800} + width={850} maskClosable={false} onOk={this.handleSubmit} onCancel={this.editModalCancel} destroyOnClose > <GridBtnForm - dict={dict} inputSubmit={this.handleSubmit} card={config.gridBtn} wrappedComponentRef={(inst) => this.gridBtnFormRef = inst} @@ -573,7 +573,7 @@ visible={modaltype === 'mark'} width={'75vw'} maskClosable={false} - okText={dict['model.submit']} + okText="鎻愪氦" onOk={this.markSubmit} onCancel={() => { this.setState({ modaltype: '' }) }} destroyOnClose @@ -581,7 +581,6 @@ <MarkColumn ref="markRef" card={card} - dict={dict} columns={columnlist} /> </Modal> -- Gitblit v1.8.0