From 437c6d72f76072e5ab1b09e78101370805113c4b Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 01 十月 2023 18:46:37 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/templates/zshare/customscript/index.jsx | 46 +++++++++++++++++++++++++++++++++++----------- 1 files changed, 35 insertions(+), 11 deletions(-) diff --git a/src/templates/zshare/customscript/index.jsx b/src/templates/zshare/customscript/index.jsx index 662e012..80db92a 100644 --- a/src/templates/zshare/customscript/index.jsx +++ b/src/templates/zshare/customscript/index.jsx @@ -94,18 +94,23 @@ let _usefulFields = [] searches.forEach(item => { - if (!item.field) return - if (item.type === 'group') { - _usefulFields.push(item.field) - _usefulFields.push(item.datefield) - _usefulFields.push(item.datefield + '1') - } else if (['dateweek', 'datemonth', 'daterange'].includes(item.type)) { - _usefulFields.push(item.field) - _usefulFields.push(item.field + '1') - } else if (_usefulFields.includes(item.field)) { - _usefulFields.push(item.field + '1') + if (['dateweek', 'datemonth'].includes(item.type)) { + _usefulFields.push(item.key) + _usefulFields.push(item.key + '1') + } else if (item.type === 'daterange') { + let _skey = item.key + let _ekey = item.key + '1' + + if (/,/.test(item.key)) { + _skey = item.key.split(',')[0] + _ekey = item.key.split(',')[1] + } + _usefulFields.push(_skey) + _usefulFields.push(_ekey) + } else if (item.type === 'date' && _usefulFields.includes(item.key)) { + _usefulFields.push(item.key + '1') } else { - _usefulFields.push(item.field.replace(/,/ig, ', ')) + _usefulFields.push(item.key.replace(/,/ig, ', ')) } }) @@ -238,6 +243,25 @@ duration: 5 }) return + } else if (/\son\s+[a-z0-9_]+\.[a-z0-9_]+\s*=\s*[a-z0-9_]+\.[a-z0-9_]+/ig.test(values.sql)) { + let list = values.sql.match(/\son\s+[a-z0-9_]+\.[a-z0-9_]+\s*=\s*[a-z0-9_]+\.[a-z0-9_]+/ig) + let errors = [] + list.forEach(str => { + str = str.replace(/^\s/, '') + let strs = str.match(/(\s|=)[a-z0-9_]+\./ig) + if (strs.length === 2 && (strs[0].replace(/\s|\./g, '') === strs[1].replace(/\s|\./g, ''))) { + errors.push(str) + } + }) + + if (errors.length > 0) { + notification.warning({ + top: 92, + message: '涓嶅彲浣跨敤鍚屼竴涓〃瀛楁杩涜鍏宠仈锛�' + errors.join('銆�'), + duration: 5 + }) + return + } } let error = Utils.verifySql(values.sql, 'customscript') -- Gitblit v1.8.0