From d70c5b0eee48808b9a42d1f7685640f5bafc2ad3 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 13 三月 2023 10:03:53 +0800 Subject: [PATCH] 2023-03-13 --- src/utils/utils.js | 39 +++++++++++++++++++-------------------- 1 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/utils/utils.js b/src/utils/utils.js index 09aede5..4431f93 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -856,10 +856,9 @@ * @description 鑾峰彇excel瀵煎叆鍙傛暟 * @return {Object} item 鎸夐挳淇℃伅 * @return {Array} data excel鏁版嵁 - * @return {Object} dict 瀛楀吀椤� * @return {String} BID 涓婄骇Id */ -export function getExcelInSql (item, data, dict, BID, primaryId) { +export function getExcelInSql (item, data, BID, primaryId) { let btn = item.verify let keys = ['delete', 'drop', 'insert', 'truncate', 'update'] let userName = sessionStorage.getItem('User_Name') || '' @@ -956,7 +955,7 @@ let val = item[col.Column] !== undefined ? item[col.Column] : '' let _colindex = cols[cindex] || (cindex + 1) - let _position = (_topline + lindex + 1) + dict['main.excel.line'] + ' ' + _colindex + dict['main.excel.column'] + ' ' + let _position = (_topline + lindex + 1) + '琛� ' + _colindex + '鍒� ' if (/^Nvarchar/ig.test(col.type)) { if (typeof(val) === 'number') { @@ -966,54 +965,54 @@ val = val.replace(/(^\s*$)|\t*|\v*|'*/ig, '') if (!val && col.required === 'true') { // 蹇呭~鏍¢獙 - errors.push(_position + dict['main.excel.content.emptyerror']) + errors.push(_position + '鍐呭涓嶅彲涓虹┖') } else if (col.limit && val.length > col.limit) { // 闀垮害鏍¢獙 - errors.push(_position + dict['main.excel.content.maxlimit']) + errors.push(_position + '鍐呭瓒呴暱') } else { // 鍏抽敭瀛楁牎楠� keys.forEach(key => { let _patten = new RegExp('(^' + key + '\\s+)|(\\s+' + key + '\\s+)', 'ig') if (_patten.test(val)) { - errors.push(_position + dict['main.excel.includekey'] + key) + errors.push(_position + '鍚湁鍏抽敭瀛�' + key) } }) } } else if (/^int/ig.test(col.type)) { if (!val && val !== 0) { - errors.push(_position + dict['main.excel.content.emptyerror']) + errors.push(_position + '鍐呭涓嶅彲涓虹┖') } else { let _val = val + '' if (!/^(([^0][0-9]+|0)$)|^(([1-9]+)$)/.test(_val)) { // 妫�楠屾槸鍚︿负鏁存暟 - errors.push(_position + dict['main.excel.content.interror']) + errors.push(_position + '鍐呭搴斾负鏁存暟') } else if ((col.min || col.min === 0) && val < col.min) { // 鏈�灏忓�兼楠� - errors.push(_position + dict['main.excel.content.limitmin']) + errors.push(_position + '灏忎簬鏈�灏忓��') } else if ((col.max || col.max === 0) && val > col.max) { // 鏈�澶у�兼楠� - errors.push(_position + dict['main.excel.content.limitmax']) + errors.push(_position + '澶т簬鏈�澶у��') } } } else if (/^Decimal/ig.test(col.type)) { if (!val && val !== 0) { - errors.push(_position + dict['main.excel.content.emptyerror']) + errors.push(_position + '鍐呭涓嶅彲涓虹┖') } else { let _val = val + '' let _vals = _val.split('.') if (!/^(([^0][0-9]+|0)\.([0-9]+)$)|^(([^0][0-9]+|0)$)|^(([1-9]+)\.([0-9]+)$)|^(([1-9]+)$)/.test(_val)) { // 妫�楠屾槸鍚︿负娴偣鏁� - errors.push(_position + dict['main.excel.content.floaterror']) + errors.push(_position + '鍐呭搴斾负娴偣鏁�') } else if (_vals[0].length > 18) { // 妫�楠屾暣鏁颁綅 - errors.push(_position + dict['main.excel.content.floatIntover']) + errors.push(_position + '鏁存暟浣嶈秴鍑鸿寖鍥�') } else if (_vals[1] && _vals[1].length > col.limit) { // 鏈�灏忓�兼楠� - errors.push(_position + dict['main.excel.content.floatPointover']) + errors.push(_position + '灏忔暟浣嶈秴鍑鸿寖鍥�') } else if ((col.min || col.min === 0) && val < col.min) { // 鏈�灏忓�兼楠� - errors.push(_position + dict['main.excel.content.limitmin']) + errors.push(_position + '灏忎簬鏈�灏忓��') } else if ((col.max || col.max === 0) && val > col.max) { // 鏈�澶у�兼楠� - errors.push(_position + dict['main.excel.content.limitmax']) + errors.push(_position + '澶т簬鏈�澶у��') } } } else if (col.type === 'date') { if (typeof(val) === 'number') { if (val > 2958465 || val <= 0) { // 鏃堕棿杩囧ぇ鎴栧皬浜庣瓑浜�0 - errors.push(_position + dict['main.excel.content.date.over']) + errors.push(_position + '鏃堕棿涓鸿礋鍊兼垨澶ぇ') } else { // 鏃堕棿鏍煎紡鍖� if (val < 60) { // 1900-2-29锛宔xcel涓瓨鍦紝瀹為檯涓嶅瓨鍦� val++ @@ -1023,12 +1022,12 @@ } else if (typeof(val) === 'string') { val = val.replace(/(^\s*$)|\t*|\v*/ig, '') if (!val && col.required === 'true') { // 鏃堕棿蹇呭~鏍¢獙 - errors.push(_position + dict['main.excel.content.emptyerror']) + errors.push(_position + '鍐呭涓嶅彲涓虹┖') } else if (val && !/^[1-9][0-9]{3}/.test(val)) { // 鏃堕棿姝e垯鏍¢獙 - errors.push(_position + dict['main.excel.content.date.formatError']) + errors.push(_position + '鏃堕棿鏍煎紡閿欒') } } else { // 鏃堕棿鏍煎紡閿欒 - errors.push(_position + dict['main.excel.content.date.formatError']) + errors.push(_position + '鏃堕棿鏍煎紡閿欒') } } -- Gitblit v1.8.0