From d2fd67a1bcec35db7870f55a83a25c043ae854f8 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 06 九月 2023 15:58:16 +0800 Subject: [PATCH] 2023-09-06 --- src/utils/utils.js | 33 +++++++++++++++++++++++++++++---- 1 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/utils/utils.js b/src/utils/utils.js index 77e646d..247f4b3 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -275,6 +275,10 @@ let roleId = sessionStorage.getItem('role_id') || '' let required = false let keys = [] + let values = null + if (config.wrap && config.wrap.cacheSearch === 'true') { + values = window.GLOB.SearchBox.get(config.$searchId + 'cache') + } config.search = config.search.map(item => { item.hidden = item.Hide === 'true' @@ -386,6 +390,10 @@ } item.oriInitval = item.initval + + if (values) { + item.initval = values[item.field] || '' + } if (item.blacklist && item.blacklist.length > 0 && !item.hidden) { if (item.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { @@ -923,6 +931,8 @@ val = 0 } else if (col.type === 'date') { val = '1949-10-01' + } else if (col.type === 'datetime') { + val = '1949-10-01 00:00:00' } } else if (/^Nvarchar/ig.test(col.type)) { val = val + '' @@ -955,7 +965,7 @@ } else if ((col.max || col.max === 0) && val > col.max) { // 鏈�澶у�兼楠� errors.push(_position + '澶т簬鏈�澶у��') } - } else if (col.type === 'date') { + } else if (col.type === 'date' || col.type === 'datetime') { if (typeof(val) === 'number') { if (val > 2958465 || val <= 0) { // 鏃堕棿杩囧ぇ鎴栧皬浜庣瓑浜�0 errors.push(_position + '鏃堕棿涓鸿礋鍊兼垨澶ぇ') @@ -963,7 +973,14 @@ if (val < 60) { // 1900-2-29锛宔xcel涓瓨鍦紝瀹為檯涓嶅瓨鍦� val++ } - val = moment('19000101', 'YYYYMMDD').add(Math.floor(val - 2), 'days').format('YYYY-MM-DD') + if (col.type === 'datetime') { + val = val - 2 + let day = Math.floor(val) + let seconds = Math.round((val - day) * 24 * 60 * 60) + val = moment('19000101', 'YYYYMMDD').add(day, 'days').add(seconds, 'seconds').format('YYYY-MM-DD HH:mm:ss') + } else { + val = moment('19000101', 'YYYYMMDD').add(Math.floor(val - 2), 'days').format('YYYY-MM-DD') + } } } else if (typeof(val) === 'string') { val = val.replace(/(^\s+$)|\t+|\v+/ig, '') @@ -1012,6 +1029,10 @@ {reg: /@\$/ig, value: isDM ? '*/' : ''}, {reg: /@datam@/ig, value: isDM ? `'Y'` : `''`}, ] + + if (window.GLOB.externalDatabase !== null) { + regs.push({reg: /@db@/ig, value: window.GLOB.externalDatabase}) + } btn.scripts && btn.scripts.forEach(script => { if (script.status === 'false') return @@ -1218,6 +1239,10 @@ {reg: /@\$/ig, value: isDM ? '*/' : ''}, {reg: /@datam@/ig, value: isDM ? `'Y'` : `''`}, ] + + if (window.GLOB.externalDatabase !== null) { + regs.push({reg: /@db@/ig, value: window.GLOB.externalDatabase}) + } btn.scripts && btn.scripts.forEach(script => { if (script.status === 'false') return @@ -1441,7 +1466,7 @@ if (!_vars.includes(_key)) { _vars.push(_key) - if (form.fieldlen && form.fieldlen > 2048) { + if (form.fieldlen && form.fieldlen > 4000) { form.fieldlen = 'max' } @@ -1495,7 +1520,7 @@ if (col.datatype) { _declarefields.push(`@${_key} ${col.datatype}`) } else { - if (col.fieldlength && col.fieldlength > 2048) { + if (col.fieldlength && col.fieldlength > 4000) { col.fieldlength = 'max' } -- Gitblit v1.8.0