From cb9ade2afd2a367ad767bc605ab7086c695dd010 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 09 十二月 2022 15:53:32 +0800 Subject: [PATCH] 2022-12-09 --- src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx | 88 ++++++++++++++++++++++++++++++------------- 1 files changed, 61 insertions(+), 27 deletions(-) diff --git a/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx b/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx index b87cf16..66977c5 100644 --- a/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx +++ b/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx @@ -21,7 +21,6 @@ class VerifyCard extends Component { static propTpyes = { - dict: PropTypes.object, // 瀛楀吀椤� config: PropTypes.object, // 鏁版嵁婧愪俊鎭� menuId: PropTypes.string, // 鑿滃崟Id searches: PropTypes.array, // 鎼滅储鏉′欢 @@ -56,10 +55,10 @@ dataIndex: 'operation', render: (text, record) => (<div> - <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record)} style={{color: '#1890ff'}}><EditOutlined /></span> + <span className="operation-btn" title="缂栬緫" onClick={() => this.handleEdit(record)} style={{color: '#1890ff'}}><EditOutlined /></span> <Popconfirm overlayClassName="popover-confirm" - title={this.props.dict['model.query.delete']} + title="纭畾鍒犻櫎鍚�?" onConfirm={() => this.deleteColumn(record) }> <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span> @@ -119,21 +118,6 @@ handleEdit = (record) => { this.contrastForm.edit(record) - - let node = document.getElementById('model-setting-form-body').parentNode - - if (node && node.scrollTop) { - let inter = Math.ceil(node.scrollTop / 10) - - let timer = setInterval(() => { - if (node.scrollTop - inter > 0) { - node.scrollTop = node.scrollTop - inter - } else { - node.scrollTop = 0 - clearInterval(timer) - } - }, 10) - } } changeTab = (val) => { @@ -291,16 +275,17 @@ } else if (type === 'scripts' && _scripts.length === 0) { resolve() } else if (setting.execute !== 'false' || _scripts.length > 0) { + let timestamp = moment().format('YYYY-MM-DD HH:mm:ss') let param = { func: 's_debug_sql', exec_type: 'y', - LText: SettingUtils.getDebugSql(setting, _scripts, columns, Utils.getRegOptions(searches), config.calendar, config.urlFields) + LText: SettingUtils.getDebugSql(setting, _scripts, columns, this.getRegOptions(searches), config.calendar, config.urlFields, timestamp) } param.LText = Utils.formatOptions(param.LText) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt('', param.timestamp) + param.timestamp = timestamp + param.secretkey = Utils.encrypt('', timestamp) - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (result.status) { resolve() } else { @@ -313,6 +298,58 @@ } else { resolve() } + } + + getRegOptions = (searches) => { + if (!searches || searches.length === 0) return [] + + let options = [] + let fieldmap = new Map() + searches.forEach(search => { + let item = { + key: search.field, + value: '0' + } + + if (fieldmap.has(item.key)) { + item.key = item.key + '1' + } + + fieldmap.set(item.key, true) + + if (search.type === 'group') { + options.push({ + key: search.field, + value: '0' + }) + options.push({ + key: search.datefield, + value: '0' + }) + options.push({ + key: search.datefield + '1', + value: '0' + }) + options.push(item) + } else if (['datemonth', 'dateweek', 'daterange'].includes(search.type)) { + options.push(item) + options.push({ + key: item.key + '1', + value: '0' + }) + } else if (search.type === 'text' || search.type === 'select') { + item.key.split(',').forEach(field => { + let cell = JSON.parse(JSON.stringify(item)) + cell.key = field + + options.push(cell) + }) + } else { + options.push(item) + } + }) + + return options } updatefields = (columns) => { @@ -347,13 +384,12 @@ const { columns, setting, scripts, colColumns, activeKey, loading } = this.state return ( - <div className="model-verify-card-box-tab" id="model-setting-form-body"> + <div className="model-verify-card-box-tab"> {loading && <Spin size="large" />} <Tabs activeKey={activeKey} className="verify-card-box" onChange={this.changeTab}> <TabPane tab="鏁版嵁婧�" key="setting"> <SettingForm menuId={this.props.menuId} - dict={this.props.dict} columns={columns} setting={setting} scripts={scripts} @@ -362,7 +398,6 @@ </TabPane> <TabPane tab="瀛楁闆�" key="columns"> <ColForm - dict={this.props.dict} columnChange={this.columnChange} wrappedComponentRef={(inst) => this.contrastForm = inst} /> @@ -385,9 +420,8 @@ 鑷畾涔夎剼鏈� {scripts.length ? <span className="count-tip">{scripts.length}</span> : null} </span> - } key="scripts"> + } key="scripts" id="mk-setting-scripts"> <CustomScript - dict={this.props.dict} setting={setting} scripts={scripts} urlFields={config.urlFields} -- Gitblit v1.8.0