From e739b47d88c14c2d83ad400d74241f9396e5d7cc Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 03 十二月 2020 14:35:37 +0800 Subject: [PATCH] 2020-12-03 --- /dev/null | 11 ----------- src/menu/components/card/cardcellcomponent/index.jsx | 4 ++++ src/menu/components/table/normal-table/columns/index.scss | 17 ++++++++++++++--- src/components/barcode/index.scss | 1 + src/menu/components/table/normal-table/columns/index.jsx | 2 +- src/menu/actioncomponent/actionform/index.jsx | 3 --- src/tabviews/zshare/normalTable/index.scss | 6 +++--- 7 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/components/barcode/index.scss b/src/components/barcode/index.scss index 19eafbc..b0f66e1 100644 --- a/src/components/barcode/index.scss +++ b/src/components/barcode/index.scss @@ -1,6 +1,7 @@ .barcode-box { overflow-y: hidden; height: 100%; + float: left; svg { vertical-align: top; } diff --git a/src/menu/actioncomponent/actionform/index.jsx b/src/menu/actioncomponent/actionform/index.jsx index 176e55f..1c2d31a 100644 --- a/src/menu/actioncomponent/actionform/index.jsx +++ b/src/menu/actioncomponent/actionform/index.jsx @@ -58,9 +58,6 @@ text: this.props.dict['header.form.action.audit'] }], deleteOptions: [{ - value: '', - text: this.props.dict['model.empty'] - }, { value: 'LogicDelete', text: this.props.dict['header.form.action.LogicDelete'] }, { diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx index 7ffc65a..ed96872 100644 --- a/src/menu/components/card/cardcellcomponent/index.jsx +++ b/src/menu/components/card/cardcellcomponent/index.jsx @@ -69,6 +69,10 @@ this.setState({ elements: fromJS(nextProps.elements).toJS() }) + } else if (nextProps.elements.length === 0 && this.state.elements.length > 0) { + this.setState({ + elements: [] + }) } } diff --git a/src/menu/components/table/normal-table/cardcomponent/index.jsx b/src/menu/components/table/normal-table/cardcomponent/index.jsx deleted file mode 100644 index 7cf24f4..0000000 --- a/src/menu/components/table/normal-table/cardcomponent/index.jsx +++ /dev/null @@ -1,207 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { Modal, Popover, Icon } from 'antd' - -import asyncComponent from '@/utils/asyncComponent' -import zhCN from '@/locales/zh-CN/model.js' -import enUS from '@/locales/en-US/model.js' -import SettingForm from './settingform' - -import Utils from '@/utils/utils.js' -import MKEmitter from '@/utils/events.js' -import './index.scss' - -const CardCellComponent = asyncComponent(() => import('../../cardcellcomponent')) - -class CardBoxComponent extends Component { - static propTpyes = { - cards: PropTypes.object, // 鍗$墖琛岄厤缃俊鎭� - card: PropTypes.object, // 鍗$墖閰嶇疆淇℃伅 - deleteElement: PropTypes.func, // 鍗$墖鍒犻櫎 - updateElement: PropTypes.func // 鑿滃崟閰嶇疆鏇存柊 - } - - state = { - dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, - card: null, // 鍗$墖淇℃伅锛屽寘鎷鍙嶉潰 - formlist: null, // 璁剧疆琛ㄥ崟淇℃伅 - elements: null, // 缂栬緫缁� - visible: false, // 妯℃�佹鎺у埗 - settingVisible: false, - } - - /** - * @description 鎼滅储鏉′欢鍒濆鍖� - */ - UNSAFE_componentWillMount () { - const { card } = this.props - - this.setState({ - card: fromJS(card).toJS(), - elements: fromJS(card.elements).toJS(), - }) - } - - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - } - - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props.cards), fromJS(nextProps.cards)) || !is(fromJS(this.state), fromJS(nextState)) - } - - /** - * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆 - */ - componentWillUnmount () { - this.setState = () => { - return - } - MKEmitter.removeListener('submitStyle', this.getStyle) - } - - getStyle = (comIds, style) => { - const { cards } = this.props - const { card } = this.state - - if (comIds.length !== 2 || comIds[0] !== cards.uuid || comIds[1] !== card.uuid) return - - let _card = fromJS(card).toJS() - _card.style = style - - this.setState({ - card: _card - }) - - this.props.updateElement(_card) - } - - updateCard = (elements) => { - const { card } = this.state - - let _card = {...card, elements: elements} - - this.setState({ - card: _card - }) - - this.props.updateElement(_card) - } - - addElement = () => { - const { cards } = this.props - const { card } = this.state - - let newcard = {} - newcard.uuid = Utils.getuuid() - newcard.focus = true - - newcard.eleType = 'text' - newcard.datatype = 'dynamic' - newcard.color = 'rgba(0,0,0,0.85)' - newcard.padding = '5px' - newcard.align = 'left' - - // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 - MKEmitter.emit('cardAddElement', [cards.uuid, card.uuid], newcard) - } - - addButton = () => { - const { cards } = this.props - const { card } = this.state - - let newcard = {} - newcard.uuid = Utils.getuuid() - newcard.focus = true - - newcard.eleType = 'button' - newcard.label = 'button' - newcard.sqlType = '' - newcard.Ot = 'requiredSgl' - newcard.OpenType = 'prompt' - newcard.icon = '' - newcard.class = 'primary' - newcard.intertype = 'system' - newcard.execSuccess = 'grid' - newcard.execError = 'never' - newcard.popClose = 'never' - newcard.errorTime = 10 - newcard.verify = null - newcard.show = 'link' - - // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 - MKEmitter.emit('cardAddElement', [cards.uuid, card.uuid], newcard) - } - - changeStyle = () => { - const { cards } = this.props - const { card } = this.state - - let _style = null - let options = ['height', 'background', 'border', 'padding', 'margin'] - _style = card.style ? fromJS(card.style).toJS() : {} - - MKEmitter.emit('changeStyle', [cards.uuid, card.uuid], options, _style) - } - - settingSubmit = () => { - const { card } = this.state - - this.settingRef.handleConfirm().then(res => { - this.setState({ - settingVisible: false, - card: {...card, setting: res} - }) - - this.props.updateElement({...card, setting: res}) - }) - } - - render() { - const { cards } = this.props - const { card, elements, settingVisible, dict } = this.state - - return ( - <div className="ant-col ant-col-24"> - <div className="card-item" style={card.style}> - <CardCellComponent cards={cards} cardCell={card} elements={elements} updateElement={this.updateCard}/> - <div className="card-control"> - <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ - <div className="mk-popover-control"> - <Icon className="plus" title="娣诲姞鍏冪礌" onClick={this.addElement} type="plus" /> - <Icon className="plus" title="娣诲姞鎸夐挳" onClick={this.addButton} type="plus-square" /> - <Icon className="edit" type="edit" onClick={() => this.setState({settingVisible: true})} /> - <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" /> - <Icon className="close" title="鍒犻櫎鍗$墖" type="delete" onClick={() => this.props.deleteElement(card)} /> - </div> - } trigger="hover"> - <Icon type="tool" /> - </Popover> - </div> - </div> - <Modal - wrapClassName="popview-modal" - title={'琛岃缃�'} - visible={settingVisible} - width={700} - maskClosable={false} - okText={dict['model.submit']} - onOk={this.settingSubmit} - onCancel={() => { this.setState({ settingVisible: false }) }} - destroyOnClose - > - <SettingForm - dict={dict} - cards={cards} - setting={card.setting} - inputSubmit={this.settingSubmit} - wrappedComponentRef={(inst) => this.settingRef = inst} - /> - </Modal> - </div> - ) - } -} - -export default CardBoxComponent \ No newline at end of file diff --git a/src/menu/components/table/normal-table/cardcomponent/index.scss b/src/menu/components/table/normal-table/cardcomponent/index.scss deleted file mode 100644 index e69de29..0000000 --- a/src/menu/components/table/normal-table/cardcomponent/index.scss +++ /dev/null diff --git a/src/menu/components/table/normal-table/cardcomponent/settingform/index.jsx b/src/menu/components/table/normal-table/cardcomponent/settingform/index.jsx deleted file mode 100644 index ba0dcf4..0000000 --- a/src/menu/components/table/normal-table/cardcomponent/settingform/index.jsx +++ /dev/null @@ -1,131 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { Form, Row, Col, Radio, Tooltip, Icon, Input, Select } from 'antd' - -import './index.scss' - -class SettingForm extends Component { - static propTpyes = { - dict: PropTypes.object, // 瀛楀吀椤� - cards: PropTypes.object, // 鍗$墖闆� - setting: PropTypes.object, // 鏁版嵁婧愰厤缃� - inputSubmit: PropTypes.func // 鍥炶溅浜嬩欢 - } - - state = { - condition: this.props.setting.condition || 'false' - } - - handleConfirm = () => { - // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� - return new Promise((resolve, reject) => { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - resolve(values) - } else { - reject(err) - } - }) - }) - } - - handleSubmit = (e) => { - e.preventDefault() - - if (this.props.inputSubmit) { - this.props.inputSubmit() - } - } - - render() { - const { setting, cards } = this.props - const { getFieldDecorator } = this.props.form - - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 8 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 16 } - } - } - - return ( - <div className="model-menu-setting-form"> - <Form {...formItemLayout}> - <Row gutter={24}> - <Col span={12}> - <Form.Item label={ - <Tooltip placement="topLeft" title="褰撻�夋嫨鈥滄湁鈥濇椂锛屽彧鏈夌鍚堟潯浠剁殑鏁版嵁鎵嶄細灞曠ず銆�"> - <Icon type="question-circle" /> - 鏄剧ず鏉′欢 - </Tooltip> - }> - {getFieldDecorator('condition', { - initialValue: setting.condition || 'false' - })( - <Radio.Group onChange={(e) => this.setState({ condition: e.target.value })}> - <Radio value="true">鏈�</Radio> - <Radio value="false">鏃�</Radio> - </Radio.Group> - )} - </Form.Item> - </Col> - {this.state.condition === 'true' ? <Col span={12}> - <Form.Item label="鎺у埗瀛楁"> - {getFieldDecorator('controlField', { - initialValue: setting.controlField || '', - rules: [ - { - required: true, - message: this.props.dict['form.required.select'] + '鎺у埗瀛楁!' - } - ] - })( - <Select> - {cards.columns.map((option, index) => - <Select.Option key={index} value={option.field}> - {option.label} - </Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> : null} - {this.state.condition === 'true' ? <Col span={12}> - <Form.Item label="瀵规瘮鏂瑰紡"> - {getFieldDecorator('controlType', { - initialValue: setting.controlType || '=', - rules: [ - { - required: true, - message: this.props.dict['form.required.select'] + '瀵规瘮鏂瑰紡!' - } - ] - })( - <Radio.Group> - <Radio value="=">=</Radio> - <Radio value="!=">!=</Radio> - <Radio value=">">></Radio> - <Radio value="<"><</Radio> - </Radio.Group> - )} - </Form.Item> - </Col> : null} - {this.state.condition === 'true' ? <Col span={12}> - <Form.Item label="瀵规瘮鍊�"> - {getFieldDecorator('controlValue', { - initialValue: setting.controlValue || '' - })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit}/>)} - </Form.Item> - </Col> : null} - </Row> - </Form> - </div> - ) - } -} - -export default Form.create()(SettingForm) \ No newline at end of file diff --git a/src/menu/components/table/normal-table/cardcomponent/settingform/index.scss b/src/menu/components/table/normal-table/cardcomponent/settingform/index.scss deleted file mode 100644 index 159130b..0000000 --- a/src/menu/components/table/normal-table/cardcomponent/settingform/index.scss +++ /dev/null @@ -1,11 +0,0 @@ -.model-menu-setting-form { - position: relative; - - .anticon-question-circle { - color: #c49f47; - margin-right: 3px; - } - .ant-input-number { - width: 100%; - } -} \ No newline at end of file diff --git a/src/menu/components/table/normal-table/columns/index.jsx b/src/menu/components/table/normal-table/columns/index.jsx index afcd6ac..70b2e48 100644 --- a/src/menu/components/table/normal-table/columns/index.jsx +++ b/src/menu/components/table/normal-table/columns/index.jsx @@ -131,7 +131,7 @@ if (column && column.type === 'custom') { return ( - <td style={{padding: 0, verticalAlign: 'top', minWidth: column.Width || 100}} className={className}> + <td style={{padding: 0, minWidth: column.Width || 100}} className={className}> <CardCellComponent cards={config} cardCell={column} elements={column.elements} updateElement={this.updateCard}/> </td> ) diff --git a/src/menu/components/table/normal-table/columns/index.scss b/src/menu/components/table/normal-table/columns/index.scss index c3f5d58..a2428be 100644 --- a/src/menu/components/table/normal-table/columns/index.scss +++ b/src/menu/components/table/normal-table/columns/index.scss @@ -2,7 +2,15 @@ .ant-table-body { overflow-x: auto; padding-bottom: 20px; + tr td:not(.ant-table-selection-column) { + padding: 12px 8px; + background: #ffffff; + } + tr:hover td { + background: #ffffff!important; + } } + .ant-table-thead { th { position: relative; @@ -15,9 +23,12 @@ content: ''; } } - > tr > th .ant-table-column-sorter .ant-table-column-sorter-inner { - .ant-table-column-sorter-up.on, .ant-table-column-sorter-down.on { - color: unset; + > tr > th { + padding: 12px 8px; + .ant-table-column-sorter .ant-table-column-sorter-inner { + .ant-table-column-sorter-up.on, .ant-table-column-sorter-down.on { + color: unset; + } } } } diff --git a/src/tabviews/zshare/normalTable/index.scss b/src/tabviews/zshare/normalTable/index.scss index 7c068cf..ec84ea9 100644 --- a/src/tabviews/zshare/normalTable/index.scss +++ b/src/tabviews/zshare/normalTable/index.scss @@ -22,9 +22,9 @@ tr { th { position: relative; - .ant-table-column-title { - white-space: nowrap; - } + // .ant-table-column-title { + // white-space: nowrap; + // } } } } -- Gitblit v1.8.0