From aaaf56d7ca060f7c681d6b8a67aac46aa89a4dbc Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 09 五月 2020 14:50:39 +0800 Subject: [PATCH] 2020-05-09 --- src/tabviews/commontable/index.jsx | 44 +++++++++++++++++++++++++++++++++++--------- 1 files changed, 35 insertions(+), 9 deletions(-) diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index a8ef6bd..08490e9 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -567,12 +567,15 @@ async loadmaindata () { const { setting, BIDs, search } = this.state let param = '' - let requireFields = search.filter(item => item.required && !item.value) + let requireFields = search.filter(item => item.required && (!item.value || item.value.length === 0)) if (requireFields.length > 0) { + let labels = requireFields.map(item => item.label) + labels = Array.from(new Set(labels)) + notification.warning({ top: 92, - message: this.state.dict['form.required.input'] + requireFields.map(item => item.label).join('銆�') + ' !', + message: this.state.dict['form.required.input'] + labels.join('銆�') + ' !', duration: 3 }) return @@ -690,20 +693,22 @@ _dataresource = '(' + _dataresource + ') tb' } - if (setting.queryType === 'statistics') { // 缁熻鏁版嵁婧愶紝鍐呭鏇挎崲 + let regoptions = null + if (setting.queryType === 'statistics' || param.custom_script) { let allSearch = Utils.getAllSearchOptions(search) - let options = allSearch.map(item => { + regoptions = allSearch.map(item => { return { reg: new RegExp('@' + item.key + '@', 'ig'), - value: item.value + value: `'${item.value}'` } }) + } - options.forEach(item => { - _dataresource = _dataresource.replace(item.reg, `'${item.value}'`) + if (setting.queryType === 'statistics') { // 缁熻鏁版嵁婧愶紝鍐呭鏇挎崲 + regoptions.forEach(item => { + _dataresource = _dataresource.replace(item.reg, item.value) }) - _search = '' } @@ -715,7 +720,28 @@ DateCount = '' } - param.custom_script = Utils.formatOptions(param.custom_script) + if (param.custom_script) { + regoptions.push({ + reg: new RegExp('@orderBy@', 'ig'), + value: _orderBy + }) + if (setting.laypage !== 'false') { + regoptions.push({ + reg: new RegExp('@pageSize@', 'ig'), + value: pageSize + }, { + reg: new RegExp('@pageIndex@', 'ig'), + value: pageIndex + }) + } + + regoptions.forEach(item => { + param.custom_script = param.custom_script.replace(item.reg, item.value) + }) + + param.custom_script = Utils.formatOptions(param.custom_script) + } + param.LText = Utils.formatOptions(LText) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' param.secretkey = Utils.encrypt(param.LText, param.timestamp) -- Gitblit v1.8.0