Compare commits

...

2 Commits

2 changed files with 5 additions and 2 deletions

View File

@ -29,6 +29,7 @@
"@vue-office/excel": "^1.7.11", "@vue-office/excel": "^1.7.11",
"@vue-office/pdf": "^2.0.2", "@vue-office/pdf": "^2.0.2",
"@vueuse/core": "^10.11.0", "@vueuse/core": "^10.11.0",
"circular-json": "^0.5.9",
"cropperjs": "^1.6.2", "cropperjs": "^1.6.2",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
"echarts": "^5.5.1", "echarts": "^5.5.1",

View File

@ -4,6 +4,7 @@
const isNode = typeof require !== 'undefined' // 是否支持node函数 const isNode = typeof require !== 'undefined' // 是否支持node函数
const { ipcRenderer } = isNode?require('electron'):{} // app使用 const { ipcRenderer } = isNode?require('electron'):{} // app使用
import { sessionStore } from '@/utils/store' import { sessionStore } from '@/utils/store'
import CircularJSON from 'circular-json'
// import { diff } from 'jsondiffpatch' // import { diff } from 'jsondiffpatch'
// const Remote = isNode?require('@electron/remote'):{} // 远程模块 // const Remote = isNode?require('@electron/remote'):{} // 远程模块
@ -173,6 +174,7 @@ const findDifferences = (obj1, obj2) => {
for (const key in o1) { for (const key in o1) {
if (o1.hasOwnProperty(key)) { if (o1.hasOwnProperty(key)) {
const newPath = path ? `${path}.${key}` : key; const newPath = path ? `${path}.${key}` : key;
if(!o2) return
if (o2.hasOwnProperty(key)) { if (o2.hasOwnProperty(key)) {
const v1 = toJsonStr(o1[key]) const v1 = toJsonStr(o1[key])
const v2 = toJsonStr(o2[key]) const v2 = toJsonStr(o2[key])
@ -202,6 +204,6 @@ const findDifferences = (obj1, obj2) => {
return differences; return differences;
} }
// 对象克隆 // 对象克隆
const objClone = (obj) => JSON.parse(JSON.stringify(obj)) const objClone = (obj) => JSON.parse(CircularJSON.stringify(obj))
// 转换为json // 转换为json
const toJsonStr = (obj) => JSON.stringify(obj) const toJsonStr = (obj) => CircularJSON.stringify(obj)