From 326aa6b3effaccc71cfe0775d47b0f29eb3695a6 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 25 八月 2024 00:36:40 +0800 Subject: [PATCH] 2024-08-25 --- src/mob/searchconfig/index.jsx | 94 +++++++++++++++++++++++------------------------ 1 files changed, 46 insertions(+), 48 deletions(-) diff --git a/src/mob/searchconfig/index.jsx b/src/mob/searchconfig/index.jsx index 5e1e966..fbfc001 100644 --- a/src/mob/searchconfig/index.jsx +++ b/src/mob/searchconfig/index.jsx @@ -3,13 +3,11 @@ import { is, fromJS } from 'immutable' import { DndProvider } from 'react-dnd' import HTML5Backend from 'react-dnd-html5-backend' -import moment from 'moment' -import { Button, Modal, Collapse, notification, Switch, Icon } from 'antd' +import { Button, Modal, Collapse, notification, Switch } from 'antd' +import { SettingOutlined, LeftOutlined, SearchOutlined, PlusOutlined } from '@ant-design/icons' import Api from '@/api' import Utils from '@/utils/utils.js' -import zhCN from '@/locales/zh-CN/model.js' -import enUS from '@/locales/en-US/model.js' import { getSearchForm } from '@/templates/zshare/formconfig' import SourceElement from '@/templates/modalconfig/dragelement/source' import SettingForm from './settingform' @@ -21,7 +19,7 @@ const { Panel } = Collapse const { confirm } = Modal const SearchForm = asyncComponent(() => import('@/templates/sharecomponent/searchcomponent/searchform')) -const PasteComponent = asyncComponent(() => import('./pastecomponent')) +// const PasteComponent = asyncComponent(() => import('./pastecomponent')) const DragElement = asyncComponent(() => import('./searchdragelement')) const GDragElement = asyncComponent(() => import('./groupdragelement')) const GroupForm = asyncComponent(() => import('./groupform')) @@ -34,7 +32,6 @@ } state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, // 瀛楀吀 config: null, // 椤甸潰閰嶇疆锛屽寘鎷ā鏉跨被鍨嬨�佹ā鎬佹璁剧疆銆佹坊鍔犺〃鍚嶃�佽〃鍗曞垪琛� visible: false, // 琛ㄥ崟缂栬緫妯℃�佹锛屾樉绀烘帶鍒� formlist: null, // 琛ㄥ崟缂栬緫妯℃�佹锛屽彲缂栬緫瀛楁 @@ -143,12 +140,25 @@ * @description 琛ㄥ崟缂栬緫 */ handleForm = (_card) => { + const { group } = this.state let card = fromJS(_card).toJS() + let linkableFields = [] + + group.fields.forEach(item => { + if (item.uuid === card.uuid) return + if (!['select', 'link', 'checkcard'].includes(item.type)) return + if (item.type === 'checkcard' && item.multiple === 'true') return + + linkableFields.push({ + value: item.field, + text: item.label + }) + }) this.setState({ visible: true, card: card, - formlist: getSearchForm(card, []) + formlist: getSearchForm(card, linkableFields) }) } @@ -213,29 +223,17 @@ return } - if (['checkcard'].includes(res.type) && res.resourceType === '1' && /\s/.test(res.dataSource)) { + if (['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.LText = param.LText.replace(/@\$|\$@/ig, '') + 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.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt('', param.timestamp) - - if (window.GLOB.mainSystemApi && res.database === 'sso') { - param.rduri = window.GLOB.mainSystemApi - } - - Api.getLocalConfig(param).then(result => { - if (result.status) { + Api.sDebug(sql).then(result => { + if (result.status || result.ErrCode === '-2') { this.setState({ sqlVerifing: false, group: _group, @@ -266,18 +264,18 @@ * @description 琛ㄥ崟鍒犻櫎骞跺埛鏂� */ closeForm = (card) => { - let _this = this + let that = this confirm({ content: `纭畾鍒犻櫎${card.label ? `<<${card.label}>>` : ''}鍚楋紵`, onOk() { - let _group = fromJS(_this.state.group).toJS() + let _group = fromJS(that.state.group).toJS() _group.fields = _group.fields.filter(item => item.uuid !== card.uuid) - _this.setState({ + that.setState({ group: _group, }) - _this.resetConfig(_group) + that.resetConfig(_group) }, onCancel() {} }) @@ -298,11 +296,11 @@ const { config, originConfig } = this.state if (!is(fromJS(config), fromJS(originConfig))) { - let _this = this + let that = this confirm({ content: '閰嶇疆淇℃伅鏈繚瀛橈紝纭畾杩斿洖鍚楋紵', onOk() { - _this.props.handleBack() + that.props.handleBack() }, onCancel() {} }) @@ -448,15 +446,15 @@ } closeGroup = (g) => { - const _this = this + const that = this let _group = fromJS(this.state.group).toJS() _group.groups = _group.groups.filter(item => item.uuid !== g.uuid) confirm({ content: `纭畾鍒犻櫎鍒嗙粍銆�${g.wrap.name}銆嬪悧锛焋, onOk() { - _this.setState({ group: _group }) - _this.resetConfig(_group) + that.setState({ group: _group }) + that.resetConfig(_group) }, onCancel() {} }) @@ -471,13 +469,14 @@ } render () { - const { dict, group, editGroup, saving } = this.state + const { group, editGroup, saving } = this.state + return ( <div className="mob-search-board"> <DndProvider backend={HTML5Backend}> <div className="tools"> <Collapse accordion defaultActiveKey="1" bordered={false}> - <Panel header={dict['header.menu.form']} key="1"> + <Panel header="鎼滅储鏉′欢" key="1"> <div className="search-element"> {SearchItems.map((item, index) => { return (<SourceElement key={index} content={item}/>) @@ -490,22 +489,22 @@ <Button type="primary" loading={saving} onClick={this.submitConfig}>淇濆瓨</Button> <Button onClick={this.cancelConfig}>鍏抽棴</Button> {!group.floor ? <Button onClick={this.returnUp}>杩斿洖涓婄骇</Button> : null} - <PasteComponent insert={this.insert} /> - <Switch checkedChildren={dict['model.switch.open']} unCheckedChildren={dict['model.switch.close']} defaultChecked={this.state.showField} onChange={(val) => this.setState({showField: val})} /> + {/* <PasteComponent insert={this.insert} /> */} + <Switch checkedChildren="寮�" unCheckedChildren="鍏�" defaultChecked={this.state.showField} onChange={(val) => this.setState({showField: val})} /> </div> <div className="setting"> <div className="mob-shell" style={{width: window.GLOB.shellWidth, height: window.GLOB.shellHeight}}> <div className="mob-shell-inner" style={{backgroundColor: group.setting.backgroundColor || '#ffffff'}}> - <Icon className="setting-group" onClick={this.changeSetting} type="setting" /> + <SettingOutlined className="setting-group" onClick={this.changeSetting}/> {group.setting.type === 'title' ? <div className="am-navbar"> - <Icon type="left" /> + <LeftOutlined /> <div className="am-navbar-title">{group.setting.title}</div> </div> : <div className="am-navbar"> - {/* <Icon type="left" /> */} - <div className="search-bar"><Icon type="search" /></div> + {/* <LeftOutlined /> */} + <div className="search-bar"><SearchOutlined style={{marginRight: '10px'}}/>{group.setting.label || ''}</div> <Button >鍙栨秷</Button> </div>} - {group.floor === 1 ? <Icon className="plus-group" type="plus" onClick={this.plusGroup} /> : null} + {group.floor === 1 ? <PlusOutlined className="plus-group" onClick={this.plusGroup} /> : null} <div style={{minHeight: 'calc(100% - 100px)'}}> {group.floor === 1 && group.groups.length > 0 ? <GDragElement list={group.groups} @@ -531,16 +530,15 @@ </div> </DndProvider> <Modal - title={this.state.dict['model.edit']} + title="缂栬緫" visible={this.state.visible} - width={850} + width={950} onCancel={this.editModalCancel} onOk={this.handleSubmit} confirmLoading={this.state.sqlVerifing} destroyOnClose > <SearchForm - dict={this.state.dict} card={this.state.card} formlist={this.state.formlist} inputSubmit={this.handleSubmit} @@ -548,7 +546,7 @@ /> </Modal> <Modal - title={this.state.dict['model.edit']} + title="缂栬緫" visible={this.state.settingVisible} width={850} maskClosable={false} @@ -563,7 +561,7 @@ /> </Modal> <Modal - title={this.state.dict['model.edit']} + title="缂栬緫" visible={this.state.gVisible} width={600} maskClosable={false} -- Gitblit v1.8.0