| | |
| | | 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)) { |
| | |
| | | if (config.subtype === 'dualdatacard') { |
| | | _columns = [...columns, ...subColumns] |
| | | } |
| | | let r = SettingUtils.getDebugSql(setting, _scripts, _columns, searches, config.type) |
| | | |
| | | let r = SettingUtils.getDebugSql(setting, _scripts, _columns, searches, config.subtype, config.hasExtend) |
| | | |
| | | let _debugId = md5(r.sql) |
| | | |
| | |
| | | } |
| | | |
| | | copyColumns = () => { |
| | | const { columns } = this.state |
| | | const { config } = this.props |
| | | const { columns, setting } = this.state |
| | | |
| | | let m = [] |
| | | let n = [] |
| | | let s = [] |
| | |
| | | console.info('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') |
| | | oInput.value = `/*${m.join(',')}*/ |
| | | ${n.join(',')}` |
| | | oInput.value = `create table #${setting.tableName || 'tb'} |
| | | (${m.join(',')},sort_id INT IDENTITY(1,1)) |
| | | insert into #${setting.tableName || 'tb'} |
| | | (${n.join(',')}) |
| | | select ${n.join(',')} |
| | | from ${setting.dataresource ? `(${setting.dataresource.replace(/\n/g, ' ')}) tb` : setting.tableName || 'tb'} |
| | | order by @orderBy@ |
| | | |
| | | declare @mk_total int |
| | | set @mk_total = 0 |
| | | |
| | | select @mk_total = count(1) from #${setting.tableName || 'tb'} |
| | | declare @pageIndex_top int |
| | | set @pageIndex_top=(@pageIndex@-1)*@pageSize@ |
| | | |
| | | if @mk_total > @pageIndex@*@pageSize@ |
| | | delete #${setting.tableName || 'tb'} where sort_id > @pageIndex@*@pageSize@ |
| | | |
| | | if @pageIndex_top > 0 |
| | | delete #${setting.tableName || 'tb'} where sort_id <= @pageIndex_top |
| | | |
| | | drop table #${setting.tableName || 'tb'}${extend}` |
| | | |
| | | document.body.appendChild(oInput) |
| | | oInput.select() |
| | | document.execCommand('Copy') |
| | |
| | | wrappedComponentRef={(inst) => this.settingForm = inst} |
| | | /> : null} |
| | | </TabPane> |
| | | {config.subtype !== 'basetable' ? <TabPane tab={ |
| | | {!['basetable', 'invoice', 'invTable'].includes(config.subtype) ? <TabPane tab={ |
| | | <span> |
| | | 字段集 |
| | | {columns.length ? <span className="count-tip">{columns.length}</span> : null} |
| | |
| | | }}/> : null} |
| | | <CustomScriptsForm |
| | | type={config.type} |
| | | hasExtend={config.hasExtend} |
| | | setting={setting} |
| | | searches={searches} |
| | | defaultsql={defaultsql} |