| | |
| | | |
| | | resetSetting = (s, ori) => { |
| | | let setting = fromJS(s).toJS() |
| | | let maxScript = 0 |
| | | // let maxScript = 0 |
| | | |
| | | setting.show = ori.show || 'true' |
| | | setting.advanceType = ori.advanceType || 'modal' |
| | |
| | | setting.searchLwidth = ori.searchLwidth !== undefined ? ori.searchLwidth : 33.3 |
| | | setting.resetContrl = ori.resetContrl || 'init' |
| | | |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | window.GLOB.funcs.forEach(m => { |
| | | let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig') |
| | | setting.scripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | // window.GLOB.funcs.forEach(m => { |
| | | // let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig') |
| | | // setting.scripts.forEach(item => { |
| | | // item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | |
| | | if (item.status === 'false') return |
| | | // if (item.status === 'false') return |
| | | |
| | | if (/exec\s/ig.test(item.sql)) { |
| | | maxScript = 1000 |
| | | } else if (item.sql.length > maxScript) { |
| | | maxScript = item.sql.length |
| | | } |
| | | }) |
| | | setting.preScripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | }) |
| | | setting.cbScripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | }) |
| | | if (setting.dataresource) { |
| | | setting.dataresource = setting.dataresource.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | } |
| | | }) |
| | | } else { |
| | | setting.scripts.forEach(item => { |
| | | if (item.status === 'false') return |
| | | // if (/exec\s/ig.test(item.sql)) { |
| | | // maxScript = 1000 |
| | | // } else if (item.sql.length > maxScript) { |
| | | // maxScript = item.sql.length |
| | | // } |
| | | // }) |
| | | // setting.preScripts.forEach(item => { |
| | | // item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | // }) |
| | | // setting.cbScripts.forEach(item => { |
| | | // item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | // }) |
| | | // if (setting.dataresource) { |
| | | // setting.dataresource = setting.dataresource.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | // } |
| | | // }) |
| | | // } else { |
| | | // setting.scripts.forEach(item => { |
| | | // if (item.status === 'false') return |
| | | |
| | | if (/exec\s/ig.test(item.sql)) { |
| | | maxScript = 1000 |
| | | } else if (item.sql.length > maxScript) { |
| | | maxScript = item.sql.length |
| | | } |
| | | }) |
| | | } |
| | | // if (/exec\s/ig.test(item.sql)) { |
| | | // maxScript = 1000 |
| | | // } else if (item.sql.length > maxScript) { |
| | | // maxScript = item.sql.length |
| | | // } |
| | | // }) |
| | | // } |
| | | |
| | | setting.maxScript = maxScript |
| | | // setting.maxScript = maxScript |
| | | |
| | | return setting |
| | | } |