From 4c538565bd930279c9e32234617aa25804b19dee Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 05 四月 2023 13:15:40 +0800 Subject: [PATCH] 2023-04-05 --- src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx | 2 src/mob/colorsketch/index.jsx | 57 ++++++++++++++++++- src/templates/zshare/editTable/index.jsx | 20 +++++- src/menu/datasource/verifycard/index.scss | 28 +++++++++ src/templates/zshare/formconfig.jsx | 2 src/menu/components/table/base-table/columns/editColumn/formconfig.jsx | 2 src/menu/transfer/index.jsx | 2 src/menu/datasource/index.jsx | 4 + src/templates/sharecomponent/fieldscomponent/index.jsx | 2 src/menu/components/card/cardcellcomponent/formconfig.jsx | 2 src/mob/colorsketch/index.scss | 17 +++++ src/templates/zshare/editTable/index.scss | 3 + src/menu/datasource/verifycard/index.jsx | 27 ++++++--- src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx | 2 14 files changed, 149 insertions(+), 21 deletions(-) diff --git a/src/menu/components/card/cardcellcomponent/formconfig.jsx b/src/menu/components/card/cardcellcomponent/formconfig.jsx index 6069ecf..01a75b3 100644 --- a/src/menu/components/card/cardcellcomponent/formconfig.jsx +++ b/src/menu/components/card/cardcellcomponent/formconfig.jsx @@ -536,7 +536,7 @@ type: 'radio', key: 'eval', label: '瑙f瀽', - initVal: card.eval || 'true', + initVal: card.eval || 'false', tooltip: '褰撳叕寮忓唴瀹规秹鍙婅绠楁椂璇烽�夋嫨鈥滄槸鈥濓紝褰撳叕寮忓唴瀹逛负瀛楁鎷兼帴鏃惰閫夋嫨鈥滃惁鈥濄��', required: false, options: [{ diff --git a/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx index 29bf27a..fb51dad 100644 --- a/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx @@ -395,7 +395,7 @@ type: 'radio', key: 'eval', label: '瑙f瀽', - initVal: card.eval || 'true', + initVal: card.eval || 'false', tooltip: '褰撳叕寮忓唴瀹规秹鍙婅绠楁椂璇烽�夋嫨鈥滄槸鈥濓紝褰撳叕寮忓唴瀹逛负瀛楁鎷兼帴鏃惰閫夋嫨鈥滃惁鈥濄��', required: false, options: [ diff --git a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx index 6120716..4808dbf 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx @@ -475,7 +475,7 @@ type: 'radio', key: 'eval', label: '瑙f瀽', - initVal: card.eval || 'true', + initVal: card.eval || 'false', tooltip: '褰撳叕寮忓唴瀹规秹鍙婅绠楁椂璇烽�夋嫨鈥滄槸鈥濓紝褰撳叕寮忓唴瀹逛负瀛楁鎷兼帴鏃惰閫夋嫨鈥滃惁鈥濄��', required: false, options: [ diff --git a/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx index f1ff2b1..7bf4cd5 100644 --- a/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx @@ -415,7 +415,7 @@ type: 'radio', key: 'eval', label: '瑙f瀽', - initVal: card.eval || 'true', + initVal: card.eval || 'false', tooltip: '褰撳叕寮忓唴瀹规秹鍙婅绠楁椂璇烽�夋嫨鈥滄槸鈥濓紝褰撳叕寮忓唴瀹逛负瀛楁鎷兼帴鏃惰閫夋嫨鈥滃惁鈥濄��', required: false, options: [ diff --git a/src/menu/datasource/index.jsx b/src/menu/datasource/index.jsx index c40ff35..2de2760f 100644 --- a/src/menu/datasource/index.jsx +++ b/src/menu/datasource/index.jsx @@ -162,6 +162,8 @@ } return item }) + + res.columns.reverse() } let maxScript = 0 @@ -200,6 +202,8 @@ if (config.subtype !== 'dualdatacard') { delete res.subColumns + } else { + res.subColumns.reverse() } this.setState({loading: false, visible: false}) diff --git a/src/menu/datasource/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx index dcb2c3d..814c6df 100644 --- a/src/menu/datasource/verifycard/index.jsx +++ b/src/menu/datasource/verifycard/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { Form, Tabs, Popconfirm, notification, Modal, Typography, Spin, message, Button } from 'antd' +import { Form, Tabs, Popconfirm, notification, Modal, Typography, Spin, message, Button, Input } from 'antd' import { StopOutlined, CheckCircleOutlined, EditOutlined, SwapOutlined, DeleteOutlined, CopyOutlined, BorderOutlined, SnippetsOutlined } from '@ant-design/icons' import moment from 'moment' @@ -20,6 +20,7 @@ const { TabPane } = Tabs const { Paragraph } = Typography +const { Search } = Input const CodeMirror = asyncComponent(() => import('@/templates/zshare/codemirror')) const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent')) @@ -35,6 +36,7 @@ subColumns: [], activeKey: 'setting', loading: false, + searchKey: '', initsql: '', // sql楠岃瘉鏃跺彉閲忓0鏄庡強璧嬪�� usefulfields: '', defaultsql: '', // 榛樿Sql @@ -194,15 +196,21 @@ _search = _search.replace(/@\$@/ig, '') _search = _search ? 'where ' + _search : '' + let columns = config.columns ? fromJS(config.columns).toJS() : [] + let subColumns = config.subColumns ? fromJS(config.subColumns).toJS() : [] + + columns.reverse() + subColumns.reverse() this.setState({ scripts, - columns: config.columns ? fromJS(config.columns).toJS() : [], - subColumns: config.subColumns ? fromJS(config.subColumns).toJS() : [], + columns: columns, + subColumns: subColumns, setting: _setting, median: _setting, searches: search, - defaultSearch: _search + defaultSearch: _search, + searchKey: '' }) this.getsysScript() @@ -273,7 +281,7 @@ values.uuid = Utils.getuuid() - this.setState({ columns: [...columns, values] }) + this.setState({ columns: [values, ...columns] }) } subColumnChange = (values, resolve) => { @@ -293,7 +301,7 @@ values.uuid = Utils.getuuid() - this.setState({ subColumns: [...subColumns, values] }) + this.setState({ subColumns: [values, ...subColumns] }) } deleteScript = (record) => { @@ -931,7 +939,7 @@ render() { const { config } = this.props - const { columns, subColumns, median, setting, scripts, colColumns, scriptsColumns, activeKey, loading, searches, defaultsql, visible, pvisible, reload, script, scriptValue } = this.state + const { columns, subColumns, median, setting, scripts, colColumns, scriptsColumns, activeKey, loading, searches, defaultsql, visible, pvisible, reload, script, scriptValue, searchKey } = this.state return ( <div className="model-data-source-wrap"> @@ -965,7 +973,7 @@ type="fields" updatefield={this.updatefields} /> - <EditTable actions={['edit', 'move', 'copy', 'del', 'clear']} type="datasourcefield" wrappedComponentRef={(inst) => this.datasource = inst} data={columns} columns={colColumns} onChange={(columns) => this.setState({columns})}/> + <EditTable actions={['edit', 'move', 'copy', 'del', 'clear']} searchKey={searchKey} type="datasourcefield" wrappedComponentRef={(inst) => this.datasource = inst} data={columns} columns={colColumns} onChange={(columns) => this.setState({columns})}/> </TabPane> : null} {config.subtype === 'dualdatacard' ? <TabPane tab={ <span> @@ -979,7 +987,7 @@ type="fields" updatefield={this.updateSubfields} /> - <EditTable actions={['edit', 'move', 'copy', 'del', 'clear']} type="datasourcefield" wrappedComponentRef={(inst) => this.subdatasource = inst} data={subColumns} columns={colColumns} onChange={(subColumns) => this.setState({subColumns})}/> + <EditTable actions={['edit', 'move', 'copy', 'del', 'clear']} searchKey={searchKey} type="datasourcefield" wrappedComponentRef={(inst) => this.subdatasource = inst} data={subColumns} columns={colColumns} onChange={(subColumns) => this.setState({subColumns})}/> </TabPane> : null} <TabPane tab={ <span> @@ -989,6 +997,7 @@ {config.type !== 'interface' && activeKey === 'setting' ? <SnippetsOutlined title="瀵煎叆鏁版嵁婧�" className="mk-paste-datasource" onClick={(e) => {e.stopPropagation();this.setState({pvisible: true})}}/> : null} {activeKey === 'columns' ? <CopyOutlined title="浠ラ�楀彿鎷兼帴褰㈠紡澶嶅埗瀛楁" className="mk-copy-fields" onClick={(e) => {e.stopPropagation();this.copyColumns()}}/> : null} {activeKey === 'subcolumns' ? <CopyOutlined title="浠ラ�楀彿鎷兼帴褰㈠紡澶嶅埗瀛楁" className="mk-copy-fields" onClick={(e) => {e.stopPropagation();this.copySubColumns()}}/> : null} + {activeKey === 'subcolumns' || activeKey === 'columns' ? <span onClick={(e) => {e.stopPropagation()}}><Search className="mk-search-fields" defaultValue={searchKey} allowClear onSearch={(val, e) => {e.stopPropagation();this.setState({searchKey: val})}} /></span> : null} </span> } key="scripts" disabled={median.interType !== 'system'} id="mk-scripts-tabpane"> {scripts.length ? <BorderOutlined className="full-scripts" onClick={() => { diff --git a/src/menu/datasource/verifycard/index.scss b/src/menu/datasource/verifycard/index.scss index b9bc0fe..c8e00e8 100644 --- a/src/menu/datasource/verifycard/index.scss +++ b/src/menu/datasource/verifycard/index.scss @@ -45,6 +45,34 @@ .mk-copy-fields:hover, .mk-copy-datasource:hover, .mk-paste-datasource:hover { opacity: 1; } + .mk-search-fields { + position: absolute; + cursor: pointer; + width: 150px; + z-index: 1; + top: 10px; + right: -240px; + display: inline-block; + .ant-input { + border-radius: 40px; + height: 30px; + transition: opacity 0.2s; + } + .ant-input:not(:hover):not(:active):not(:focus) { + opacity: 0.6; + } + .ant-input:not(:hover):not(:active):not(:focus) + .ant-input-suffix { + opacity: 0.6; + } + } + .mk-search-fields:hover { + .ant-input { + opacity: 1; + } + .ant-input-suffix { + opacity: 1; + } + } .count-tip { position: absolute; top: 0px; diff --git a/src/menu/transfer/index.jsx b/src/menu/transfer/index.jsx index 15b6805..4456af7 100644 --- a/src/menu/transfer/index.jsx +++ b/src/menu/transfer/index.jsx @@ -83,6 +83,7 @@ } } }) + tab.components[0].cols = tab.components[0].cols.filter(col => !(col.field && col.Hide === 'true')) tab.components[0].cols.forEach(col => { if (col.type !== 'action') return col.elements.forEach(btn => { @@ -108,6 +109,7 @@ } } }) + item.cols = item.cols.filter(col => !(col.field && col.Hide === 'true')) item.cols.forEach(col => { if (col.type !== 'action') return col.elements.forEach(btn => { diff --git a/src/mob/colorsketch/index.jsx b/src/mob/colorsketch/index.jsx index 6f1ba7a..58c6d9b 100644 --- a/src/mob/colorsketch/index.jsx +++ b/src/mob/colorsketch/index.jsx @@ -9,8 +9,9 @@ const presetColors = [ '#1890ff', '#f5222d', '#fa541c', '#fa8c16', '#faad14', '#fadb14', '#a0d911', '#52c41a', '#13c2c2', '#2f54eb', '#722ed1', '#eb2f96', '#aeb303', '#c32539', '#1d3661', '#ffd591', '#ffe58f', '#fffb8f', '#eaff8f', '#b7eb8f', '#87e8de', '#91d5ff', - '#adc6ff', '#d3adf7', '#EBE9E9', '#d9d9d9', '#434343', '#000000', '#ffffff', 'transparent' + '#adc6ff', '#EBE9E9', '#d9d9d9', 'rgba(0, 0, 0, 0.65)', 'rgba(0, 0, 0, 0.85)', '#000000', '#ffffff', 'transparent' ] +const _href = window.location.href.split('#')[0] class ColorSketch extends Component { static propTpyes = { @@ -20,6 +21,7 @@ } state = { color: '', + initVal: '', colors: [], allowClear: false } @@ -38,6 +40,21 @@ let _colors = sessionStorage.getItem('app_colors') let colors = JSON.parse(JSON.stringify(presetColors)) + let normal_colors = localStorage.getItem(_href + 'normal_colors') + + if (normal_colors) { + try { + normal_colors = JSON.parse(normal_colors) + } catch (e) { + normal_colors = [] + } + + normal_colors.forEach(item => { + if (!colors.includes(item)) { + colors.push(item) + } + }) + } if (_colors) { try { @@ -53,7 +70,13 @@ }) } - this.setState({color: initVal, allowClear: allowClear === true, colors}) + if (colors.length < 40) { + for (let i = colors.length; i < 40; i++) { + colors.push('transparent') + } + } + + this.setState({color: initVal, initVal, allowClear: allowClear === true, colors}) } handleChange = (color) => { @@ -77,13 +100,41 @@ } } + onVisibleChange = (status) => { + const { initVal, color } = this.state + + if (!status && color && color !== initVal) { + let normal_colors = localStorage.getItem(_href + 'normal_colors') + + if (normal_colors) { + try { + normal_colors = JSON.parse(normal_colors) + } catch (e) { + normal_colors = [] + } + } else { + normal_colors = [] + } + + normal_colors.unshift(color) + + if (normal_colors.length > 10) { + normal_colors.length = 10 + } + + localStorage.setItem(_href + 'normal_colors', JSON.stringify(normal_colors)) + } + } + + + render() { const { color, allowClear, colors } = this.state return ( <div className="color-sketch-block"> <Popover content={ <SketchPicker color={ color } presetColors={colors} onChange={ this.handleChange } /> - } overlayClassName="color-sketch-popover" placement="bottomRight" title="" trigger="click"> + } overlayClassName="color-sketch-popover" placement="bottomRight" title="" trigger="click" onVisibleChange={this.onVisibleChange}> <div className="color-sketch-block-box"> <div className="color-sketch-block-inner" style={ {background: color} }></div> </div> diff --git a/src/mob/colorsketch/index.scss b/src/mob/colorsketch/index.scss index 9aa1fc3..b08c92e 100644 --- a/src/mob/colorsketch/index.scss +++ b/src/mob/colorsketch/index.scss @@ -58,6 +58,23 @@ padding: 0; .sketch-picker { width: 250px!important; + + .flexbox-fix:last-child { + overflow: hidden; + >div:nth-child(30) { + position: relative; + margin-bottom: 20px!important; + } + >div:nth-child(30)::after { + content: ' '; + display: block; + border-bottom: 1px solid #d9d9d9; + position: absolute; + width: 300px; + bottom: -10px; + right: -20px; + } + } } } } \ No newline at end of file diff --git a/src/templates/sharecomponent/fieldscomponent/index.jsx b/src/templates/sharecomponent/fieldscomponent/index.jsx index 3066fac..590e699 100644 --- a/src/templates/sharecomponent/fieldscomponent/index.jsx +++ b/src/templates/sharecomponent/fieldscomponent/index.jsx @@ -163,7 +163,7 @@ field: item.field, datatype: _t } - items.push(newcard) + items.unshift(newcard) keys.push(item.field.toLowerCase()) }) diff --git a/src/templates/zshare/editTable/index.jsx b/src/templates/zshare/editTable/index.jsx index ff2c97f..e4e7d67 100644 --- a/src/templates/zshare/editTable/index.jsx +++ b/src/templates/zshare/editTable/index.jsx @@ -163,6 +163,7 @@ class EditTable extends Component { static propTpyes = { actions: PropTypes.any, // 鎿嶄綔椤� + searchKey: PropTypes.any, // 鎼滅储鏉′欢 data: PropTypes.any, // 鏁版嵁鍒楄〃 columns: PropTypes.array, // 鏄剧ず鍒� onChange: PropTypes.func // 鏁版嵁鍙樺寲 @@ -585,7 +586,7 @@ } render() { - const { actions, indexShow } = this.props + const { actions, indexShow, searchKey } = this.props const { editLineId } = this.state let components = { @@ -595,7 +596,7 @@ } let moveprops = {} - if (actions.includes('move')) { + if (actions.includes('move') && !searchKey) { components.body.row = DragableBodyRow moveprops.moveAble = !this.state.editingKey moveprops.moveRow = this.moveRow @@ -641,6 +642,8 @@ return item }) + let reg = searchKey ? new RegExp(searchKey, 'ig') : null + return ( <EditableContext.Provider value={this.props.form}> <div className="modal-edit-table"> @@ -651,7 +654,18 @@ components={components} dataSource={data} columns={columns} - rowClassName={record => !editLineId || editLineId !== record.uuid ? 'editable-row' : 'editable-row active'} + rowClassName={record => { + let className = 'editable-row' + if (editLineId && editLineId === record.uuid) { + className += ' active' + } + if (searchKey) { + if (!reg.test(record.field) && !reg.test(record.label)) { + className += ' hidden' + } + } + return className + }} pagination={false} onRow={(record, index) => ({ index, diff --git a/src/templates/zshare/editTable/index.scss b/src/templates/zshare/editTable/index.scss index a2f12ad..cac8205 100644 --- a/src/templates/zshare/editTable/index.scss +++ b/src/templates/zshare/editTable/index.scss @@ -31,6 +31,9 @@ background-color: #bae7ff!important; } } + .editable-row.hidden { + display: none; + } .mk-index { text-align: center; white-space: nowrap; diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index 786a6be..c79c9f0 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -3466,7 +3466,7 @@ type: 'radio', key: 'eval', label: '瑙f瀽', - initVal: card.eval || 'true', + initVal: card.eval || 'false', tooltip: '褰撳叕寮忓唴瀹规秹鍙婅绠楁椂璇烽�夋嫨鈥滄槸鈥濓紝褰撳叕寮忓唴瀹逛负瀛楁鎷兼帴鏃惰閫夋嫨鈥滃惁鈥濄��', required: false, options: [{ -- Gitblit v1.8.0