From b48528b1a1a88e289fc0b7ad52f2da213a3f9dfe Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 23 四月 2025 16:34:38 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/utils/utils-custom.js |  170 +++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 137 insertions(+), 33 deletions(-)

diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js
index fd5c790..62635f2 100644
--- a/src/utils/utils-custom.js
+++ b/src/utils/utils-custom.js
@@ -1936,8 +1936,12 @@
     if (['pop', 'prompt', 'exec'].includes(cell.OpenType) && cell.verify && !cell.output) {
       if (cell.verify.noteEnable === 'true') {
         errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濇湭璁剧疆杩斿洖鍊肩煭淇″彂閫佹棤鏁堬紒`})
+      } else if (cell.verify.wxNote === 'true') {
+        errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濇湭璁剧疆杩斿洖鍊煎叕浼楀彿娑堟伅鏃犳晥锛乣})
       } else if (cell.verify.emailEnable === 'true') {
         errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濇湭璁剧疆杩斿洖鍊奸偖浠跺彂閫佹棤鏁堬紒`})
+      } else if (cell.verify.DeepSeekable === 'true') {
+        errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濇湭璁剧疆杩斿洖鍊糄eekSeek鏃犳晥锛乣})
       }
     }
 
@@ -1979,15 +1983,20 @@
 
       if (cell.OpenType === 'form' && cell.formType === 'count_line') return
      
-      if (cell.intertype === 'system') {
-        // if (cell.Ot === 'notRequired' && cell.verify && cell.verify.voucher && cell.verify.voucher.enabled) {
-        //   errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅娇鐢ㄤ簡鍒涘缓鍑瘉鍑芥暟锛岄渶瑕侀�夋嫨琛岋紒`})
-        // }
-      } else if (cell.intertype === 'custom' || cell.intertype === 'outer') {
-        if (cell.callbackType === 'script' && (!cell.verify || !cell.verify.cbScripts || cell.verify.cbScripts.filter(item => item.status !== 'false').length === 0)) {
-          errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅娇鐢ㄤ簡鑷畾涔夎剼鏈洖璋冿紝鍥炶皟鑴氭湰涓嶅彲涓虹┖锛乣})
-        // } else if (cell.procMode === 'system' && cell.Ot === 'notRequired' && cell.verify && cell.verify.voucher && cell.verify.voucher.enabled) {
-        //   errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅娇鐢ㄤ簡鍒涘缓鍑瘉鍑芥暟锛岄渶瑕侀�夋嫨琛岋紒`})
+      // if (cell.intertype === 'system') {
+      //   // if (cell.Ot === 'notRequired' && cell.verify && cell.verify.voucher && cell.verify.voucher.enabled) {
+      //   //   errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅娇鐢ㄤ簡鍒涘缓鍑瘉鍑芥暟锛岄渶瑕侀�夋嫨琛岋紒`})
+      //   // }
+      // } else if (cell.intertype === 'custom' || cell.intertype === 'outer') {
+      //   if (cell.callbackType === 'script' && (!cell.verify || !cell.verify.cbScripts || cell.verify.cbScripts.filter(item => item.status !== 'false').length === 0)) {
+      //     errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅娇鐢ㄤ簡鑷畾涔夎剼鏈洖璋冿紝鍥炶皟鑴氭湰涓嶅彲涓虹┖锛乣})
+      //   // } else if (cell.procMode === 'system' && cell.Ot === 'notRequired' && cell.verify && cell.verify.voucher && cell.verify.voucher.enabled) {
+      //   //   errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅娇鐢ㄤ簡鍒涘缓鍑瘉鍑芥暟锛岄渶瑕侀�夋嫨琛岋紒`})
+      //   }
+      // }
+      if ((cell.intertype === 'custom' || cell.intertype === 'outer') && cell.callbackType === 'script') {
+        if (!cell.verify || !cell.verify.cbScripts) {
+          errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅娇鐢ㄤ簡鑷畾涔夎剼鏈洖璋冿紝璇疯缃獙璇佷俊鎭紒`})
         }
       }
     } else if (cell.OpenType === 'funcbutton') {
@@ -2131,8 +2140,12 @@
       if (item.subButton.verify && !item.subButton.output) {
         if (item.subButton.verify.noteEnable === 'true') {
           errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳鏈缃繑鍥炲�肩煭淇″彂閫佹棤鏁堬紒`})
+        } else if (item.subButton.verify.wxNote === 'true') {
+          errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳鏈缃繑鍥炲�煎叕浼楀彿娑堟伅鏃犳晥锛乣})
         } else if (item.subButton.verify.emailEnable === 'true') {
           errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳鏈缃繑鍥炲�奸偖浠跺彂閫佹棤鏁堬紒`})
+        } else if (item.subButton.verify.DeepSeekable === 'true') {
+          errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳鏈缃繑鍥炲�糄eekSeek鏃犳晥锛乣})
         }
       }
 
@@ -2334,9 +2347,16 @@
     })
     return false
   } else if (/\sdecimal\(8,/ig.test(sql)) {
+    let lines = ''
+    sql.split(/\n/).forEach((s, i) => {
+      if (/(^|\s)decimal\(8,/ig.test(s)) {
+        lines = '绗�' + (i + 1) + '琛屼腑'
+      }
+    })
+
     notification.warning({
       top: 92,
-      message: `涓嶅彲浣跨敤 decimal(8`,
+      message: `${lines}涓嶅彲浣跨敤 decimal(8`,
       duration: 5
     })
     return false
@@ -2454,8 +2474,9 @@
   let filterSql = (sl) => {
     if (!sl) return
 
+    let _sl = sl.replace(/\/\*[^*/]+\*\//g, '')
     let cutreg = /[\u4E00-\u9FA5銆傦紒锛屻�乚+/ig
-    let tbs = sl.match(cutreg)
+    let tbs = _sl.match(cutreg)
 
     if (!tbs) return
     
@@ -2507,6 +2528,10 @@
       } else if (item.type === 'group') {
         traversal(item.components)
       } else {
+        if (item.wrap && item.wrap.title) {
+          sql.push(item.wrap.title)
+        }
+        
         if (item.setting && (!item.wrap || !item.wrap.datatype || item.wrap.datatype === 'dynamic')) {
           if (item.setting.interType === 'system') {
             filterSql(item.setting.dataresource)
@@ -2723,6 +2748,8 @@
   text = text.filter(Boolean)
   menu = menu.filter(Boolean)
 
+  sql = sql.map(n => n.replace(/(:|锛�)$/g, ''))
+
   sql = Array.from(new Set(sql))
   btn = Array.from(new Set(btn))
   ops = Array.from(new Set(ops))
@@ -2758,23 +2785,59 @@
 export function setLangTrans (config, btnDict, titDict, lisDict, menuDict, regs, tail) {
   let filterElement = (card) => {
     if (card.datatype === 'static' && card.eleType === 'text' && !/@.+@/g.test(card.value)) {
-      if (card.value && titDict[card.value]) {
-        card.value = titDict[card.value]
+      if (card.value) {
+        card.value = replaceTitle(card.value)
       }
     }
-    if (card.prefix && titDict[card.prefix]) {
-      card.prefix = titDict[card.prefix]
+    if (card.prefix) {
+      card.prefix = replaceTitle(card.prefix)
     }
-    if (card.postfix && titDict[card.postfix]) {
-      card.postfix = titDict[card.postfix]
+    if (card.postfix) {
+      card.postfix = replaceTitle(card.postfix)
     }
+  }
+
+  let replaceTitle = (val)聽=> {
+    if聽(/(:|锛�)$/g.test(val)) {
+      let _val = val.replace(/(:|锛�)$/g,聽'')
+      if聽(titDict[_val]) {
+        val = titDict[_val] + val.substr(-1)
+      }聽else if (titDict[val]) {
+        val = titDict[val]
+      }
+    }聽else if (titDict[val]) {
+      val = titDict[val]
+    }
+
+    return val
+  }
+
+  let getuuid = () => {
+    let uuid = []
+    let _options = '0123456789abcdefghigklmnopqrstuv'
+    for (let i = 0; i < 19; i++) {
+      uuid.push(_options.substr(Math.floor(Math.random() * 0x20), 1))
+    }
+    return uuid.join('')
   }
 
   let filterSql = (sl) => {
     if (!sl) return
 
+    let arr = []
+    
+    sl = sl.replace(/\/\*[^*/]+\*\//g, (word) => {
+      let uuid = getuuid()
+      arr.push({id: `/*${uuid}*/`, value: word})
+      return `/*${uuid}*/`
+    })
+
     regs.forEach(item => {
       sl = sl.replace(item.reg, item.value)
+    })
+
+    arr.forEach(item => {
+      sl = sl.replace(item.id, item.value)
     })
 
     return sl
@@ -2858,8 +2921,8 @@
   }
 
   let filterForm = (n) => {
-    if (n.label && titDict[n.label]) {
-      n.label = titDict[n.label]
+    if (n.label) {
+      n.label = replaceTitle(n.label)
     }
     if (n.resourceType === '1') {
       n.dataSource = filterSql(n.dataSource)
@@ -2920,14 +2983,17 @@
     components.forEach(item => {
       if (item.type === 'tabs') {
         item.subtabs.forEach(tab => {
-          if (tab.label && titDict[tab.label]) {
-            tab.label = titDict[tab.label]
+          if (tab.label) {
+            tab.label = replaceTitle(tab.label)
           }
           traversal(tab.components)
         })
       } else if (item.type === 'group') {
         traversal(item.components)
       } else {
+        if (item.wrap && item.wrap.title) {
+          item.wrap.title = replaceTitle(item.wrap.title)
+        }
         if (item.wrap && (item.wrap.click === 'menu' || item.wrap.click === 'menus')) {
           if (item.wrap.click === 'menu') {
             resetMenu(item.wrap)
@@ -2952,8 +3018,8 @@
 
         if (item.columns) {
           item.columns.forEach(cell => {
-            if (cell.label && titDict[cell.label]) {
-              cell.label = titDict[cell.label]
+            if (cell.label) {
+              cell.label = replaceTitle(cell.label)
             }
           })
         }
@@ -3072,14 +3138,14 @@
         } else if (item.type === 'table') {
           let loopCol = (cols) => {
             cols.forEach(col => {
-              if (col.label && titDict[col.label]) {
-                col.label = titDict[col.label]
+              if (col.label) {
+                col.label = replaceTitle(col.label)
               }
-              if (col.prefix && titDict[col.prefix]) {
-                col.prefix = titDict[col.prefix]
+              if (col.prefix) {
+                col.prefix = replaceTitle(col.prefix)
               }
-              if (col.postfix && titDict[col.postfix]) {
-                col.postfix = titDict[col.postfix]
+              if (col.postfix) {
+                col.postfix = replaceTitle(col.postfix)
               }
               if (col.type === 'colspan') {
                 loopCol(col.subcols)
@@ -3913,6 +3979,30 @@
   
     // 鍞竴鎬ч獙璇侊紝蹇呴』瀛樺湪琛ㄥ崟锛堣〃鍗曞瓨鍦ㄦ椂锛屼富閿潎涓哄崟鍊硷級,蹇呴』濉啓鏁版嵁婧愶紝澶氳鎷兼帴鏃朵笉鍙敤
     if (formdata && verify.uniques && verify.uniques.length > 0 && btn.Ot !== 'requiredOnce') {
+      let nFields = []
+      let dataFields = []
+      formdata.forEach(form => {
+        let _key = form.key.toLowerCase()
+        if (form.type === 'number' || form.type === 'rate') {
+          nFields.push(_key)
+        } else if (form.type === 'date') {
+          dataFields.push(_key)
+        }
+      })
+      if (columns && columns.length > 0 && btn.Ot !== 'notRequired') {
+        columns.forEach(col => {
+          let _key = col.field.toLowerCase()
+          if (col.type === 'number') {
+            if (!nFields.includes(_key)) {
+              nFields.push(_key)
+            }
+          } else if (/^date/ig.test(col.datatype)) {
+            if (!dataFields.includes(_key)) {
+              dataFields.push(_key)
+            }
+          }
+        })
+      }
       verify.uniques.forEach(item => {
         let _fieldValue = []                     // 琛ㄥ崟閿�煎field=value
         let _value = []                          // 琛ㄥ崟鍊硷紝鐢ㄤ簬閿欒鎻愮ず
@@ -3938,7 +4028,13 @@
             _val2 = `' + ${BID} + '`
           } else {
             // _val2 = `@mk_${_key}_mk@`
-            _val2 = `' + @${_field} + '`
+            if (nFields.includes(_key)) {
+              _val2 = `' + cast (@${_field} as nvarchar(50)) + '`
+            } else if (dataFields.includes(_key)) {
+              _val2 = `' + CONVERT(nvarchar(50), @${_field}, 23) + '`
+            } else {
+              _val2 = `' + @${_field} + '`
+            }
           }
 
           _value.push(`${_labels[index] || ''}锛�${_val2}`)
@@ -4949,6 +5045,7 @@
     // }
 
     let _search = ''
+    
     if (item.setting.execute !== 'false') {
       _dataresource = item.setting.dataresource || ''
       _search = '@mk_search@'
@@ -4958,14 +5055,21 @@
       _search = ''
     }
 
+    let custompage = false
+    let testSql = _dataresource + _customScript + _tailScript
+
+    if (/order\s+by\s+sort_id\s*$/i.test(_dataresource)) {
+      custompage = true
+    } else if (/@pageSize@|@orderBy@|@mk_total/i.test(testSql)) {
+      custompage = true
+    }
+
     if (/\s/.test(_dataresource) && !/\)\s+tb$/.test(_dataresource)) {
       _dataresource = '(' + _dataresource + ') tb'
     }
 
     item.setting.dataresource = _dataresource
     item.setting.customScript = _customScript
-
-    let testSql = _dataresource + _customScript + _tailScript
     
     let decSql = [`@ErrorCode nvarchar(50),@retmsg nvarchar(4000)`]
     let secSql = [`@ErrorCode='S',@retmsg =''`]
@@ -5019,7 +5123,7 @@
     let DateCount = ''
     if (_dataresource) {
       /*system_query*/
-      if (/@pageSize@|@orderBy@|@mk_total/i.test(testSql) || (item.wrap && item.wrap.tree === 'true')) {
+      if (custompage || (item.wrap && item.wrap.tree === 'true')) {
         LText = `select ${arr_field} from ${_dataresource} ${_search} `
       } else if (item.setting.laypage === 'true' && item.setting.order) {
         LText = `select top @pageSize@ ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by @orderBy@) as rows from ${_dataresource} ${_search}) tmptable where rows > @pageSize@ * (@pageIndex@ - 1) order by tmptable.rows `

--
Gitblit v1.8.0