From 7adf0212cd71a8ec604f65ba2c2e9bdfc5dec22d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 13 一月 2023 10:31:38 +0800
Subject: [PATCH] 2023-01-13

---
 src/utils/utils.js |   81 +++++++++++++++++++++++++++-------------
 1 files changed, 54 insertions(+), 27 deletions(-)

diff --git a/src/utils/utils.js b/src/utils/utils.js
index 208c78a..2a82699 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
@@ -1473,7 +1487,7 @@
   }
 
   // 娣诲姞鏁版嵁涓瓧娈碉紝琛ㄥ崟鍊间紭鍏�(鎸夐挳涓嶉�夎鎴栧琛屾嫾鎺ユ椂璺宠繃)
-  if (data && btn.Ot !== 'notRequired' && btn.Ot !== 'requiredOnce' && columns && columns.length > 0) {
+  if (data && btn.Ot !== 'notRequired' && columns && columns.length > 0) {
     datavars = {...data, ...datavars}
 
     const setField = (col) => {
@@ -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@'
@@ -2020,17 +2042,16 @@
 
     _sql += `
       /* 榛樿sql */
-      update ${btn.sql} set deleted=1,modifydate=getdate(),modifyuser=@username,modifyuserid=@userid@ where ${primaryKey}${_ID};`
+      update ${btn.sql} set deleted=1,modifydate=getdate(),modifyuser=@username,modifystaff=@fullname,modifyuserid=@userid@ where ${primaryKey}${_ID};`
   
   } else if (_actionType === 'delete') {      // 鐗╃悊鍒犻櫎
     let _msg = ''
-    if (data && columns && columns.length > 0) {
+    if (data && columns && columns.length > 0 && btn.Ot !== 'notRequired') {
       let _index = 0
       columns.forEach(col => {
-        if (col.Hide !== 'true' && col.type !== 'colspan' && col.type !== 'old_colspan' && _index < 4) {
-          _msg += col.label + '=' + data[col.field] + ','
-          _index++
-        }
+        if (!col.field || col.Hide === 'true' || _index >= 4) return
+        _msg += col.label + '=' + data[col.field] + ','
+        _index++
       })
     }
 
@@ -2041,7 +2062,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 +2117,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')
@@ -2126,6 +2148,7 @@
   let icon = null
   let innerStyle = null
   let position = null
+  let signType = ''
   style = JSON.parse(JSON.stringify(style))
 
   marks.some(mark => {
@@ -2135,6 +2158,7 @@
 
     if (mark.field[1] === 'static') {
       contrastVal = mark.contrastValue
+      originVal = originVal + ''
     } else {
       contrastVal = record[mark.field[2]]
     }
@@ -2162,8 +2186,9 @@
     if (type === 'font') {
       style.color = mark.color
       innerStyle = {color: mark.color}
+      signType = ' sign-font'
     } else if (type === 'background') {
-      style.background = mark.color
+      style.backgroundColor = mark.color
       if (mark.fontColor) {
         style.color = mark.fontColor
         innerStyle = {color: mark.fontColor}
@@ -2193,7 +2218,8 @@
     style,
     icon,
     innerStyle,
-    position
+    position,
+    signType
   }
 }
 
@@ -2252,7 +2278,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 +2333,7 @@
       `
     }
 
-    let Ltext = `create proc ${param.innerFunc}
+    let Ltext = `create proc ${func}
     ( /*${menu.MenuName}*/
     @appkey nvarchar(50)='',
     @BID nvarchar(50)='',${formParam}
@@ -2322,6 +2348,7 @@
     @LoginUID nvarchar(50)='',
     @SessionUid nvarchar(50)='',
     @UserID nvarchar(50),
+    @dataM nvarchar(50),
     @ErrorCode nvarchar(50) out,
     @retmsg nvarchar(4000) out
     )
@@ -2543,9 +2570,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 +2711,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