From 876a5e6657d67df66bb525d02dd6d147ba81cae5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 05 一月 2023 09:53:37 +0800 Subject: [PATCH] 2023-01-05 --- src/utils/utils.js | 63 ++++++++++++++++++++++--------- 1 files changed, 44 insertions(+), 19 deletions(-) diff --git a/src/utils/utils.js b/src/utils/utils.js index 208c78a..8616197 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -59,6 +59,25 @@ } /** + * @description 鑾峰彇鍥捐〃楂樺害 + */ + static getHeight (val) { + if (typeof(val) === 'string') { + if (val.indexOf('px') > -1) { + val = parseFloat(val) + } else if (val.indexOf('vw') > -1) { + val = parseFloat(val) + val = document.body.clientWidth * val / 100 + } else if (val.indexOf('vh') > -1) { + val = parseFloat(val) + val = document.body.clientHeight * val / 100 + } + } + + return parseInt(val || 400) - 30 + } + + /** * @description 鏁版嵁婧愬悕绉帮紝鐢ㄤ簬缁熶竴鏌ヨ * @return {String} name */ @@ -764,6 +783,8 @@ arrfield.push(item.cardValField) if (item.urlField) { arrfield.push(item.urlField) + } else if (item.colorField) { + arrfield.push(item.colorField) } } @@ -789,10 +810,8 @@ arrfield = arrfield.join(',') if (item.orderBy) { - // sql = `select ${item.type === 'checkcard' ? 'top 20' : ''} ${arrfield} from (select distinct ${arrfield},${item.orderBy} as orderfield from ${_datasource} ) a order by orderfield ${item.orderType}` sql = `select distinct ${arrfield},${item.orderBy} as orderfield from ${_datasource} order by orderfield ${item.orderType}` } else { - // sql = `select ${item.type === 'checkcard' ? 'top 20' : ''} ${arrfield} from (select distinct ${arrfield} from ${_datasource}) a` sql = `select distinct ${arrfield} from ${_datasource}` } @@ -810,10 +829,6 @@ sql = sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) sql = sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) - - if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { - console.info(sql) - } return { sql: sql, @@ -1369,17 +1384,16 @@ * @return {Object} param 璇锋眰鍙傛暟 * @return {Array} data 鍒楄〃琛屾暟鎹� * @return {Array} columns 鏄剧ず鍒� - * @return {Object} tab 鏍囩淇℃伅 * @return {Boolean} retmsg 鏄惁闇�瑕佹暟鎹繑鍥� */ -export function getSysDefaultSql (btn, setting, formdata, param, data, columns, tab, retmsg = false, moduleParams, getOptions) { +export function getSysDefaultSql (btn, setting, formdata, param, data, columns, retmsg = false, moduleParams, getOptions) { let primaryId = param.ID let BID = param.BID || '' let verify = btn.verify || {} let datavars = {} // 澹版槑鐨勫彉閲忥紝琛ㄥ崟鍙婃樉绀哄垪 let _actionType = null let _callbacksql = '' - let foreignKey = tab && tab.foreignKey ? tab.foreignKey.toLowerCase() : '' + let foreignKey = setting.foreignKey ? setting.foreignKey.toLowerCase() : '' if (verify.default !== 'false') { // 鍒ゆ柇鏄惁浣跨敤榛樿sql _actionType = btn.sqlType @@ -1932,6 +1946,11 @@ values.push('@BID@') } + if (!keys.includes('typename')) { + keys.push('typename') + values.push('@typename@') + } + keys = keys.join(',') values = values.join(',') _insertsql = `insert into ${btn.sql} (${keys}) select ${values};` @@ -1989,6 +2008,9 @@ _form.push('FiYear=@FiYear') } } + if (!_arr.includes('typename')) { + _form.push('typename=@typename@') + } _form = _form.join(',') let _ID = '=@ID@' @@ -2041,7 +2063,7 @@ _sql += ` /* 榛樿sql */ - insert into snote (remark,createuserid,CreateUser,CreateStaff) select left('鍒犻櫎琛�:${btn.sql} 鏁版嵁: ${_msg}${primaryKey}='+@ID@,200),@userid@,@username,@fullname + insert into snote (remark,createuserid,CreateUser,CreateStaff,typename) select left('鍒犻櫎琛�:${btn.sql} 鏁版嵁: ${_msg}${primaryKey}='+@ID@,200),@userid@,@username,@fullname,@typename@ delete ${btn.sql} where ${primaryKey}${_ID};` } else if (_actionType === 'insertOrUpdate') { _sql += ` @@ -2096,6 +2118,7 @@ _sql = _sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) _sql = _sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) _sql = _sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) + _sql = _sql.replace(/@typename@/ig, `'admin'`) if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { // _sql = _sql.replace(/\n\s{8}/ig, '\n') @@ -2135,6 +2158,7 @@ if (mark.field[1] === 'static') { contrastVal = mark.contrastValue + originVal = originVal + '' } else { contrastVal = record[mark.field[2]] } @@ -2163,7 +2187,7 @@ style.color = mark.color innerStyle = {color: mark.color} } else if (type === 'background') { - style.background = mark.color + style.backgroundColor = mark.color if (mark.fontColor) { style.color = mark.fontColor innerStyle = {color: mark.fontColor} @@ -2252,7 +2276,7 @@ * @description 鍒涘缓椤甸潰瀛樺偍杩囩▼ * @return {String} */ - static getTableFunc (param, menu, config) { + static getTableFunc (func = 'func', menu, config) { let form = '' let formParam = '' let _vars = ['bid', 'pageindex', 'pagesize', 'ordercol', 'ordertype', 'exceltype', 'septmenuno', 'lang', 'debug', 'loginuid', 'sessionuid', 'userid', 'errorcode', 'retmsg'] @@ -2307,7 +2331,7 @@ ` } - let Ltext = `create proc ${param.innerFunc} + let Ltext = `create proc ${func} ( /*${menu.MenuName}*/ @appkey nvarchar(50)='', @BID nvarchar(50)='',${formParam} @@ -2322,6 +2346,7 @@ @LoginUID nvarchar(50)='', @SessionUid nvarchar(50)='', @UserID nvarchar(50), + @dataM nvarchar(50), @ErrorCode nvarchar(50) out, @retmsg nvarchar(4000) out ) @@ -2543,9 +2568,9 @@ @ErrorSeverity=ERROR_SEVERITY(), @ErrorState=ERROR_STATE(); - RAISERROR(@ErrorMessage, /*-- Message text.*/ - @ErrorSeverity, /*-- Severity.*/ - @ErrorState /*-- State.*/ + RAISERROR(@ErrorMessage, /* Message text.*/ + @ErrorSeverity, /* Severity.*/ + @ErrorState /* State.*/ ); END CATCH @@ -2684,9 +2709,9 @@ @ErrorSeverity=ERROR_SEVERITY(), @ErrorState=ERROR_STATE(); - RAISERROR(@ErrorMessage, /*-- Message text.*/ - @ErrorSeverity, /*-- Severity.*/ - @ErrorState /*-- State.*/ + RAISERROR(@ErrorMessage, /* Message text.*/ + @ErrorSeverity, /* Severity.*/ + @ErrorState /* State.*/ ); END CATCH -- Gitblit v1.8.0