From f3d4db769ba9b51b799d981511a710fd443d0e08 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 21 四月 2025 12:18:03 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/menu/components/search/main-search/index.jsx | 82 +++++++++++++++++++++------------------- 1 files changed, 43 insertions(+), 39 deletions(-) diff --git a/src/menu/components/search/main-search/index.jsx b/src/menu/components/search/main-search/index.jsx index 6998ffd..c87bbd9 100644 --- a/src/menu/components/search/main-search/index.jsx +++ b/src/menu/components/search/main-search/index.jsx @@ -3,7 +3,6 @@ import { is, fromJS } from 'immutable' import { Modal, notification, Popover, Switch, message } from 'antd' import { PlusOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons' -import moment from 'moment' import Api from '@/api' import Utils from '@/utils/utils.js' @@ -121,19 +120,19 @@ this.props.updateConfig(component) } - checkComponent = (component) => { - this.updateComponent(component) + // checkComponent = (component) => { + // this.updateComponent(component) - let _item = null - component.search.forEach(item => { - if (!_item && item.focus) { - _item = item - } - }) - if (_item) { - this.handleSearch(_item) - } - } + // let _item = null + // component.search.forEach(item => { + // if (!_item && item.focus) { + // _item = item + // } + // }) + // if (_item) { + // this.handleSearch(_item) + // } + // } /** * @description 鎼滅储鏉′欢椤哄簭璋冩暣锛屾垨鎷栨嫿娣诲姞 @@ -251,29 +250,16 @@ return } - if (['select', 'multiselect', 'link', 'checkcard'].includes(res.type) && res.resourceType === '1' && /\s/.test(res.dataSource)) { + if (['select', 'multiselect', 'link', 'checkcard'].includes(res.type) && res.resourceType === '1' && res.database !== 'sso' && /\s/.test(res.dataSource)) { this.setState({ sqlVerifing: true }) - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: res.dataSource - } - - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) - param.LText = param.LText.replace(/\n/g, ' ') + let sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) + ${res.dataSource}` + sql = sql.replace(/@\$|\$@/ig, '') - param.LText = Utils.formatOptions(param.LText) - param.secretkey = Utils.encrypt('', param.timestamp) - - if (window.GLOB.mainSystemApi && res.database === 'sso') { - param.rduri = window.GLOB.mainSystemApi - } - - Api.genericInterface(param).then(result => { + Api.sDebug(sql).then(result => { if (result.status || result.ErrCode === '-2') { this.setState({ sqlVerifing: false, @@ -303,15 +289,15 @@ * @description 鎼滅储鏉′欢鍒犻櫎 */ deleteElement = (cell) => { - let _this = this + let that = this confirm({ content: `纭畾鍒犻櫎 - ${cell.label} 锛焋, onOk() { - let _card = fromJS(_this.state.card).toJS() + let _card = fromJS(that.state.card).toJS() _card.search = _card.search.filter(item => item.uuid !== cell.uuid) - _this.updateComponent(_card) + that.updateComponent(_card) }, onCancel() {} }) @@ -329,6 +315,11 @@ match: 'like', focus: true } + + if (card.search.length) { + item.ratio = card.search[card.search.length - 1].ratio + } + card.search.push(item) this.setState({card}, () => { @@ -355,6 +346,18 @@ _card.search.push(item) this.updateComponent(_card) + this.handleSearch(item) + } else if (type === 'replace') { + delete item.focus + _card.search = _card.search.map(cell => { + if (cell.field && cell.field.toLowerCase() === item.field.toLowerCase()) { + return item + } + return cell + }) + + this.updateComponent(_card) + this.handleSearch(item) } else if (type === 'multil') { _card.search.push(...item) @@ -363,9 +366,9 @@ } getWrapForms = () => { - const { wrap, action } = this.state.card + const { card } = this.state - return getWrapForm(wrap, action) + return getWrapForm(card.wrap, card.uuid) } updateWrap = (res) => { @@ -389,7 +392,7 @@ let _style = resetStyle(card.style) return ( - <div className={`main-search-edit-list ${card.wrap.float} ${showField ? 'show-field' : ''}`} onClick={this.clickComponent} id={card.uuid} style={_style}> + <div className={`main-search-edit-list ${card.wrap.float} ${showField ? 'show-field' : ''} mk-size-${card.wrap.searchSize || ''}`} onClick={this.clickComponent} id={card.uuid} style={_style}> <FieldsComponent config={card} type="search" /> <Switch checkedChildren="寮�" size="small" unCheckedChildren="鍏�" defaultChecked={showField} onChange={this.onFieldChange} /> <DragElement @@ -406,7 +409,8 @@ <EditOutlined style={{color: '#1890ff'}} title="缂栬緫"/> </NormalForm> <CopyComponent type="mainsearch" card={card}/> - <PasteComponent config={card} options={['search', 'form']} updateConfig={this.checkComponent} /> + {/* <PasteComponent config={card} options={['search', 'form']} updateConfig={this.checkComponent} /> */} + <PasteComponent config={card} options={['search', 'form']} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> <DeleteOutlined className="close" onClick={() => this.props.deletecomponent(card.uuid)} /> </div> @@ -429,7 +433,7 @@ title="鎼滅储鏉′欢-缂栬緫" wrapClassName="mk-scroll-modal" visible={visible} - width={850} + width={950} maskClosable={false} onOk={this.handleSubmit} confirmLoading={sqlVerifing} -- Gitblit v1.8.0