From c18f79e01a2705d34d5ac2923a26913dba07ea14 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 03 八月 2024 16:04:18 +0800 Subject: [PATCH] 2024-08-03 --- src/menu/datasource/verifycard/index.jsx | 59 +++++++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 45 insertions(+), 14 deletions(-) diff --git a/src/menu/datasource/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx index b31ecfd..c7078db 100644 --- a/src/menu/datasource/verifycard/index.jsx +++ b/src/menu/datasource/verifycard/index.jsx @@ -4,7 +4,6 @@ import { Form, Tabs, Popconfirm, notification, Modal, Typography, Spin, message, Button, Input } from 'antd' import { StopOutlined, CheckCircleOutlined, TableOutlined, EditOutlined, SwapOutlined, DeleteOutlined, CopyOutlined, BorderOutlined, SnippetsOutlined } from '@ant-design/icons' import moment from 'moment' -import md5 from 'md5' import Api from '@/api' import Utils from '@/utils/utils.js' @@ -216,9 +215,11 @@ let columns = config.columns ? fromJS(config.columns).toJS() : [] let subColumns = config.subColumns ? fromJS(config.subColumns).toJS() : [] - columns.reverse() + if (!config.fixedCol) { + columns.reverse() + } subColumns.reverse() - + columns.forEach(col => { if (!col.datatype) return if (/^nvarchar/.test(col.datatype)) { @@ -679,10 +680,8 @@ _columns = [...columns, ...subColumns] } - let r = SettingUtils.getDebugSql(setting, _scripts, _columns, searches, config.subtype) + let r = SettingUtils.getDebugSql(setting, _scripts, _columns, searches, config.subtype, config.hasExtend) - let _debugId = md5(r.sql) - if (r.custompage && setting.laypage === 'true' && _columns.findIndex(col => col.field === 'mk_total') === -1) { if (config.subtype !== 'basetable') { Modal.warning({ @@ -702,7 +701,7 @@ } } - if (debugId === _debugId) { + if (debugId === r.debugId) { resolve() return } @@ -717,7 +716,7 @@ Api.sDebug(r.sql).then(result => { if (result.status || result.ErrCode === '-2') { - this.setState({debugId: _debugId}, () => { + this.setState({debugId: r.debugId}, () => { resolve() }) } else { @@ -959,13 +958,19 @@ } copyColumns = () => { - const { columns, setting } = this.state + const { config } = this.props + const { columns, subColumns, setting } = this.state + let _columns = columns let m = [] let n = [] let s = [] - columns.forEach(col => { + if (subColumns && subColumns.length) { + _columns = [...columns, ...subColumns] + } + + _columns.forEach(col => { m.unshift(`${col.field} ${col.datatype}`) n.unshift(col.field) if (/decimal|int/ig.test(col.datatype)) { @@ -980,7 +985,34 @@ }) if (window.debugger) { - console.info('select ' + s.join(', ')) + window.mkInfo('select ' + s.join(', ')) + } + + let extend = '' + if (config.hasExtend) { + extend = [] + let mapCol = (cols) => { + cols.forEach(col => { + if (col.type === 'extend') { + let datatype = 'Nvarchar(50)' + _columns.forEach(c => { + if (c.field === col.field) { + datatype = c.datatype + } + }) + for (let i = 1; i < col.quota; i++) { + extend.push(`${col.field}${i} ${datatype}`) + } + } else if (col.type === 'colspan' && col.subcols) { + mapCol(col.subcols) + } + }) + } + mapCol(config.cols) + extend = ` + /* 鎵╁睍鍒楀瓧娈� */ + /* ${extend.join(',')} */ + ` } let oInput = document.createElement('input') @@ -1005,7 +1037,7 @@ if @pageIndex_top > 0 delete #${setting.tableName || 'tb'} where sort_id <= @pageIndex_top - drop table #${setting.tableName || 'tb'}` + drop table #${setting.tableName || 'tb'}${extend}` document.body.appendChild(oInput) oInput.select() @@ -1039,8 +1071,6 @@ addProcess = () => { const { config } = this.props const { columns } = this.state - - if (config.subtype === 'dualdatacard') return let fields = [] let cols = [] @@ -1217,6 +1247,7 @@ }}/> : null} <CustomScriptsForm type={config.type} + hasExtend={config.hasExtend} setting={setting} searches={searches} defaultsql={defaultsql} -- Gitblit v1.8.0