From 8cb851fe8f35b6ffba8beb1bfcac5d71dee6511a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 15 四月 2023 20:59:30 +0800 Subject: [PATCH] Merge branch 'develop' --- src/tabviews/zshare/actionList/normalbutton/index.jsx | 13 ++++++++++--- src/utils/utils.js | 19 +++++++++++++++---- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 4de4e94..53cdd31 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -855,17 +855,20 @@ if (!_initvars.includes(_key)) { _initvars.push(_key) + let val = form.value if (form.type === 'number' || form.type === 'rate') { - let val = form.value if (isNaN(val)) { val = 0 } _initFormfields.push(`@${_key}=${val}`) } else if (['date', 'datemonth'].includes(form.type)) { - _initFormfields.push(`@${_key}='${form.value || '1949-10-01'}'`) + _initFormfields.push(`@${_key}='${val || '1949-10-01'}'`) } else { - _initFormfields.push(`@${_key}='${form.value}'`) + if (/'/.test(val)) { + val = val.replace(/'/ig, '"') + } + _initFormfields.push(`@${_key}='${val}'`) } } @@ -911,6 +914,10 @@ if (col.datatype && /^date/ig.test(col.datatype) && !_val) { _val = '1949-10-01' } + + if (/'/.test(_val)) { + _val = _val.replace(/'/ig, '"') + } _initvars.push(_key) _initColfields.push(`@${_key}='${_val}'`) diff --git a/src/utils/utils.js b/src/utils/utils.js index 119a3ee..975b726 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -962,7 +962,11 @@ val = val.toString() } - val = val.replace(/(^\s*$)|\t*|\v*|'*/ig, '') + if (/'/.test(val)) { + val = val.replace(/'/ig, '"') + } + + val = val.replace(/(^\s*$)|\t*|\v*/ig, '') if (!val && col.required === 'true') { // 蹇呭~鏍¢獙 errors.push(_position + '鍐呭涓嶅彲涓虹┖') @@ -1469,17 +1473,20 @@ if (!_initvars.includes(_key)) { _initvars.push(_key) + let val = form.value if (form.type === 'number' || form.type === 'rate') { - let val = form.value if (isNaN(val)) { val = 0 } _initFormfields.push(`@${_key}=${val}`) } else if (['date', 'datemonth'].includes(form.type)) { - _initFormfields.push(`@${_key}='${form.value || '1949-10-01'}'`) + _initFormfields.push(`@${_key}='${val || '1949-10-01'}'`) } else { - _initFormfields.push(`@${_key}='${form.value}'`) + if (/'/.test(val)) { + val = val.replace(/'/ig, '"') + } + _initFormfields.push(`@${_key}='${val}'`) } } @@ -1526,6 +1533,10 @@ _val = '1949-10-01' } + if (/'/.test(_val)) { + _val = _val.replace(/'/ig, '"') + } + _initvars.push(_key) _initColfields.push(`@${_key}='${_val}'`) } -- Gitblit v1.8.0