处理JSON.对象异常
This commit is contained in:
@@ -25,7 +25,7 @@ const insert = ({table, form}) => {
|
|||||||
if (form.id) {//编辑
|
if (form.id) {//编辑
|
||||||
let arr = Object.keys(form).filter(e => form[e]).map(e => {
|
let arr = Object.keys(form).filter(e => form[e]).map(e => {
|
||||||
if (typeof form[e] == "object") {
|
if (typeof form[e] == "object") {
|
||||||
if (checkJson(form[e])) form[e] = JSON.stringify(form[e]).replace(/"/g, "\'")
|
if (checkJson(form[e])) form[e] = JSON.stringify(form[e]).replace(/"'/g, "\'")
|
||||||
else form[e] = JSON.stringify(form[e])
|
else form[e] = JSON.stringify(form[e])
|
||||||
}
|
}
|
||||||
return `${e}='${form[e]}'`
|
return `${e}='${form[e]}'`
|
||||||
@@ -37,7 +37,7 @@ const insert = ({table, form}) => {
|
|||||||
if (form[e]) {
|
if (form[e]) {
|
||||||
cols.push(e)
|
cols.push(e)
|
||||||
if (typeof form[e] == "object") {
|
if (typeof form[e] == "object") {
|
||||||
if (checkJson(form[e])) form[e] = JSON.stringify(form[e]).replace(/"/g, "\'")
|
if (checkJson(form[e])) form[e] = JSON.stringify(form[e]).replace(/"'/g, "\'")
|
||||||
else form[e] = JSON.stringify(form[e])
|
else form[e] = JSON.stringify(form[e])
|
||||||
}
|
}
|
||||||
arr.push(`'${form[e]}'`)
|
arr.push(`'${form[e]}'`)
|
||||||
|
|||||||
Reference in New Issue
Block a user