From 46773828b8c46e450a67eb1fc5e6124d87d97ab6 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 23 九月 2023 19:51:11 +0800 Subject: [PATCH] 2023-09-23 --- src/menu/datasource/verifycard/index.jsx | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 51 insertions(+), 3 deletions(-) diff --git a/src/menu/datasource/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx index 97016ce..9554a5b 100644 --- a/src/menu/datasource/verifycard/index.jsx +++ b/src/menu/datasource/verifycard/index.jsx @@ -40,6 +40,7 @@ subColumns: [], activeKey: 'setting', loading: false, + colLoading: false, searchKey: '', initsql: '', // sql楠岃瘉鏃跺彉閲忓0鏄庡強璧嬪�� usefulfields: '', @@ -504,7 +505,6 @@ let arr_field = columns.map(col => col.field).join(',') let _search = joinMainSearchkey(searches) - _search = _search ? 'where ' + _search : '' if (setting.dataresource) { let _dataresource = setting.dataresource @@ -607,7 +607,7 @@ sqlverify = (resolve, reject, type, testScripts) => { const { config } = this.props - const { columns, setting, scripts, searches, debugId } = this.state + const { columns, setting, scripts, searches, debugId, subColumns } = this.state let _scripts = scripts.filter(item => item.status !== 'false') @@ -630,7 +630,11 @@ } if ((setting.interType === 'system' && setting.execute !== 'false') || _scripts.length > 0) { - let r = SettingUtils.getDebugSql(setting, _scripts, columns, searches, config.type) + let _columns = columns + if (config.subtype === 'dualdatacard') { + _columns = [...columns, ...subColumns] + } + let r = SettingUtils.getDebugSql(setting, _scripts, _columns, searches, config.type) let _debugId = md5(r.sql) @@ -921,6 +925,49 @@ }) } + updateColumns = (tableName) => { + const { config } = this.props + const { colLoading, columns } = this.state + + if (colLoading || columns.length > 0) return + + if (config.subtype === 'basetable') return + + let param = {func: 'sPC_Get_FieldName', TBName: tableName} + if (window.GLOB.cloudServiceApi) { // 涓斿瓨鍦ㄤ簯绔湴鍧� + param.rduri = window.GLOB.cloudServiceApi + param.userid = sessionStorage.getItem('CloudUserID') || '' + param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' + } + + this.setState({colLoading: true}) + + Api.getSystemCacheConfig(param).then(result => { + this.setState({colLoading: false}) + if (!result.status) return + + let fields = [] + result.FDName.forEach(item => { + if (item.f_type !== 0) return + + if (/nvarchar|int|decimal/ig.test(item.FieldType) || item.FieldType === 'date' || item.FieldType === 'datetime') { + fields.push({ + uuid: Utils.getuuid(), + label: item.FieldDec, + field: item.FieldName, + datatype: item.FieldType.toLowerCase() + }) + } + }) + + if (fields.length === 0) return + + this.setState({columns: fields}) + }, () => { + this.setState({colLoading: false}) + }) + } + /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 */ @@ -951,6 +998,7 @@ setting={setting} scripts={scripts} updateStatus={this.updateStatus} + updateColumns={this.updateColumns} addProcess={this.addProcess} wrappedComponentRef={(inst) => this.settingForm = inst} /> : null} -- Gitblit v1.8.0