| | |
| | | getCols(item.cols) |
| | | |
| | | if (item.subtype === 'editable' && item.submit.intertype === 'system') { |
| | | // let sql = this.getEditTableSql(item.submit, item.cols, item.columns) |
| | | let msg = getEditTableSql(item.submit, item.cols, item.columns) |
| | | |
| | | sqls.push({uuid: 'submit_' + item.uuid, ...msg}) |
| | | } |
| | | } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { |
| | | item.subcards && item.subcards.forEach(card => { |
| | |
| | | } |
| | | } |
| | | if (cell.callbackType === 'script' && cell.verify && cell.verify.cbScripts) { |
| | | // if (item.subtype === 'dualdatacard' && isback) { |
| | | // let _item = fromJS(item).toJS() |
| | | // _item.columns = _item.subColumns || [] |
| | | // _item.setting.primaryKey = _item.setting.subKey |
| | | if (item.subtype === 'dualdatacard' && isback) { |
| | | let _item = fromJS(item).toJS() |
| | | _item.columns = _item.subColumns || [] |
| | | |
| | | // getSysDefaultSql(cell, _item, true) |
| | | // } else { |
| | | |
| | | // getSysDefaultSql(cell, item, true) |
| | | // } |
| | | let msg = getSysBackSql(cell, _item) |
| | | |
| | | // let backSql = this.getSysBackSql(cell.verify.cbScripts, cell.cbTable) |
| | | sqls.push({uuid: 'back_' + cell.uuid, ...msg}) |
| | | } else { |
| | | let msg = getSysBackSql(cell, item) |
| | | |
| | | // if (backSql) { |
| | | // backSql = `${defSql} |
| | | // ${backSql} |
| | | // ` |
| | | |
| | | // if (cell.output) { |
| | | // backSql += ` |
| | | // aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg,${cell.output} as mk_b_id` |
| | | // } else { |
| | | // backSql += ` |
| | | // aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | // } |
| | | |
| | | // backSql = backSql.replace(/@typename@/ig, `'typename'`) |
| | | // backSql = backSql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, `''`) |
| | | // } |
| | | sqls.push({uuid: 'back_' + cell.uuid, ...msg}) |
| | | } |
| | | } |
| | | } else if (cell.OpenType === 'excelIn') { |
| | | if (cell.intertype === 'system') { |
| | | // sql = this.getExcelInSql(cell, process) |
| | | let msg = getExcelInSql(cell) |
| | | |
| | | sqls.push({uuid: cell.uuid, ...msg}) |
| | | } |
| | | } else if (cell.OpenType === 'excelOut') { |
| | | if (cell.intertype === 'system' && cell.verify && cell.verify.dataType === 'custom') { |
| | | // sql = this.getExcelOutSql(cell, item) |
| | | let msg = getExcelOutSql(cell, item) |
| | | |
| | | sqls.push({uuid: cell.uuid, ...msg}) |
| | | } |
| | | } else if (cell.OpenType === 'funcbutton') { |
| | | if (cell.funcType === 'print') { |
| | | |
| | | if (cell.intertype === 'system' && cell.verify && cell.verify.dataType === 'custom') { |
| | | let msg = getPrintSql(cell) |
| | | |
| | | sqls.push({uuid: cell.uuid, ...msg}) |
| | | } |
| | | } else if ((cell.funcType === 'refund' || cell.funcType === 'pay') && cell.payMode === 'system') { |
| | | // sql = this.getPaySql(cell, item) |
| | | let msg = getPaySql(cell, item) |
| | | |
| | | sqls.push({uuid: cell.uuid, ...msg}) |
| | | } |
| | | } else if (cell.OpenType === 'innerpage' || cell.OpenType === 'outerpage') { |
| | | if (cell.pageTemplate === 'pay' && cell.payMode === 'system') { |
| | | // sql = this.getPaySql(cell, item) |
| | | let msg = getPaySql(cell, item) |
| | | |
| | | sqls.push({uuid: cell.uuid, ...msg}) |
| | | } |
| | | } else if (cell.OpenType === 'popview') { |
| | | if (cell.config && cell.config.components) { |
| | |
| | | key: item.field, |
| | | fieldlen: item.fieldlength || 50, |
| | | writein: item.writein !== 'false', |
| | | type: item.type |
| | | type: item.type, |
| | | isconst: item.constant === 'true' |
| | | } |
| | | |
| | | if (_item.type === 'datemonth') { |
| | |
| | | _initFormfields.push(`@${_key}='@mk_${_key}_mk@'`) |
| | | } else if (form.type === 'select' || form.type === 'link' || form.type === 'radio') { |
| | | _initFormfields.push(`@${_key}='@mk_${_key}_mk@'`) |
| | | } else if (form.isconst) { |
| | | _initFormfields.push(`@${_key}=N'@mk_${_key}_mk@'`) |
| | | } else { |
| | | _initFormfields.push(`@${_key}='@mk_${_key}_mk@'`) |
| | | } |
| | |
| | | select @tbid='', @ErrorCode='',@retmsg='' |
| | | select @tbid='X' from ${datasource} right join (select ID from dbo.SplitComma(@ID@)) sp |
| | | on tb.${primaryKey} =sp.id where tb.${primaryKey} is null |
| | | |
| | | |
| | | If @tbid!='' |
| | | Begin |
| | | select @ErrorCode='E',@retmsg='数据已失效' |
| | |
| | | _sql += ` |
| | | /* 同类数据验证 */ |
| | | Set @tbid='' |
| | | |
| | | |
| | | Select top 1 @tbid='X' from (select distinct ${item.field},1 as n from ${datasource} inner join (select ID from dbo.SplitComma(@ID@)) sp on tb.${primaryKey}=sp.ID ) a having sum(n)>1 |
| | | |
| | | |
| | | If @tbid!='' |
| | | Begin |
| | | Set @ErrorCode='E' Set @retmsg='${item.fieldlabel} 值不唯一' |
| | |
| | | select @works_flow_statuscharone=statuscharone,@works_flow_statuschartwo=statuschartwo,@works_flow_statuscharthree=statuscharthree,@works_flow_statuscharfour=statuscharfour,@works_flow_statuscharfive=statuscharfive,@works_flow_key_id=id,@s_my_works_flow_log_param=works_flow_param,@s_my_works_flow_log_status=status,@s_my_works_flow_log_statusname=statusname,@s_my_works_flow_log_detail_id=works_flow_detail_id |
| | | from s_my_works_flow where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0 |
| | | |
| | | if @works_flow_statuscharone!='' and @works_flow_statuschartwo!='' and @works_flow_statuscharthree!='' and @works_flow_statuscharfour!='' and @works_flow_statuscharfive!='' |
| | | if @works_flow_statuscharone + @works_flow_statuschartwo + @works_flow_statuscharthree + @works_flow_statuscharfour + @works_flow_statuscharfive = @works_flow_sign_values@ |
| | | begin |
| | | set @works_flow_key_status='Y' |
| | | end |
| | |
| | | } |
| | | |
| | | if (verify.workFlow === 'true' && process) { |
| | | // works_flow_error 流程错误 |
| | | // works_flow_countersign 会签/或签 标记 |
| | | // works_begin_branch 驳回至开始分支(line.mknode === 'startEdge') |
| | | // works_flow_sign_field 会签 标记字段 statuscharone/statuschartwo/statuscharthree/statuscharfour/statuscharfive |
| | | // works_flow_sign_label 会签 标记值 ***/***/已审核 |
| | | let worksReFields = ['works_flow_error', 'works_flow_countersign', 'works_begin_branch', 'works_flow_sign_label', 'start_type', 'check_type', 'notice_type', 'check_userids', 'notice_userids', 'works_flow_sign', 'works_flow_code', 'works_flow_name', 'works_flow_param', 'works_flow_detail_id', 'status', 'statusname', 'work_group', 'work_grade'] |
| | | worksReFields.forEach(n => { |
| | | _sql = _sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | if (verify.flowType === 'start') { |
| | | // works_flow_error 流程错误 |
| | | let worksReFields = ['works_flow_error', 'works_flow_code', 'works_flow_name', 'works_flow_param', 'works_flow_detail_id', 'status', 'statusname', 'work_group', 'work_grade', 'start_type'] |
| | | worksReFields.forEach(n => { |
| | | _sql = _sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | } else { |
| | | // works_flow_error 流程错误 |
| | | // works_flow_countersign 会签/或签标记 会签为 Y |
| | | // works_begin_branch 驳回至开始分支(line.mknode === 'startEdge') |
| | | // works_flow_sign_field 会签 标记字段 statuscharone/statuschartwo/statuscharthree/statuscharfour/statuscharfive |
| | | // works_flow_sign_label 会签 标记值 ***/***/已审核 |
| | | // works_flow_sign_values 会签标记拼接值(除本人外) |
| | | let worksReFields = ['works_flow_error', 'works_flow_countersign', 'works_flow_sign_values', 'works_begin_branch', 'works_flow_sign_label', 'works_flow_code', 'works_flow_name', 'works_flow_param', 'works_flow_detail_id', 'status', 'statusname', 'work_group', 'work_grade', 'check_type', 'notice_type', 'check_userids', 'notice_userids', 'works_flow_sign'] |
| | | worksReFields.forEach(n => { |
| | | _sql = _sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | if (btn.procMode === 'system') { |
| | |
| | | |
| | | decSql = [...decSql, ..._declares] |
| | | |
| | | _sql = `Declare ${decSql.join(',')} |
| | | /* 凭证及用户信息初始化赋值 */ |
| | | select ${secSql.join(',')} |
| | | ${_sql} |
| | | ` |
| | | _sql = _sql.replace(/\n\s{8,10}/g, '\n') |
| | | _sql = _sql.replace(/\n\s+\/\*/g, `\n/*`) |
| | | |
| | | let regs = ['ID', 'BID', 'time_id', 'datam', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'typename'] |
| | | |
| | | regs.forEach(s => { |
| | |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | _sql = `Declare ${decSql.join(',')} |
| | | /* 凭证及用户信息初始化赋值 */ |
| | | select ${secSql.join(',')} |
| | | ${_sql} |
| | | ` |
| | | _sql = _sql.replace(/\n\s{8,10}/g, '\n') |
| | | |
| | | reps.forEach(n => { |
| | | _sql = _sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | |
| | | reps = Array.from(new Set([...reps, ...colreps])) |
| | | |
| | | return { LText: _sql, reps } |
| | | } |
| | | |
| | | let getSysBackSql = (btn, component) => { |
| | | let verify = btn.verify || {} |
| | | let columns = component.columns || [] |
| | | let colreps = [] // 待替换变量集 |
| | | let _prev = '' |
| | | let _back = '' |
| | | let tables = [] |
| | | let reps = [] |
| | | |
| | | verify.cbScripts.forEach(script => { |
| | | if (script.status === 'false') return |
| | | |
| | | if (/\s#[a-z0-9_]+(\s|\()/ig.test(script.sql)) { |
| | | tables.push(...script.sql.match(/\s#[a-z0-9_]+(\s|\()/ig)) |
| | | } |
| | | |
| | | if (script.position === 'front') { |
| | | _prev += ` |
| | | /* 自定义脚本 */ |
| | | ${script.sql} |
| | | ` |
| | | } else { |
| | | _back += ` |
| | | /* 自定义脚本 */ |
| | | ${script.sql} |
| | | ` |
| | | } |
| | | }) |
| | | |
| | | tables = tables.map(tb => tb.replace(/\s|\(/g, '')) |
| | | |
| | | // 需要声明的变量集 |
| | | let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode', 'roleid', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'mk_deleted', 'bid'] |
| | | |
| | | let _sql = '' |
| | | |
| | | let _initFormfields = [] |
| | | let _declares = [] |
| | | |
| | | let formdata = null |
| | | let formkeys = [] |
| | | if (btn.OpenType === 'pop' || btn.OpenType === 'formSubmit') { |
| | | formdata = [] |
| | | if (btn.modal && btn.modal.fields) { |
| | | btn.modal.fields.forEach(item => { |
| | | if (!item.field) return |
| | | |
| | | let _item = { |
| | | key: item.field, |
| | | fieldlen: item.fieldlength || 50, |
| | | writein: item.writein !== 'false', |
| | | type: item.type, |
| | | isconst: item.constant === 'true' |
| | | } |
| | | |
| | | if (_item.type === 'datemonth') { |
| | | _item.type = 'text' |
| | | } else if (_item.type === 'number' || _item.type === 'rate') { |
| | | _item.fieldlen = item.decimal || 0 |
| | | } else if (_item.type === 'date') { |
| | | _item.type = item.declareType === 'nvarchar(50)' ? 'text' : 'date' |
| | | } else if (_item.type === 'datetime') { |
| | | _item.type = 'date' |
| | | } else if (item.declare === 'decimal') { |
| | | _item.type = 'number' |
| | | _item.fieldlen = item.decimal || 0 |
| | | } |
| | | |
| | | formdata.push(_item) |
| | | }) |
| | | } |
| | | } else if (btn.OpenType === 'form') { |
| | | formdata = [] |
| | | |
| | | let item = { |
| | | type: 'text', |
| | | readin: true, |
| | | writein: true, |
| | | fieldlen: 50, |
| | | key: btn.field |
| | | } |
| | | if (btn.formType === 'counter') { |
| | | item.type = 'number' |
| | | item.fieldlen = 0 |
| | | } else if (btn.formType === 'switch' || btn.formType === 'radio') { |
| | | if (typeof(btn.openVal) === 'number') { |
| | | item.type = 'number' |
| | | item.fieldlen = 0 |
| | | } |
| | | } |
| | | formdata.push(item) |
| | | } |
| | | |
| | | // 获取字段键值对 |
| | | formdata && formdata.forEach(form => { |
| | | let _key = form.key.toLowerCase() |
| | | |
| | | if (!formkeys.includes(_key)) { |
| | | formkeys.push(_key) |
| | | if (form.type === 'number' || form.type === 'rate') { |
| | | _initFormfields.push(`@${_key}=@mk_${_key}_mk@`) |
| | | } else if (form.type === 'date') { |
| | | _initFormfields.push(`@${_key}='@mk_${_key}_mk@'`) |
| | | } else if (form.type === 'select' || form.type === 'link' || form.type === 'radio') { |
| | | _initFormfields.push(`@${_key}='@mk_${_key}_mk@'`) |
| | | } else if (form.isconst) { |
| | | _initFormfields.push(`@${_key}=N'@mk_${_key}_mk@'`) |
| | | } else { |
| | | _initFormfields.push(`@${_key}='@mk_${_key}_mk@'`) |
| | | } |
| | | } |
| | | |
| | | if (!_vars.includes(_key)) { |
| | | _vars.push(_key) |
| | | |
| | | if (form.fieldlen && form.fieldlen > 4000) { |
| | | form.fieldlen = 'max' |
| | | } |
| | | |
| | | let _type = `nvarchar(${form.fieldlen})` |
| | | |
| | | if (form.type.match(/date/ig)) { |
| | | _type = 'datetime' |
| | | } else if (form.type === 'number') { |
| | | _type = `decimal(18,${form.fieldlen})` |
| | | } else if (form.type === 'rate') { |
| | | _type = `decimal(18,2)` |
| | | } |
| | | |
| | | _declares.push(`@${_key} ${_type}`) |
| | | } |
| | | }) |
| | | |
| | | // 表单变量赋值 |
| | | if (_initFormfields.length > 0) { |
| | | _sql += ` |
| | | /* 表单变量赋值 */ |
| | | select ${_initFormfields.join(',')} |
| | | ` |
| | | } |
| | | |
| | | let testSql = _prev + _back |
| | | |
| | | // 添加数据中字段,表单值优先(按钮不选行或多行拼接时跳过) |
| | | if (btn.Ot !== 'notRequired' && columns.length > 0) { |
| | | let _initColfields = [] |
| | | columns.forEach(col => { |
| | | let _key = col.field.toLowerCase() |
| | | |
| | | if (formkeys.includes(_key) || !new RegExp('@' + _key + '[^0-9a-z_]', 'ig').test(testSql)) return |
| | | if (_key === 'id' && !/@id[^0-9a-z_@]/ig.test(testSql)) return |
| | | |
| | | colreps.push(col.field) |
| | | |
| | | if (col.type === 'number') { |
| | | _initColfields.push(`@${_key}=@mk_${_key}_mk@`) |
| | | } else { |
| | | _initColfields.push(`@${_key}='@mk_${_key}_mk@'`) |
| | | } |
| | | |
| | | if (!_vars.includes(_key)) { |
| | | _declares.push(`@${_key} ${col.datatype || 'nvarchar(50)'}`) |
| | | } |
| | | }) |
| | | |
| | | // 显示列变量赋值 |
| | | if (_initColfields.length > 0) { |
| | | _sql += ` |
| | | /* 显示列变量赋值 */ |
| | | select ${_initColfields.join(',')} |
| | | ` |
| | | } |
| | | } |
| | | |
| | | _sql += ` |
| | | ${_prev} |
| | | /* 外部接口入参 */ |
| | | @mk_outer_params@ |
| | | ${_back} |
| | | ` |
| | | |
| | | if (btn.output) { |
| | | _sql += ` |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg,${btn.output} as mk_b_id` |
| | | } else { |
| | | _sql += ` |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | } |
| | | |
| | | let syses = ['tbid', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode', 'mk_deleted', 'bid', 'UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address'] |
| | | let decSql = [`@ErrorCode nvarchar(50),@retmsg nvarchar(4000)`] |
| | | let secSql = [`@ErrorCode='',@retmsg=''`] |
| | | |
| | | syses.forEach(s => { |
| | | if (new RegExp('@' + s + '[^0-9a-z_]', 'ig').test(_sql)) { |
| | | if (['RoleID', 'mk_departmentcode', 'mk_organization'].includes(s)) { |
| | | decSql.push(`@${s} nvarchar(512)`) |
| | | } else if (['mk_address'].includes(s)) { |
| | | decSql.push(`@mk_address nvarchar(100)`) |
| | | } else if (['mk_deleted'].includes(s)) { |
| | | secSql.push(`@mk_deleted int`) |
| | | } else { |
| | | decSql.push(`@${s} nvarchar(50)`) |
| | | } |
| | | if (['tbid', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode'].includes(s)) { |
| | | secSql.push(`@${s}=''`) |
| | | } else if (['mk_deleted'].includes(s)) { |
| | | secSql.push(`@mk_deleted=1`) |
| | | } else if (['bid'].includes(s)) { |
| | | secSql.push(`@bid=@BID@`) |
| | | } else { |
| | | secSql.push(`@${s}=@${s}@`) |
| | | reps.push(s) |
| | | } |
| | | } |
| | | }) |
| | | |
| | | decSql = [...decSql, ..._declares] |
| | | |
| | | _sql = `Declare ${decSql.join(',')} |
| | | /* 初始化赋值 */ |
| | | select ${secSql.join(',')} |
| | | ${_sql} |
| | | ` |
| | | |
| | | _sql = _sql.replace(/\n\s{8,10}/g, '\n') |
| | | _sql = _sql.replace(/\n\s+\/\*/g, `\n/*`) |
| | | |
| | | let regs = ['ID', 'BID', 'time_id', 'datam', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'typename'] |
| | | |
| | | regs.forEach(s => { |
| | | if (new RegExp('@' + s + '@', 'ig').test(_sql)) { |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | reps.forEach(n => { |
| | | _sql = _sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | |
| | | if (/\$@/ig.test(_sql)) { |
| | | _sql = _sql.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | | reps.push('datam_begin', 'datam_end') |
| | | } |
| | | |
| | | reps = Array.from(new Set([...reps, ...colreps])) |
| | | |
| | | return { LText: _sql, reps, tbs: tables } |
| | | } |
| | | |
| | | let getDataSource = (item, mainSearch = []) => { |
| | |
| | | select ${secSql.join(',')}` |
| | | |
| | | // 不需要单引号:orderBy、pageSize、pageIndex、db |
| | | let regs = [...sFields, 'orderBy', 'pageSize', 'pageIndex', 'typename', 'datam', 'ID', 'BID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'typename'] |
| | | let regs = [...sFields, 'orderBy', 'pageSize', 'pageIndex', 'typename', 'datam', 'ID', 'BID', 'time_id', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'typename'] |
| | | |
| | | if (item.hasExtend) { |
| | | regs.push('mk_time') |
| | |
| | | } |
| | | if (window.GLOB.getLocation) { |
| | | regs.push('mk_longitude', 'mk_latitude') |
| | | } |
| | | if (window.GLOB.externalDatabase !== null) { |
| | | regs.push('db') |
| | | } |
| | | if (urlFields) { |
| | | regs.push(...urlFields) |
| | |
| | | LText = LText.replace(/\n\s{6,8}/g, '\n') |
| | | DateCount = DateCount.replace(/\n\s{6,8}/g, '\n') |
| | | _customScript = _customScript.replace(/\n\s{6,8}/g, '\n') |
| | | LText = LText.replace(/\n\s+\/\*/g, `\n/*`) |
| | | DateCount = DateCount.replace(/\n\s+\/\*/g, `\n/*`) |
| | | _customScript = _customScript.replace(/\n\s+\/\*/g, `\n/*`) |
| | | |
| | | reps.forEach(n => { |
| | | if (['orderBy', 'pageSize', 'pageIndex', 'mk_rows_begin'].includes(n)) return |
| | |
| | | return {LText, DateCount, customScript: _customScript, reps} |
| | | } |
| | | |
| | | let getExcelInSql = (item) => { |
| | | let btn = item.verify |
| | | let sheet = item.sheet.replace(/@db@/ig, '') |
| | | let database = '' |
| | | if (/@db@/ig.test(item.sheet)) { |
| | | database = '@db@' |
| | | } |
| | | |
| | | let sql = '' |
| | | |
| | | let _initCustomScript = '' // 初始化脚本 |
| | | let _prevCustomScript = '' // 默认sql前执行脚本 |
| | | let _backCustomScript = '' // 默认sql后执行脚本 |
| | | let _regs = [ |
| | | {reg: new RegExp('(^|\\s)@' + sheet + '(\\s|$)', 'ig'), value: ` #${sheet} `}, |
| | | {reg: new RegExp('(^|\\s)@' + sheet + '\\(', 'ig'), value: ` #${sheet}(`}, |
| | | {reg: new RegExp('(^|\\s)@' + sheet + '\\)', 'ig'), value: ` #${sheet})`}, |
| | | ] |
| | | |
| | | btn.scripts && btn.scripts.forEach(script => { |
| | | if (script.status === 'false') return |
| | | |
| | | let _sql = script.sql |
| | | |
| | | _regs.forEach(item => { |
| | | _sql = _sql.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | if (script.position === 'init') { |
| | | _initCustomScript += ` |
| | | /* 自定义脚本 */ |
| | | ${_sql} |
| | | ` |
| | | } else if (script.position === 'front') { |
| | | _prevCustomScript += ` |
| | | /* 自定义脚本 */ |
| | | ${_sql} |
| | | ` |
| | | } else { |
| | | _backCustomScript += ` |
| | | /* 自定义脚本 */ |
| | | ${_sql} |
| | | ` |
| | | } |
| | | }) |
| | | |
| | | let _uniquesql = '' |
| | | if (btn.uniques && btn.uniques.length > 0) { |
| | | let textFields = [] |
| | | let numberFields = [] |
| | | let dateFields = [] |
| | | btn.columns.forEach((col) => { |
| | | if (/Nvarchar/ig.test(col.type)) { |
| | | textFields.push(col.Column) |
| | | } else if (/Decimal|int/ig.test(col.type)) { |
| | | numberFields.push(col.Column) |
| | | } else if (/date/ig.test(col.type)) { |
| | | dateFields.push(col.Column) |
| | | } |
| | | }) |
| | | btn.uniques.forEach(unique => { |
| | | if (unique.status === 'false' || !unique.verifyType) return |
| | | |
| | | let _fields = unique.field.split(',') |
| | | let _fields_ = _fields.map(_field => `a.${_field}=b.${_field}`) |
| | | _fields_ = _fields_.join(' and ') |
| | | |
| | | let _where = [] |
| | | _fields.forEach(f => { |
| | | if (textFields.includes(f)) { |
| | | _where.push(`${f}!=''`) |
| | | } else if (numberFields.includes(f)) { |
| | | _where.push(`${f}!=0`) |
| | | } else if (dateFields.includes(f)) { |
| | | _where.push(`${f}>'1949-10-01'`) |
| | | } |
| | | }) |
| | | _where = _where.length ? `where ${_where.join(' and ')} ` : '' |
| | | |
| | | if (unique.verifyType === 'logic' || unique.verifyType === 'logic_temp') { |
| | | _fields_ += ' and b.deleted=0' |
| | | } |
| | | |
| | | let _afields = [] |
| | | _fields = _fields.map(f => { |
| | | if (numberFields.includes(f)) { |
| | | _afields.push(`cast(a.${f} as nvarchar(50))`) |
| | | return `cast(${f} as nvarchar(50))` |
| | | } else if (dateFields.includes(f)) { |
| | | _afields.push(`CONVERT(nvarchar(50), a.${f}, 21)`) |
| | | return `CONVERT(nvarchar(50), ${f}, 21)` |
| | | } |
| | | _afields.push(`a.${f}`) |
| | | |
| | | return f |
| | | }) |
| | | |
| | | _uniquesql += ` |
| | | /* 重复性验证 */ |
| | | Set @tbid='' |
| | | Select top 1 @tbid=${_fields.join('+\' \'+')} from (select 1 as n,${unique.field} from #${sheet} ) a group by ${unique.field} having sum(n)>1 |
| | | |
| | | If @tbid!='' |
| | | Begin |
| | | select @ErrorCode='${unique.errorCode}',@retmsg=@tbid+' 重复' |
| | | goto aaa |
| | | end |
| | | |
| | | ${unique.verifyType.indexOf('temp') === -1 ? `Set @tbid='' |
| | | Select top 1 @tbid=${_afields.join('+\' \'+')} from ${_where ? `(select * from #${sheet} ${_where})` : `#${sheet}`} a Inner join ${sheet} b on ${_fields_} |
| | | |
| | | If @tbid!='' |
| | | Begin |
| | | select @ErrorCode='${unique.errorCode}',@retmsg=@tbid+' 与已有数据重复' |
| | | goto aaa |
| | | end` : ''} |
| | | ` |
| | | }) |
| | | } |
| | | |
| | | let declarefields = [] |
| | | let fields = [] |
| | | |
| | | btn.columns.forEach(col => { |
| | | if (col.import === 'false') return |
| | | |
| | | if (col.type === 'date') { |
| | | declarefields.push(`${col.Column} Nvarchar(50)`) |
| | | } else { |
| | | declarefields.push(`${col.Column} ${col.type}`) |
| | | } |
| | | fields.push(col.Column) |
| | | }) |
| | | |
| | | fields = fields.join(',') |
| | | |
| | | let _insert = '' |
| | | if (btn.default !== 'false') { |
| | | _insert = ` |
| | | /* 默认sql */ |
| | | Insert into ${database}${sheet} (${fields},createuserid,createuser,createstaff,bid) |
| | | Select ${fields},@UserID@,@username,@fullname,@BID@ From #${sheet} |
| | | ` |
| | | } |
| | | |
| | | sql = `create table #${sheet} (${declarefields.join(',')},jskey nvarchar(50),BID nvarchar(50)) |
| | | Declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512)@mk_init_declare@ |
| | | |
| | | Select @ErrorCode='',@retmsg=''@mk_init_select@ |
| | | ${_initCustomScript} |
| | | |
| | | Insert into #${sheet} (${fields},jskey,BID) |
| | | |
| | | /* excel数据*/ |
| | | @mk_excel_data@ |
| | | |
| | | ${_uniquesql} |
| | | ${_prevCustomScript} |
| | | ${_insert}` |
| | | |
| | | if (btn.workFlow === 'true' && process) { |
| | | if (btn.flowSql === 'true') { |
| | | sql += ` |
| | | /* 工作流异常sql */ |
| | | if @works_flow_error@ != '' |
| | | select @ErrorCode='E',@retmsg=@works_flow_error@ goto aaa |
| | | |
| | | /* 工作流默认sql */ |
| | | insert into s_my_works_flow (works_flow_id,works_flow_code,works_flow_name,works_flow_param,status,statusname,work_group,works_flow_detail_id,work_grade,bid,createuserid,CreateUser,CreateStaff,upid) |
| | | select jskey,@works_flow_code@,@works_flow_name@,@works_flow_param@,@status@,@statusname@,@work_group@,@works_flow_detail_id@,@work_grade@,@bid@,@UserID@,@UserName,@FullName,@time_id@ |
| | | from #${sheet} |
| | | |
| | | insert into s_my_works_flow_log (works_flow_id,works_flow_code,works_flow_name,works_flow_param,status,statusname,works_flow_detail_id,work_group,work_grade,bid,createuserid,CreateUser,CreateStaff,upid) |
| | | select jskey,@works_flow_code@,@works_flow_name@ ,@works_flow_param@,@status@,@statusname@,@works_flow_detail_id@,@work_group@,@work_grade@,@bid@,@UserID@,@UserName,@FullName,@time_id@ |
| | | from #${sheet} |
| | | |
| | | insert into s_my_works_flow_notice (works_flow_id,works_flow_code,works_flow_detail_id,userid,notice_type,createuserid,CreateUser,CreateStaff,upid) |
| | | select jskey,@works_flow_code@,@works_flow_detail_id@,@userid@,@start_type@,@userid@,@UserName,@FullName,@time_id@ |
| | | from #${sheet} |
| | | |
| | | insert into s_my_works_flow_role (works_flow_id,works_flow_code,userid,works_flow_detail_id,createuserid,CreateUser,CreateStaff,upid,typecharone) |
| | | select jskey,@works_flow_code@,@userid@,@works_flow_detail_id@,@userid@,@UserName,@FullName,@time_id@,'begin' |
| | | from #${sheet} |
| | | ` |
| | | } |
| | | |
| | | sql += ` |
| | | ${_backCustomScript} |
| | | |
| | | drop table #${sheet} |
| | | |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | |
| | | // works_flow_error 流程错误 |
| | | let worksReFields = ['works_flow_error', 'works_flow_code', 'works_flow_name', 'works_flow_param', 'works_flow_detail_id', 'status', 'statusname', 'work_group', 'work_grade', 'start_type'] |
| | | worksReFields.forEach(n => { |
| | | sql = sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | } else { |
| | | sql += ` |
| | | ${_backCustomScript} |
| | | |
| | | drop table #${sheet} |
| | | |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | } |
| | | |
| | | let reps = [] |
| | | let decSql = [] |
| | | let secSql = [] |
| | | |
| | | let syses = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address'] |
| | | syses.forEach(s => { |
| | | if (new RegExp('@' + s + '[^0-9a-z_]', 'ig').test(sql)) { |
| | | if (['RoleID', 'mk_departmentcode', 'mk_organization'].includes(s)) { |
| | | decSql.push(`@${s} nvarchar(512)`) |
| | | } else if (['mk_address'].includes(s)) { |
| | | decSql.push(`@mk_address nvarchar(100)`) |
| | | } else { |
| | | decSql.push(`@${s} nvarchar(50)`) |
| | | } |
| | | secSql.push(`@${s}=@${s}@`) |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | decSql = decSql.length ? `,${decSql.join(',')}` : '' |
| | | secSql = secSql.length ? `,${secSql.join(',')}` : '' |
| | | |
| | | sql = sql.replace(/@mk_init_declare@/ig, decSql) |
| | | sql = sql.replace(/@mk_init_select@/ig, secSql) |
| | | |
| | | let regs = ['ID', 'BID', 'time_id', 'datam', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'typename'] |
| | | |
| | | regs.forEach(s => { |
| | | if (new RegExp('@' + s + '@', 'ig').test(sql)) { |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | reps.forEach(n => { |
| | | sql = sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | |
| | | sql = sql.replace(/\n\s{6,10}/g, '\n') |
| | | sql = sql.replace(/\n\s+\/\*/g, `\n/*`) |
| | | |
| | | if (/\$@/ig.test(sql)) { |
| | | sql = sql.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | | reps.push('datam_begin', 'datam_end') |
| | | } |
| | | |
| | | return {LText: sql, reps} |
| | | } |
| | | |
| | | let getEditTableSql = (btn, cols, columns) => { |
| | | let sheet = btn.sheet.replace(/@db@/ig, '') |
| | | let database = '' |
| | | if (/@db@/ig.test(btn.sheet)) { |
| | | database = '@db@' |
| | | } |
| | | |
| | | let forms = [] |
| | | let _fields = {} |
| | | |
| | | columns.forEach(col => { |
| | | _fields[col.field] = col.datatype |
| | | }) |
| | | |
| | | let getColumns = (cols) => { |
| | | cols.forEach(item => { |
| | | if (item.type === 'colspan') { |
| | | getColumns(item.subcols) |
| | | } else if (item.editable === 'true') { |
| | | forms.push({ |
| | | field: item.field, |
| | | type: item.type, |
| | | datatype: _fields[item.field] || 'nvarchar(50)' |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | getColumns(cols) |
| | | |
| | | let sql = '' |
| | | |
| | | let _initCustomScript = '' // 初始化脚本 |
| | | let _prevCustomScript = '' // 默认sql前执行脚本 |
| | | let _backCustomScript = '' // 默认sql后执行脚本 |
| | | let _regs = [ |
| | | {reg: new RegExp('(^|\\s)@' + sheet + '(\\s|$)', 'ig'), value: ` #${sheet} `}, |
| | | {reg: new RegExp('(^|\\s)@' + sheet + '\\(', 'ig'), value: ` #${sheet}(`}, |
| | | {reg: new RegExp('(^|\\s)@' + sheet + '\\)', 'ig'), value: ` #${sheet})`}, |
| | | ] |
| | | |
| | | btn.scripts && btn.scripts.forEach(script => { |
| | | if (script.status === 'false') return |
| | | |
| | | let _sql = script.sql |
| | | |
| | | _regs.forEach(item => { |
| | | _sql = _sql.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | if (script.position === 'init') { |
| | | _initCustomScript += ` |
| | | /* 自定义脚本 */ |
| | | ${_sql} |
| | | ` |
| | | } else if (script.position === 'front') { |
| | | _prevCustomScript += ` |
| | | /* 自定义脚本 */ |
| | | ${_sql} |
| | | ` |
| | | } else { |
| | | _backCustomScript += ` |
| | | /* 自定义脚本 */ |
| | | ${_sql} |
| | | ` |
| | | } |
| | | }) |
| | | |
| | | let _uniquesql = '' |
| | | if (btn.uniques && btn.uniques.length > 0) { |
| | | let textFields = [] |
| | | let numberFields = [] |
| | | let dateFields = [] |
| | | columns.forEach((col) => { |
| | | if (/Nvarchar/ig.test(col.datatype)) { |
| | | textFields.push(col.field) |
| | | } else if (/Decimal|int/ig.test(col.datatype)) { |
| | | numberFields.push(col.field) |
| | | } else if (/date/ig.test(col.datatype)) { |
| | | dateFields.push(col.field) |
| | | } |
| | | }) |
| | | btn.uniques.forEach(unique => { |
| | | if (unique.status === 'false' || !unique.verifyType) return |
| | | |
| | | let _fields = unique.field.split(',') |
| | | let _fields_ = _fields.map(_field => `a.${_field}=b.${_field}`) |
| | | _fields_ = _fields_.join(' and ') |
| | | |
| | | let _where = [] |
| | | _fields.forEach(f => { |
| | | if (textFields.includes(f)) { |
| | | _where.push(`${f}!=''`) |
| | | } else if (numberFields.includes(f)) { |
| | | _where.push(`${f}!=0`) |
| | | } else if (dateFields.includes(f)) { |
| | | _where.push(`${f}>'1949-10-01'`) |
| | | } |
| | | }) |
| | | _where = _where.length ? `where ${_where.join(' and ')} ` : '' |
| | | |
| | | if (unique.verifyType === 'logic' || unique.verifyType === 'logic_temp') { |
| | | _fields_ += ' and b.deleted=0' |
| | | } |
| | | |
| | | let _afields = [] |
| | | _fields = _fields.map(f => { |
| | | if (numberFields.includes(f)) { |
| | | _afields.push(`cast(a.${f} as nvarchar(50))`) |
| | | return `cast(${f} as nvarchar(50))` |
| | | } else if (dateFields.includes(f)) { |
| | | _afields.push(`CONVERT(nvarchar(50), a.${f}, 21)`) |
| | | return `CONVERT(nvarchar(50), ${f}, 21)` |
| | | } |
| | | _afields.push(`a.${f}`) |
| | | |
| | | return f |
| | | }) |
| | | |
| | | _uniquesql += ` |
| | | /* 重复性验证 */ |
| | | Set @tbid='' |
| | | Select top 1 @tbid=${_fields.join('+\' \'+')} from (select 1 as n,${unique.field} from #${sheet} ) a group by ${unique.field} having sum(n)>1 |
| | | |
| | | If @tbid!='' |
| | | Begin |
| | | select @ErrorCode='${unique.errorCode}',@retmsg=@tbid+' 重复' |
| | | goto aaa |
| | | end |
| | | |
| | | ${unique.verifyType.indexOf('temp') === -1 ? `Set @tbid='' |
| | | Select top 1 @tbid=${_afields.join('+\' \'+')} from ${_where ? `(select * from #${sheet} ${_where})` : `#${sheet}`} a Inner join ${sheet} b on ${_fields_} |
| | | |
| | | If @tbid!='' |
| | | Begin |
| | | select @ErrorCode='${unique.errorCode}',@retmsg=@tbid+' 与已有数据重复' |
| | | goto aaa |
| | | end` : ''} |
| | | ` |
| | | }) |
| | | } |
| | | |
| | | let declarefields = [] |
| | | let fields = [] |
| | | |
| | | forms.forEach(col => { |
| | | let key = col.field.toLowerCase() |
| | | if (key === 'jskey' || key === 'bid' || key === 'data_type') return |
| | | |
| | | declarefields.push(`${col.field} ${col.datatype}`) |
| | | fields.push(col.field) |
| | | }) |
| | | |
| | | fields = fields.join(',') |
| | | |
| | | let _insert = '' |
| | | if (btn.default !== 'false') { |
| | | _insert = ` |
| | | /* 默认sql */ |
| | | Insert into ${database}${sheet} (${fields},createuserid,createuser,createstaff,bid) |
| | | Select ${fields},@UserID@,@username,@fullname,@BID@ From #${sheet} |
| | | ` |
| | | } |
| | | |
| | | sql = `create table #${sheet} (${declarefields.join(',')},jskey nvarchar(50),data_type nvarchar(50),BID nvarchar(256)) |
| | | Declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512)@mk_init_declare@ |
| | | Select @ErrorCode='',@retmsg=''@mk_init_select@ |
| | | |
| | | ${_initCustomScript} |
| | | Insert into #${sheet} (${fields},jskey,data_type,BID) |
| | | |
| | | /* table数据*/ |
| | | @mk_excel_data@ |
| | | |
| | | ${_uniquesql} |
| | | ${_prevCustomScript} |
| | | ${_insert} |
| | | ${_backCustomScript} |
| | | |
| | | drop table #${sheet} |
| | | |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | |
| | | let reps = [] |
| | | let decSql = [] |
| | | let secSql = [] |
| | | |
| | | let syses = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address'] |
| | | syses.forEach(s => { |
| | | if (new RegExp('@' + s + '[^0-9a-z_]', 'ig').test(sql)) { |
| | | if (['RoleID', 'mk_departmentcode', 'mk_organization'].includes(s)) { |
| | | decSql.push(`@${s} nvarchar(512)`) |
| | | } else if (['mk_address'].includes(s)) { |
| | | decSql.push(`@mk_address nvarchar(100)`) |
| | | } else { |
| | | decSql.push(`@${s} nvarchar(50)`) |
| | | } |
| | | secSql.push(`@${s}=@${s}@`) |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | decSql = decSql.length ? `,${decSql.join(',')}` : '' |
| | | secSql = secSql.length ? `,${secSql.join(',')}` : '' |
| | | |
| | | sql = sql.replace(/@mk_init_declare@/ig, decSql) |
| | | sql = sql.replace(/@mk_init_select@/ig, secSql) |
| | | |
| | | let regs = ['BID', 'time_id', 'datam', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'typename'] |
| | | |
| | | regs.forEach(s => { |
| | | if (new RegExp('@' + s + '@', 'ig').test(sql)) { |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | reps.forEach(n => { |
| | | sql = sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | |
| | | sql = sql.replace(/\n\s{6,10}/g, '\n') |
| | | sql = sql.replace(/\n\s+\/\*/g, `\n/*`) |
| | | |
| | | if (/\$@/ig.test(sql)) { |
| | | sql = sql.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | | reps.push('datam_begin', 'datam_end') |
| | | } |
| | | |
| | | return {LText: sql, reps} |
| | | } |
| | | |
| | | let getExcelOutSql = (btn, component) => { |
| | | let item = {setting: {}, columns: [], search: [], useMSearch: 'false'} |
| | | |
| | | btn.verify.columns.forEach(col => { |
| | | if (col.output === 'false' || !col.Column || col.Column === '$Index') return |
| | | item.columns.push({ |
| | | field: col.Column |
| | | }) |
| | | }) |
| | | |
| | | if (btn.verify.useSearch !== 'false') { |
| | | item.search = component.$searches |
| | | } |
| | | |
| | | item.setting.interType = 'system' |
| | | item.setting.execute = btn.verify.defaultSql || 'true' |
| | | item.setting.dataresource = btn.verify.dataresource || '' |
| | | item.setting.primaryKey = btn.verify.primaryKey || '' |
| | | item.setting.queryType = btn.verify.queryType |
| | | item.setting.laypage = btn.pagination |
| | | item.setting.order = btn.verify.order || '' |
| | | |
| | | if (btn.Ot === 'requiredOnce') { |
| | | item.setting.primaryKey = btn.verify.primaryKey || component.setting.primaryKey || 'ID' |
| | | } |
| | | |
| | | item.scripts = btn.verify.scripts || [] |
| | | |
| | | let msg = getDataSource(item, []) |
| | | |
| | | return msg |
| | | } |
| | | |
| | | let getPrintSql = (btn) => { |
| | | let item = {setting: {}, columns: btn.verify.columns || [], search: [], useMSearch: 'false'} |
| | | |
| | | item.setting.interType = 'system' |
| | | item.setting.execute = btn.verify.setting.defaultSql || 'true' |
| | | item.setting.dataresource = btn.verify.setting.dataresource || '' |
| | | item.setting.primaryKey = '' |
| | | item.setting.queryType = btn.verify.setting.queryType |
| | | item.setting.laypage = 'false' |
| | | item.setting.order = btn.verify.setting.order || '' |
| | | |
| | | item.scripts = btn.verify.scripts || [] |
| | | |
| | | let msg = getDataSource(item, []) |
| | | |
| | | return msg |
| | | } |
| | | |
| | | let getPaySql = (btn, component) => { |
| | | let _sql = `Declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid nvarchar(50)@mk_init_declare@ |
| | | Select @ErrorCode='',@retmsg=''@mk_init_select@ |
| | | ` |
| | | |
| | | btn.verify.scripts.forEach(item => { |
| | | if (item.status === 'false') return |
| | | |
| | | _sql += ` |
| | | ${item.sql} |
| | | ` |
| | | }) |
| | | |
| | | if (btn.output) { |
| | | _sql += ` |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg,${btn.output} as mk_b_id` |
| | | } else { |
| | | _sql += ` |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | } |
| | | |
| | | let reps = [] |
| | | let decSql = [] |
| | | let secSql = [] |
| | | |
| | | let syses = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'BID'] |
| | | syses.forEach(s => { |
| | | if (new RegExp('@' + s + '[^0-9a-z_]', 'ig').test(_sql)) { |
| | | if (['RoleID', 'mk_departmentcode', 'mk_organization'].includes(s)) { |
| | | decSql.push(`@${s} nvarchar(512)`) |
| | | } else if (['mk_address'].includes(s)) { |
| | | decSql.push(`@mk_address nvarchar(100)`) |
| | | } else { |
| | | decSql.push(`@${s} nvarchar(50)`) |
| | | } |
| | | secSql.push(`@${s}=@${s}@`) |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | let regs = ['ID', 'time_id', 'datam', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'typename'] |
| | | |
| | | regs.forEach(s => { |
| | | if (new RegExp('@' + s + '@', 'ig').test(_sql)) { |
| | | reps.push(s) |
| | | } |
| | | }) |
| | | |
| | | syses = syses.map(n => n.toLowerCase()) |
| | | syses.push('tbid') |
| | | |
| | | let colreps = [] |
| | | component.columns.forEach(col => { |
| | | let _key = col.field.toLowerCase() |
| | | |
| | | if (syses.includes(_key) || !new RegExp('@' + _key + '[^0-9a-z_]', 'ig').test(_sql)) return |
| | | if (_key === 'id' && !/@id[^0-9a-z_@]/ig.test(_sql)) return |
| | | |
| | | colreps.push(col.field) |
| | | |
| | | decSql.push(`@${col.field} ${col.datatype || 'nvarchar(50)'}`) |
| | | |
| | | if (col.type === 'number') { |
| | | secSql.push(`@${col.field}=@mk_${col.field}_mk@`) |
| | | } else { |
| | | secSql.push(`@${col.field}='@mk_${col.field}_mk@'`) |
| | | } |
| | | }) |
| | | |
| | | decSql = decSql.length ? `,${decSql.join(',')}` : '' |
| | | secSql = secSql.length ? `,${secSql.join(',')}` : '' |
| | | |
| | | _sql = _sql.replace(/@mk_init_declare@/ig, decSql) |
| | | _sql = _sql.replace(/@mk_init_select@/ig, secSql) |
| | | |
| | | reps.forEach(n => { |
| | | _sql = _sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) |
| | | }) |
| | | |
| | | reps = [...reps, ...colreps] |
| | | |
| | | _sql = _sql.replace(/\n\s{6,8}/g, '\n') |
| | | |
| | | if (/\$@/ig.test(_sql)) { |
| | | _sql = _sql.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') |
| | | reps.push('datam_begin', 'datam_end') |
| | | } |
| | | |
| | | return {LText: _sql, reps} |
| | | } |
| | | |
| | | let _mainSearch = [] |
| | | |
| | | if (appType === 'mob') { |