| | |
| | | duration: 5 |
| | | }) |
| | | return false |
| | | } else if (/,\./ig.test(sql)) { |
| | | let lines = [] |
| | | sql.split(/\n/).forEach((s, i) => { |
| | | if (/,\./ig.test(s)) { |
| | | lines.push(i + 1) |
| | | } |
| | | }) |
| | | |
| | | lines = lines.join('、') |
| | | lines = lines ? '(第' + lines + '行)' : '' |
| | | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: label + `${lines},不可出现英文逗号,.`, |
| | | duration: 5 |
| | | }) |
| | | return false |
| | | } else if (/\.,/ig.test(sql)) { |
| | | let lines = [] |
| | | sql.split(/\n/).forEach((s, i) => { |
| | | if (/\.,/ig.test(s)) { |
| | | lines.push(i + 1) |
| | | } |
| | | }) |
| | | |
| | | lines = lines.join('、') |
| | | lines = lines ? '(第' + lines + '行)' : '' |
| | | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: label + `${lines},不可出现英文逗号.,`, |
| | | duration: 5 |
| | | }) |
| | | return false |
| | | } else if (/‘|’/ig.test(sql)) { |
| | | let lines = [] |
| | | sql.split(/\n/).forEach((s, i) => { |
| | |
| | | duration: 5 |
| | | }) |
| | | return false |
| | | } else if (/,\./ig.test(sql)) { |
| | | let lines = [] |
| | | sql.split(/\n/).forEach((s, i) => { |
| | | if (/,\./ig.test(s)) { |
| | | lines.push(i + 1) |
| | | } |
| | | }) |
| | | |
| | | lines = lines.join('、') |
| | | lines = lines ? '(第' + lines + '行)' : '' |
| | | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: label + `${lines},不可出现英文逗号,.`, |
| | | duration: 5 |
| | | }) |
| | | } else if (/\.,/ig.test(sql)) { |
| | | let lines = [] |
| | | sql.split(/\n/).forEach((s, i) => { |
| | | if (/\.,/ig.test(s)) { |
| | | lines.push(i + 1) |
| | | } |
| | | }) |
| | | |
| | | lines = lines.join('、') |
| | | lines = lines ? '(第' + lines + '行)' : '' |
| | | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: label + `${lines},不可出现英文逗号.,`, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | |
| | | return true |
| | |
| | | * @description 获取语言转换信息 |
| | | */ |
| | | export function getLangTrans (config) { |
| | | if (sessionStorage.getItem('lang') !== 'zh-CN') return '' |
| | | |
| | | let langList = sessionStorage.getItem('langList') |
| | | let appType = sessionStorage.getItem('appType') |
| | | |
| | |
| | | langList = sessionStorage.getItem('applangList') |
| | | } |
| | | |
| | | if (!langList) return |
| | | |
| | | let defLang = '' |
| | | if (!langList) return '' |
| | | |
| | | try { |
| | | langList = JSON.parse(langList) |
| | | defLang = langList[0] |
| | | } catch (e) { |
| | | defLang = '' |
| | | langList = '' |
| | | } |
| | | |
| | | if (!defLang) return '' |
| | | if (!langList) return '' |
| | | |
| | | langList = langList.filter(n => n !== 'zh-CN') |
| | | |
| | | if (langList.length === 0) return '' |
| | | |
| | | let sql = [] |
| | | let btn = [] |
| | |
| | | let filterBtn = (btn) => { |
| | | if (!btn.verify) return |
| | | |
| | | btn.verify.columns && btn.verify.columns.forEach(col => { |
| | | if (col.Text) { |
| | | sql.push(col.Text) |
| | | } |
| | | }) |
| | | |
| | | btn.verify.customverifys && btn.verify.customverifys.forEach(script => { |
| | | filterSql(script.sql) |
| | | |
| | | if (script.errmsg) { |
| | | sql.push(script.errmsg) |
| | | } |
| | | }) |
| | | btn.verify.scripts && btn.verify.scripts.forEach(script => { |
| | | filterSql(script.sql) |
| | |
| | | } else { |
| | | if (item.wrap && item.wrap.title) { |
| | | sql.push(item.wrap.title) |
| | | } |
| | | if (item.plot && item.plot.title) { |
| | | sql.push(item.plot.title) |
| | | } |
| | | |
| | | if (item.setting && (!item.wrap || !item.wrap.datatype || item.wrap.datatype === 'dynamic')) { |
| | |
| | | let result = [] |
| | | |
| | | langList.forEach(lan => { |
| | | if (lan === defLang) return |
| | | |
| | | list.forEach(n => { |
| | | result.push(`'${lan}',${n}`) |
| | | }) |
| | |
| | | |
| | | if (!btn.verify) return |
| | | |
| | | btn.verify.columns && btn.verify.columns.forEach(col => { |
| | | if (col.Text) { |
| | | col.Text = replaceTitle(col.Text) |
| | | } |
| | | }) |
| | | |
| | | btn.verify.uniques && btn.verify.uniques.forEach(col => { |
| | | if (col.fieldlabel) { |
| | | col.fieldlabel = col.fieldlabel.split(',').map(n => replaceTitle(n)).join(',') |
| | | } |
| | | }) |
| | | |
| | | btn.verify.customverifys && btn.verify.customverifys.forEach(script => { |
| | | script.sql = filterSql(script.sql) |
| | | |
| | | if (script.errmsg) { |
| | | script.errmsg = replaceTitle(script.errmsg) |
| | | } |
| | | }) |
| | | btn.verify.scripts && btn.verify.scripts.forEach(script => { |
| | | script.sql = filterSql(script.sql) |
| | |
| | | } else { |
| | | if (item.wrap && item.wrap.title) { |
| | | item.wrap.title = replaceTitle(item.wrap.title) |
| | | } |
| | | if (item.plot && item.plot.title) { |
| | | item.plot.title = replaceTitle(item.plot.title) |
| | | } |
| | | if (item.wrap && (item.wrap.click === 'menu' || item.wrap.click === 'menus')) { |
| | | if (item.wrap.click === 'menu') { |
| | |
| | | } else if (card.setting.click === 'menu') { |
| | | resetMenu(card.setting) |
| | | } |
| | | card.elements && card.elements.forEach(cell => { |
| | | if (cell.eleType === 'button') { |
| | | filterBtn(cell) |
| | | if (cell.OpenType === 'popview' && cell.config) { |
| | | traversal(cell.config.components) |
| | | } else if (cell.OpenType === 'pop') { |
| | | if (cell.modal && cell.modal.fields.length) { |
| | | cell.modal.fields.forEach(n => { |
| | | filterForm(n) |
| | | }) |
| | | } |
| | | } |
| | | } else { |
| | | filterElement(cell) |
| | | } |
| | | }) |
| | | card.backElements && card.backElements.forEach(cell => { |
| | | if (cell.eleType === 'button') { |
| | | filterBtn(cell) |
| | | if (cell.OpenType === 'popview' && cell.config) { |
| | | traversal(cell.config.components) |
| | | } else if (cell.OpenType === 'pop') { |
| | | if (cell.modal && cell.modal.fields.length) { |
| | | cell.modal.fields.forEach(n => { |
| | | filterForm(n) |
| | | }) |
| | | } |
| | | } |
| | | } else { |
| | | filterElement(cell) |
| | | } |
| | | }) |
| | | }) |
| | | } else if (item.type === 'balcony') { |
| | | item.elements && item.elements.forEach(cell => { |
| | | if (cell.eleType === 'button') { |
| | | filterBtn(cell) |
| | | if (cell.OpenType === 'popview' && cell.config) { |
| | | traversal(cell.config.components) |
| | | } else if (cell.OpenType === 'pop') { |
| | | if (cell.modal && cell.modal.fields.length) { |
| | | cell.modal.fields.forEach(n => { |
| | | filterForm(n) |
| | | }) |
| | | } |
| | | } |
| | | } else { |
| | | filterElement(cell) |
| | | } |
| | | }) |
| | | } else if (item.type === 'table') { |
| | | let loopCol = (cols) => { |
| | | cols.forEach(col => { |
| | | if (col.label) { |
| | | col.label = replaceTitle(col.label) |
| | | } |
| | | if (col.prefix) { |
| | | col.prefix = replaceTitle(col.prefix) |
| | | } |
| | | if (col.postfix) { |
| | | col.postfix = replaceTitle(col.postfix) |
| | | } |
| | | if (col.type === 'colspan') { |
| | | loopCol(col.subcols) |
| | | } else if (col.type === 'custom') { |
| | | col.elements.forEach(cell => { |
| | | if (cell.eleType === 'button') { |
| | | filterBtn(cell) |
| | | if (cell.OpenType === 'popview' && cell.config) { |
| | | traversal(cell.config.components) |
| | | } else if (cell.OpenType === 'pop') { |
| | | if (cell.modal && cell.modal.fields.length) { |
| | | cell.modal.fields.forEach(n => { |
| | | filterForm(n) |
| | | }) |
| | | } |
| | | } |
| | | } else { |
| | | filterElement(cell) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | loopCol(item.cols) |
| | | } else if (item.type === 'form') { |
| | | item.subcards.forEach(cell => { |
| | | filterBtn(cell.subButton) |
| | | cell.fields.forEach(n => { |
| | | filterForm(n) |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (config.interfaces) { |
| | | config.interfaces.forEach(item => { |
| | | if (item.setting.interType === 'system') { |
| | | item.setting.dataresource = filterSql(item.setting.dataresource) |
| | | item.scripts && item.scripts.forEach(script => { |
| | | script.sql = filterSql(script.sql) |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | traversal(config.components) |
| | | } |
| | | |
| | | /** |
| | | * @description 语言转换 |
| | | */ |
| | | export function setLangSingleTrans (config, btnDict, titDict, lisDict, menuDict, regs) { |
| | | let filterElement = (card) => { |
| | | if (card.datatype === 'static' && card.eleType === 'text' && !/@.+@/g.test(card.value)) { |
| | | if (card.value) { |
| | | card.value = replaceTitle(card.value) |
| | | } |
| | | } |
| | | if (card.prefix) { |
| | | card.prefix = replaceTitle(card.prefix) |
| | | } |
| | | if (card.postfix) { |
| | | card.postfix = replaceTitle(card.postfix) |
| | | } |
| | | } |
| | | |
| | | let replaceTitle = (val) => { |
| | | if (/(:|:)$/g.test(val)) { |
| | | let _val = val.replace(/(:|:)$/g, '') |
| | | if (titDict[_val]) { |
| | | val = titDict[_val] + val.substr(-1) |
| | | } else if (titDict[val]) { |
| | | val = titDict[val] |
| | | } |
| | | } else if (titDict[val]) { |
| | | val = titDict[val] |
| | | } |
| | | |
| | | return val |
| | | } |
| | | |
| | | let getuuid = () => { |
| | | let uuid = [] |
| | | let _options = '0123456789abcdefghigklmnopqrstuv' |
| | | for (let i = 0; i < 19; i++) { |
| | | uuid.push(_options.substr(Math.floor(Math.random() * 0x20), 1)) |
| | | } |
| | | return uuid.join('') |
| | | } |
| | | |
| | | let filterSql = (sl) => { |
| | | if (!sl) return |
| | | |
| | | let arr = [] |
| | | |
| | | sl = sl.replace(/\/\*[^*/]+\*\//g, (word) => { |
| | | let uuid = getuuid() |
| | | arr.push({id: `/*${uuid}*/`, value: word}) |
| | | return `/*${uuid}*/` |
| | | }) |
| | | |
| | | regs.forEach(item => { |
| | | sl = sl.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | arr.forEach(item => { |
| | | sl = sl.replace(item.id, item.value) |
| | | }) |
| | | |
| | | return sl |
| | | } |
| | | |
| | | let filterBtn = (btn) => { |
| | | if (btn.label && btnDict[btn.label]) { |
| | | btn.label = btnDict[btn.label] |
| | | } |
| | | |
| | | if (!btn.verify) return |
| | | |
| | | btn.verify.columns && btn.verify.columns.forEach(col => { |
| | | if (col.Text) { |
| | | col.Text = replaceTitle(col.Text) |
| | | } |
| | | }) |
| | | |
| | | btn.verify.uniques && btn.verify.uniques.forEach(col => { |
| | | if (col.fieldlabel) { |
| | | col.fieldlabel = col.fieldlabel.split(',').map(n => replaceTitle(n)).join(',') |
| | | } |
| | | }) |
| | | |
| | | btn.verify.customverifys && btn.verify.customverifys.forEach(script => { |
| | | script.sql = filterSql(script.sql) |
| | | |
| | | if (script.errmsg) { |
| | | script.errmsg = replaceTitle(script.errmsg) |
| | | } |
| | | }) |
| | | btn.verify.scripts && btn.verify.scripts.forEach(script => { |
| | | script.sql = filterSql(script.sql) |
| | | }) |
| | | btn.verify.cbScripts && btn.verify.cbScripts.forEach(script => { |
| | | script.sql = filterSql(script.sql) |
| | | }) |
| | | |
| | | if (btn.OpenType === 'funcbutton') { |
| | | if (btn.intertype === 'system' && btn.verify.dataType === 'custom' && btn.verify.setting) { |
| | | btn.verify.setting.dataresource = filterSql(btn.verify.setting.dataresource) |
| | | } |
| | | } else if (btn.OpenType === 'excelOut' && btn.verify.dataresource) { |
| | | btn.verify.dataresource = filterSql(btn.verify.dataresource) |
| | | } |
| | | } |
| | | |
| | | let filterForm = (n) => { |
| | | if (n.label) { |
| | | n.label = replaceTitle(n.label) |
| | | } |
| | | if (n.resourceType === '1') { |
| | | n.dataSource = filterSql(n.dataSource) |
| | | } else if (n.options) { |
| | | n.options.forEach(o => { |
| | | if (o.Text && lisDict[o.Text]) { |
| | | o.Text = lisDict[o.Text] |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | let traversal = (components) => { |
| | | if (!components) return |
| | | |
| | | components.forEach(item => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | if (tab.label) { |
| | | tab.label = replaceTitle(tab.label) |
| | | } |
| | | traversal(tab.components) |
| | | }) |
| | | } else if (item.type === 'group') { |
| | | traversal(item.components) |
| | | } else { |
| | | if (item.wrap && item.wrap.title) { |
| | | item.wrap.title = replaceTitle(item.wrap.title) |
| | | } |
| | | if (item.plot && item.plot.title) { |
| | | item.plot.title = replaceTitle(item.plot.title) |
| | | } |
| | | if (item.setting && (!item.wrap || !item.wrap.datatype || item.wrap.datatype === 'dynamic')) { |
| | | if (item.setting.interType === 'system') { |
| | | item.setting.dataresource = filterSql(item.setting.dataresource) |
| | | item.scripts && item.scripts.forEach(script => { |
| | | script.sql = filterSql(script.sql) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | if (item.columns) { |
| | | item.columns.forEach(cell => { |
| | | if (cell.label) { |
| | | cell.label = replaceTitle(cell.label) |
| | | } |
| | | }) |
| | | } |
| | | if (item.search) { |
| | | if (item.type === 'topbar') { |
| | | if (item.search.fields) { |
| | | item.search.fields.forEach(cell => { |
| | | filterForm(cell) |
| | | }) |
| | | } |
| | | if (item.search.groups) { |
| | | item.search.groups.forEach(group => { |
| | | if (group.fields) { |
| | | group.fields.forEach(cell => { |
| | | filterForm(cell) |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } else { |
| | | item.search.forEach(cell => { |
| | | filterForm(cell) |
| | | }) |
| | | } |
| | | } |
| | | if (item.action) { |
| | | item.action.forEach(cell => { |
| | | filterBtn(cell) |
| | | if (cell.OpenType === 'popview' && cell.config) { |
| | | traversal(cell.config.components) |
| | | } else if (cell.OpenType === 'pop') { |
| | | if (cell.modal && cell.modal.fields.length) { |
| | | cell.modal.fields.forEach(n => { |
| | | filterForm(n) |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (item.type === 'menubar') { |
| | | item.subMenus = item.subMenus.map(cell => { |
| | | if (cell.setting.name && menuDict[cell.setting.name]) { |
| | | cell.setting.name = menuDict[cell.setting.name] |
| | | } |
| | | return cell |
| | | }) |
| | | } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { |
| | | item.subcards.forEach(card => { |
| | | card.elements && card.elements.forEach(cell => { |
| | | if (cell.eleType === 'button') { |
| | | filterBtn(cell) |
| | |
| | | let sFields = getSearches(searches) |
| | | |
| | | let _columns = [] |
| | | if (item.subtype === 'dualdatacard') { |
| | | if (item.subtype === 'dualdatacard' && item.setting.subdata !== 'sub_data_string') { |
| | | _columns = [...item.columns, ...item.subColumns] |
| | | } else if (item.columns) { |
| | | _columns = [...item.columns] |
| | |
| | | } else if (item.setting.laypage === 'true' && item.setting.order) { |
| | | LText = `select top @pageSize@ ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by @orderBy@) as rows from ${_dataresource} ${_search}) tmptable where rows > @pageSize@ * (@pageIndex@ - 1) order by tmptable.rows ` |
| | | reps.push('pageSize', 'orderBy', 'pageIndex') |
| | | if (item.subtype === 'dualdatacard') { |
| | | if (item.subtype === 'dualdatacard' && item.setting.subdata !== 'sub_data_string') { |
| | | DateCount = `select count(1) as total from (select distinct ${item.setting.primaryKey || 'ID'} from ${_dataresource} ${_search})a` |
| | | } else { |
| | | DateCount = `select count(1) as total from ${_dataresource} ${_search}` |
| | |
| | | let parid = '' |
| | | let sub_field = '' |
| | | |
| | | if (item.subtype === 'dualdatacard') { |
| | | if (item.subtype === 'dualdatacard' && item.setting.subdata !== 'sub_data_string') { |
| | | arr_field = item.columns.map(col => col.field).join(',') |
| | | sub_name = item.setting.subdata |
| | | tabid = item.setting.primaryKey || '' |