Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vue3_onlineEditor
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pangchong
vue3_onlineEditor
Commits
50112533
Commit
50112533
authored
Apr 03, 2025
by
pangchong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 对比逻辑修改
parent
f8b097f2
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
34 deletions
+40
-34
components.d.ts
+1
-0
src/assets/file/Trans-Convert.xml
+2
-2
src/configs/render-elem.ts
+3
-6
src/views/editor/components/Compare.vue
+19
-3
src/views/editor/constants/compare.ts
+1
-0
src/views/editor/functions/compare.ts
+14
-23
No files found.
components.d.ts
View file @
50112533
...
@@ -20,6 +20,7 @@ declare module 'vue' {
...
@@ -20,6 +20,7 @@ declare module 'vue' {
NLayoutHeader
:
typeof
import
(
'naive-ui'
)[
'NLayoutHeader'
]
NLayoutHeader
:
typeof
import
(
'naive-ui'
)[
'NLayoutHeader'
]
NMessageProvider
:
typeof
import
(
'naive-ui'
)[
'NMessageProvider'
]
NMessageProvider
:
typeof
import
(
'naive-ui'
)[
'NMessageProvider'
]
NModalProvider
:
typeof
import
(
'naive-ui'
)[
'NModalProvider'
]
NModalProvider
:
typeof
import
(
'naive-ui'
)[
'NModalProvider'
]
NResult
:
typeof
import
(
'naive-ui'
)[
'NResult'
]
NSpace
:
typeof
import
(
'naive-ui'
)[
'NSpace'
]
NSpace
:
typeof
import
(
'naive-ui'
)[
'NSpace'
]
NTree
:
typeof
import
(
'naive-ui'
)[
'NTree'
]
NTree
:
typeof
import
(
'naive-ui'
)[
'NTree'
]
RouterLink
:
typeof
import
(
'vue-router'
)[
'RouterLink'
]
RouterLink
:
typeof
import
(
'vue-router'
)[
'RouterLink'
]
...
...
src/assets/file/Trans-Convert.xml
View file @
50112533
...
@@ -2,14 +2,14 @@
...
@@ -2,14 +2,14 @@
<!--Arbortext, Inc., 1988-2013, v.4002-->
<!--Arbortext, Inc., 1988-2013, v.4002-->
<!DOCTYPE JOBCARD PUBLIC "-//CEA-TEXT//DTD JOBCARD-VER1//EN" "JOBCARD.dtd" [
<!DOCTYPE JOBCARD PUBLIC "-//CEA-TEXT//DTD JOBCARD-VER1//EN" "JOBCARD.dtd" [
<!ENTITY nbsp " ">
<!ENTITY nbsp " ">
<!ENTITY rsquo "’">
<!ENTITY rsquo "’">
]>
]>
<JOBCARD>
<JOBCARD>
<EOTK-HEADER></EOTK-HEADER>
<EOTK-HEADER></EOTK-HEADER>
<CEP>
<CEP>
<EFFECT
EFFRG=
"001999"
></EFFECT>
<EFFECT
EFFRG=
"001999"
></EFFECT>
<TITLEC>
发动机QEC拆卸(V2500-A5系列)
</TITLEC>
<TITLEC>
发动机QEC拆卸(V2500-A5系列)
</TITLEC>
<TITLE>
Remove the Engine's QEC(V2500-A5 series)
XXX
</TITLE>
<TITLE>
Remove the Engine's QEC(V2500-A5 series)
测试修改
</TITLE>
<TOPIC
CK-LEVEL=
"C"
>
<TOPIC
CK-LEVEL=
"C"
>
<TITLEC>
飞机/发动机基本信息
</TITLEC>
<TITLEC>
飞机/发动机基本信息
</TITLEC>
<TITLE>
AIRCRAFT/ENGINE INFORMATION
</TITLE>
<TITLE>
AIRCRAFT/ENGINE INFORMATION
</TITLE>
...
...
src/configs/render-elem.ts
View file @
50112533
import
{
h
,
VNode
}
from
'snabbdom'
import
{
h
,
VNode
}
from
'snabbdom'
import
{
IDomEditor
,
IModuleConf
,
SlateElement
}
from
'@wangeditor/editor'
import
{
IDomEditor
,
IModuleConf
,
SlateElement
}
from
'@wangeditor/editor'
import
{
nodeSet
}
from
'@/configs/node.config'
import
{
nodeSet
}
from
'@/configs/node.config'
import
{
handle
MouseEnter
,
handleMouseLeave
}
from
'@/views/editor/functions/compare'
import
{
handle
ClickDom
}
from
'@/views/editor/functions/compare'
const
renderElem
=
(
type
:
string
,
style
=
{
display
:
'block'
})
=>
{
const
renderElem
=
(
type
:
string
,
style
=
{
display
:
'block'
})
=>
{
return
(
elem
:
SlateElement
,
children
:
VNode
[]
|
null
,
editor
:
IDomEditor
):
VNode
=>
{
return
(
elem
:
SlateElement
,
children
:
VNode
[]
|
null
,
editor
:
IDomEditor
):
VNode
=>
{
...
@@ -16,12 +16,9 @@ const renderElem = (type: string, style = { display: 'block' }) => {
...
@@ -16,12 +16,9 @@ const renderElem = (type: string, style = { display: 'block' }) => {
style
,
style
,
attrs
:
{
'data-key'
:
dataKey
},
attrs
:
{
'data-key'
:
dataKey
},
on
:
{
on
:
{
mouseenter
(
event
:
Event
)
{
click
(
event
:
Event
)
{
handle
MouseEnter
(
event
)
handle
ClickDom
(
event
)
},
},
mouseleave
()
{
handleMouseLeave
()
}
}
}
},
},
children
children
...
...
src/views/editor/components/Compare.vue
View file @
50112533
...
@@ -7,7 +7,8 @@
...
@@ -7,7 +7,8 @@
preset=
"card"
preset=
"card"
:showFooter=
"false"
:showFooter=
"false"
>
>
<div
class=
"flex h-full"
ref=
"compareContainerRef"
>
<div
class=
"flex h-full relative"
ref=
"compareContainerRef"
>
<div
class=
"choose-row bg-progressRailColor"
ref=
"chooseRowRef"
></div>
<GlobalEditor
<GlobalEditor
ref=
"compareLeftRef"
ref=
"compareLeftRef"
v-model=
"compareLeftData"
v-model=
"compareLeftData"
...
@@ -27,7 +28,22 @@
...
@@ -27,7 +28,22 @@
</
template
>
</
template
>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
showCompare
,
compareLeftRef
,
compareRightRef
,
compareLeftData
,
compareRightData
,
compareContainerRef
}
from
'../constants/compare'
import
{
showCompare
,
compareLeftRef
,
compareRightRef
,
compareLeftData
,
compareRightData
,
compareContainerRef
,
chooseRowRef
}
from
'../constants/compare'
import
{
handleScrollTopLeft
,
handleScrollTopRight
}
from
'../functions/compare'
import
{
handleScrollTopLeft
,
handleScrollTopRight
}
from
'../functions/compare'
</
script
>
</
script
>
<
style
lang=
"less"
scoped
></
style
>
<
style
lang=
"less"
scoped
>
.choose-row
{
width
:
100%
;
position
:
absolute
;
z-index
:
99
;
opacity
:
0.6
;
}
</
style
>
src/views/editor/constants/compare.ts
View file @
50112533
...
@@ -4,3 +4,4 @@ export const compareRightRef = ref()
...
@@ -4,3 +4,4 @@ export const compareRightRef = ref()
export
const
compareLeftData
=
ref
(
''
)
export
const
compareLeftData
=
ref
(
''
)
export
const
compareRightData
=
ref
(
''
)
export
const
compareRightData
=
ref
(
''
)
export
const
compareContainerRef
=
ref
()
export
const
compareContainerRef
=
ref
()
export
const
chooseRowRef
=
ref
()
src/views/editor/functions/compare.ts
View file @
50112533
import
{
NewTreeModification
,
OldTreeModification
,
TreeRenderResult
}
from
'@/lib/XMLProcessor/src/typing'
import
{
NewTreeModification
,
OldTreeModification
,
TreeRenderResult
}
from
'@/lib/XMLProcessor/src/typing'
import
{
compareContainerRef
,
compareLeftRef
,
compareRightRef
,
showCompare
}
from
'../constants/compare'
import
{
c
hooseRowRef
,
c
ompareContainerRef
,
compareLeftRef
,
compareRightRef
,
showCompare
}
from
'../constants/compare'
import
{
debounce
}
from
'lodash'
import
{
uniqBy
}
from
'lodash'
export
const
handle
MouseEnter
=
debounce
(
(
event
:
any
)
=>
{
export
const
handle
ClickDom
=
(
event
:
any
)
=>
{
if
(
!
showCompare
.
value
)
return
if
(
!
showCompare
.
value
)
return
const
width
=
compareContainerRef
.
value
?.
clientWidth
const
element
=
event
.
target
const
x
=
event
.
clientX
const
container
=
compareContainerRef
.
value
const
y
=
event
.
clientY
const
elementRect
=
element
.
getBoundingClientRect
()
const
element1
=
document
.
elementFromPoint
(
x
,
y
)
const
containerRect
=
container
.
getBoundingClientRect
()
const
element2
=
document
.
elementFromPoint
(
width
-
x
,
y
)
const
distance
=
elementRect
.
top
-
containerRect
.
top
element1
?.
classList
.
add
(
'bg-progressRailColor'
)
chooseRowRef
.
value
.
style
.
top
=
distance
+
'px'
element2
?.
classList
.
add
(
'bg-progressRailColor'
)
chooseRowRef
.
value
.
style
.
height
=
event
.
target
.
offsetHeight
+
'px'
},
250
)
export
const
handleMouseLeave
=
()
=>
{
if
(
!
showCompare
.
value
)
return
const
elements
=
document
.
querySelectorAll
(
'.bg-progressRailColor'
)
elements
.
forEach
((
element
)
=>
{
element
.
classList
.
remove
(
'bg-progressRailColor'
)
})
}
}
export
const
handleScrollTopLeft
=
(
event
:
Event
)
=>
{
export
const
handleScrollTopLeft
=
(
event
:
Event
)
=>
{
const
scrollTop
=
(
event
.
target
as
HTMLInputElement
).
scrollTop
const
scrollTop
=
(
event
.
target
as
HTMLInputElement
).
scrollTop
compareRightRef
.
value
?.
handleScrollTop
(
scrollTop
)
compareRightRef
.
value
?.
handleScrollTop
(
scrollTop
)
chooseRowRef
.
value
.
style
.
height
=
'0px'
}
}
export
const
handleScrollTopRight
=
(
event
:
Event
)
=>
{
export
const
handleScrollTopRight
=
(
event
:
Event
)
=>
{
const
scrollTop
=
(
event
.
target
as
HTMLInputElement
).
scrollTop
const
scrollTop
=
(
event
.
target
as
HTMLInputElement
).
scrollTop
compareLeftRef
.
value
?.
handleScrollTop
(
scrollTop
)
compareLeftRef
.
value
?.
handleScrollTop
(
scrollTop
)
chooseRowRef
.
value
.
style
.
height
=
'0px'
}
}
export
const
handleLeftDifferent
=
(
dataForOld
:
OldTreeModification
,
treeNew
:
TreeRenderResult
[])
=>
{
export
const
handleLeftDifferent
=
(
dataForOld
:
OldTreeModification
,
treeNew
:
TreeRenderResult
[])
=>
{
nextTick
(()
=>
{
nextTick
(()
=>
{
const
containerLeft
=
compareLeftRef
.
value
?.
editorRef
.
getEditableContainer
()
const
containerLeft
=
compareLeftRef
.
value
?.
editorRef
.
getEditableContainer
()
const
containerRight
=
compareRightRef
.
value
?.
editorRef
.
getEditableContainer
()
const
containerRight
=
compareRightRef
.
value
?.
editorRef
.
getEditableContainer
()
//新增
//新增
dataForOld
.
Deleted
.
map
((
item
)
=>
{
uniqBy
(
dataForOld
.
Deleted
,
'key'
).
map
((
item
:
any
)
=>
{
const
node
=
containerLeft
!
.
querySelector
(
`[data-key="
${
item
.
key
}
"]`
)
const
node
=
containerLeft
!
.
querySelector
(
`[data-key="
${
item
.
key
}
"]`
)
if
(
node
.
childNodes
.
length
==
1
&&
node
.
childNodes
[
0
].
nodeName
==
'SPAN'
)
{
//处理左边
//处理左边
node
.
classList
.
add
(
'bg-errorColorSuppl'
)
node
.
classList
.
add
(
'bg-errorColorSuppl'
)
//处理右边
//处理右边
...
@@ -47,7 +41,6 @@ export const handleLeftDifferent = (dataForOld: OldTreeModification, treeNew: Tr
...
@@ -47,7 +41,6 @@ export const handleLeftDifferent = (dataForOld: OldTreeModification, treeNew: Tr
newDiv.style.height = `${node.offsetHeight}px`
newDiv.style.height = `${node.offsetHeight}px`
newDiv.classList.add('bg-dividerColor')
newDiv.classList.add('bg-dividerColor')
parentNode && parentNode.insertBefore(newDiv, parentNode.childNodes[index])
parentNode && parentNode.insertBefore(newDiv, parentNode.childNodes[index])
}
})
})
//修改
//修改
dataForOld.Changed.map((item) => {
dataForOld.Changed.map((item) => {
...
@@ -63,9 +56,8 @@ export const handleRightDifferent = (dataForNew: NewTreeModification, treeOld: T
...
@@ -63,9 +56,8 @@ export const handleRightDifferent = (dataForNew: NewTreeModification, treeOld: T
const containerLeft = compareLeftRef.value?.editorRef.getEditableContainer()
const containerLeft = compareLeftRef.value?.editorRef.getEditableContainer()
const containerRight = compareRightRef.value?.editorRef.getEditableContainer()
const containerRight = compareRightRef.value?.editorRef.getEditableContainer()
//新增
//新增
dataForNew.Added
.map((item: any) => {
uniqBy(dataForNew.Added, 'key')
.map((item: any) => {
const node = containerRight!.querySelector(`[data-key="
$
{
item
.
key
}
"]`)
const node = containerRight!.querySelector(`[data-key="
$
{
item
.
key
}
"]`)
if (node.childNodes.length == 1 && node.childNodes[0].nodeName == 'SPAN') {
//处理右边
//处理右边
node.classList.add('bg-errorColorSuppl')
node.classList.add('bg-errorColorSuppl')
//处理左边
//处理左边
...
@@ -78,7 +70,6 @@ export const handleRightDifferent = (dataForNew: NewTreeModification, treeOld: T
...
@@ -78,7 +70,6 @@ export const handleRightDifferent = (dataForNew: NewTreeModification, treeOld: T
newDiv.style.height = `${node.offsetHeight}px`
newDiv.style.height = `${node.offsetHeight}px`
newDiv.classList.add('bg-dividerColor')
newDiv.classList.add('bg-dividerColor')
parentNode && parentNode.insertBefore(newDiv, parentNode.childNodes[index])
parentNode && parentNode.insertBefore(newDiv, parentNode.childNodes[index])
}
})
})
//修改
//修改
dataForNew.Changed.map((item: any) => {
dataForNew.Changed.map((item: any) => {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment