From 9a11f818f304bc13bbd920313792e9560734922f Mon Sep 17 00:00:00 2001 From: hcong <1050828145@qq.com> Date: 星期五, 27 九月 2024 15:31:25 +0800 Subject: [PATCH] 合并冲突 --- src/main.js | 2 + src/components.d.ts | 1 src/views/fysp/config/components/evalution/CompEvalutionRuleUpd.vue | 3 + src/utils/DeepCopy.js | 65 ++++++++++++++++++++++++++++++++ src/router/index.js | 4 +- 5 files changed, 72 insertions(+), 3 deletions(-) diff --git a/src/components.d.ts b/src/components.d.ts index 893003c..c4f8efa 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -43,7 +43,6 @@ ElMenuItem: typeof import('element-plus/es')['ElMenuItem'] ElMenuItemGroup: typeof import('element-plus/es')['ElMenuItemGroup'] ElOption: typeof import('element-plus/es')['ElOption'] - ElPageHeader: typeof import('element-plus/es')['ElPageHeader'] ElPagination: typeof import('element-plus/es')['ElPagination'] ElPopconfirm: typeof import('element-plus/es')['ElPopconfirm'] ElPopover: typeof import('element-plus/es')['ElPopover'] diff --git a/src/main.js b/src/main.js index c56a19a..8a0d286 100644 --- a/src/main.js +++ b/src/main.js @@ -5,6 +5,7 @@ import { router } from './router'; import App from './App.vue'; import timeUtil from './utils/time-util'; +import DeepCopy from './utils/DeepCopy'; // import 'element-plus/dist/index.css'; import './assets/main.css'; @@ -17,6 +18,7 @@ const app = createApp(App); app.config.globalProperties.$fm = timeUtil; +app.config.globalProperties.$deepCopy = DeepCopy.deepCopy; for (const [key, component] of Object.entries(ElementPlusIconsVue)) { app.component(key, component); diff --git a/src/router/index.js b/src/router/index.js index f08c0ce..773a5ef 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -80,7 +80,7 @@ { //璁惧鍖归厤 name: 'fyspDeviceMatch', - path: '/fysp/config/deviceMatch', + path: '/fysp/config/fyspDeviceMatch', component: () => import('@/views/fysp/config/DeviceMatch.vue') }, { @@ -94,7 +94,7 @@ name: 'fyspEvalutationTask', path: '/fysp/evaluation/evalutationTask', component: () => import('@/views/fysp/evaluation/EvalutationTask.vue'), - meta: { keepAlive: false } + meta: { keepAlive: true } }, { //璇勪及绠$悊 diff --git a/src/utils/DeepCopy.js b/src/utils/DeepCopy.js new file mode 100644 index 0000000..5124708 --- /dev/null +++ b/src/utils/DeepCopy.js @@ -0,0 +1,65 @@ +export default { + deepCopy(target) { + const map = new WeakMap() + + function isObject(target) { + return (typeof target === 'object' && target ) || typeof target === 'function' + } + + function clone(data) { + if (!isObject(data)) { + return data + } + if ([Date, RegExp].includes(data.constructor)) { + return new data.constructor(data) + } + if (typeof data === 'function') { + return new Function('return ' + data.toString())() + } + const exist = map.get(data) + if (exist) { + return exist + } + if (data instanceof Map) { + const result = new Map() + map.set(data, result) + data.forEach((val, key) => { + if (isObject(val)) { + result.set(key, clone(val)) + } else { + result.set(key, val) + } + }) + return result + } + if (data instanceof Set) { + const result = new Set() + map.set(data, result) + data.forEach(val => { + if (isObject(val)) { + result.add(clone(val)) + } else { + result.add(val) + } + }) + return result + } + const keys = Reflect.ownKeys(data) + const allDesc = Object.getOwnPropertyDescriptors(data) + const result = Object.create(Object.getPrototypeOf(data), allDesc) + map.set(data, result) + keys.forEach(key => { + const val = data[key] + if (isObject(val)) { + result[key] = clone(val) + } else { + result[key] = val + } + }) + return result + } + // clone(target) + return JSON.parse(JSON.stringify(target)); + } + +} \ No newline at end of file diff --git a/src/views/fysp/config/components/evalution/CompEvalutionRuleUpd.vue b/src/views/fysp/config/components/evalution/CompEvalutionRuleUpd.vue index 1da7ece..d77cdba 100644 --- a/src/views/fysp/config/components/evalution/CompEvalutionRuleUpd.vue +++ b/src/views/fysp/config/components/evalution/CompEvalutionRuleUpd.vue @@ -62,7 +62,10 @@ import { enumScene } from '@/enum/scene'; import { ElMessage } from 'element-plus'; import evaluateApi from '@/api/fysp/evaluateApi'; +<<<<<<< HEAD import { useCloned } from '@vueuse/core'; +======= +>>>>>>> c06a5b40718062cc8b4b971322d7c394018cc972 export default { props: { readonly: { -- Gitblit v1.9.3