From b77c5e22f1ff192d9b09dda8d2376ba40641451c Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 06 八月 2020 12:06:50 +0800 Subject: [PATCH] 2020-08-06 --- src/utils/utils.js | 31 +++++++++++-------------------- 1 files changed, 11 insertions(+), 20 deletions(-) diff --git a/src/utils/utils.js b/src/utils/utils.js index c2cc84f..3fa55b7 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -705,7 +705,7 @@ * @return {String} btn 鎸夐挳 * @return {String} data excel鏁版嵁 */ - static getExcelInSql (item, data, dict) { + static getExcelInSql (item, data, dict, BID) { let btn = item.verify let keys = ['delete', 'drop', 'insert', 'truncate', 'update'] let userName = sessionStorage.getItem('User_Name') || '' @@ -815,7 +815,10 @@ if (val > 2958465 || val <= 0) { // 鏃堕棿杩囧ぇ鎴栧皬浜庣瓑浜�0 errors.push(_position + dict['main.excel.content.date.over']) } else { // 鏃堕棿鏍煎紡鍖� - val = this.formatExcelDate(val) + if (val < 60) { // 1900-2-29锛宔xcel涓瓨鍦紝瀹為檯涓嶅瓨鍦� + val++ + } + 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, '') @@ -840,9 +843,11 @@ _lineIndex = _lineIndex.substring(_lineIndex.length - 6) vals.push(`'${upId + _lineIndex}'`) + vals.push(`'${BID}'`) if (lindex < 40) { convals.push(`'${upId + _lineIndex}' as jskey`) + convals.push(`'${BID}' as BID`) conLtext.push(`Select ${convals.join(',')}`) } @@ -923,13 +928,13 @@ _sql = ` /* 绯荤粺鐢熸垚 */ - declare @${item.sheet} table (${declarefields.join(',')},jskey nvarchar(50) ) + declare @${item.sheet} table (${declarefields.join(',')},jskey nvarchar(50),BID nvarchar(50) ) Declare @UserName nvarchar(50),@FullName nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512) Select @ErrorCode='', @retmsg='', @UserName='${userName}', @FullName='${fullName}' ${_initCustomScript} ` - _sqlInsert = `Insert into @${item.sheet} (${fields},jskey)` + _sqlInsert = `Insert into @${item.sheet} (${fields},jskey,BID)` _sqlBottom = ` /* 榛樿sql */ delete tmp_excel_in where upid=@upid@ @@ -965,7 +970,7 @@ Select @ErrorCode='', @retmsg='', @UserName='${userName}', @FullName='${fullName}' ` } - + return { sql: _sql, lines: result.map((list, index) => { @@ -981,20 +986,6 @@ } /** - * @description 鏍煎紡鍖杄xcel涓殑date鍊� - * @param {Number} number 鏃堕棿鍊� - */ - static formatExcelDate(number) { - const time = new Date((number - 1) * 24 * 3600000 + 1) - time.setYear(time.getFullYear() - 70) - const year = time.getFullYear() - const month = time.getMonth() + 1 - const date = time.getDate() - 1 - - return `${year}-${(month < 10 ? '0' + month : month)}-${(date < 10 ? '0' + date : date)}` - } - - /** * @description 浣跨敤绯荤粺鍑芥暟鏃讹紙sPC_TableData_InUpDe 锛夛紝鐢熸垚sql璇彞 * @return {String} type 鎵ц绫诲瀷 * @return {String} table 琛ㄥ悕 @@ -1006,7 +997,7 @@ let _formFieldValue = {} let _actionType = null let appkey = window.GLOB.appkey || '' - let sessionUid = sessionStorage.getItem('SessionUid') || '' + let sessionUid = localStorage.getItem('SessionUid') || '' if (verify.default !== 'false') { // 鍒ゆ柇鏄惁浣跨敤榛樿sql _actionType = btn.sqlType -- Gitblit v1.8.0