From ff04f261ed6d4d9d44991071e58d9d2fa908c34d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 31 八月 2023 16:16:03 +0800 Subject: [PATCH] 2023-08-31 --- src/templates/sharecomponent/actioncomponent/verifyexcelin/columnform/index.jsx | 1 + src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx | 3 ++- src/utils/utils.js | 21 +++++++++++++++++++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/columnform/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/columnform/index.jsx index b9e2756..c9bbe28 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/columnform/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/columnform/index.jsx @@ -118,6 +118,7 @@ <Select.Option value="Decimal(18,4)"> Decimal(18,4) </Select.Option> <Select.Option value="Decimal(18,6)"> Decimal(18,6) </Select.Option> <Select.Option value="date"> date </Select.Option> + <Select.Option value="datetime"> datetime </Select.Option> </Select> )} </Form.Item> diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx index f22ea28..cb4990f 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx @@ -70,7 +70,8 @@ { value: 'Decimal(18,2)', text: 'Decimal(18,2)' }, { value: 'Decimal(18,4)', text: 'Decimal(18,4)' }, { value: 'Decimal(18,6)', text: 'Decimal(18,6)' }, - { value: 'date', text: 'date' } + { value: 'date', text: 'date' }, + { value: 'datetime', text: 'datetime' } ] }, { diff --git a/src/utils/utils.js b/src/utils/utils.js index 0c250c8..44c6a54 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -923,6 +923,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 +957,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 +965,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 +1021,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 @@ -1219,6 +1232,10 @@ {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 -- Gitblit v1.8.0