From 46aa44856bcb0e262d98918e06b4f83d2c11777a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 15 四月 2023 14:32:02 +0800 Subject: [PATCH] 2023-04-15 --- src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx | 41 +++++++++++++++++++++++++++++++++++++++-- 1 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx index e307490..3473421 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx @@ -4,6 +4,7 @@ import { Form, Tabs, Row, Col, Button, notification, Modal, message, InputNumber, Radio, Spin, Typography, Popconfirm } from 'antd' import { EditOutlined, StopOutlined, CheckCircleOutlined, SwapOutlined, DeleteOutlined } from '@ant-design/icons' import moment from 'moment' +import md5 from 'md5' import Api from '@/api' import Utils from '@/utils/utils.js' @@ -28,6 +29,7 @@ state = { verify: {}, + debugId: '', activeKey: 'setting', defaultscript: '', // 鑷畾涔夎剼鏈� excelColumns: [ @@ -585,6 +587,17 @@ } else if (activeKey === 'setting') { this.settingForm.handleConfirm().then(res => { let _verify = {...verify, ...res} + + if (res.dataType !== 'custom') { + delete _verify.tableName + delete _verify.dataresource + delete _verify.queryType + delete _verify.defaultSql + delete _verify.order + + _verify.scripts = [] + } + this.setState({ verify: _verify }, () => { @@ -995,7 +1008,7 @@ } sqlverify = (_resolve, _reject, scripts) => { - const { searches, verify } = this.state + const { searches, verify, debugId } = this.state if (verify.dataType !== 'custom') { _resolve() @@ -1004,6 +1017,14 @@ let timestamp = moment().format('YYYY-MM-DD HH:mm:ss') let sql = SettingUtils.getDebugSql(verify, scripts, (verify.useSearch === 'true' ? searches : []), Utils, timestamp) + + let _debugId = md5(sql) + + if (debugId === _debugId) { + _resolve() + return + } + let param = { func: 's_debug_sql', exec_type: 'y', @@ -1015,6 +1036,7 @@ Api.genericInterface(param).then(result => { if (result.status) { + this.setState({debugId: _debugId}) _resolve() } else { _reject() @@ -1026,7 +1048,22 @@ } updateDataType = (val) => { - this.setState({verify: {...this.state.verify, dataType: val}}) + const { config } = this.props + + let verify = {...this.state.verify, dataType: val} + if (val === 'custom' && config.setting) { + verify.tableName = verify.tableName || config.setting.tableName || '' + verify.dataresource = verify.dataresource || config.setting.dataresource || '' + verify.queryType = verify.queryType || config.setting.queryType || '' + verify.defaultSql = verify.defaultSql || config.setting.execute || '' + verify.order = verify.order || config.setting.order || '' + + if (verify.scripts.length === 0 && config.scripts && config.scripts.length > 0) { + verify.scripts = fromJS(config.scripts).toJS() + } + } + + this.setState({verify: verify}) } render() { -- Gitblit v1.8.0