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
a9bc5113
Commit
a9bc5113
authored
Apr 02, 2025
by
qlintonger xeno
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 修复额外内容+123
parent
3ed50b19
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
55 deletions
+48
-55
components.d.ts
+0
-3
src/assets/file/Trans-Convert.xml
+13
-12
src/lib/XMLProcessor/src/core/Processing.ts
+31
-38
src/lib/XMLProcessor/src/typing/index.d.ts
+4
-2
No files found.
components.d.ts
View file @
a9bc5113
...
...
@@ -12,7 +12,6 @@ declare module 'vue' {
NButton
:
typeof
import
(
'naive-ui'
)[
'NButton'
]
NCard
:
typeof
import
(
'naive-ui'
)[
'NCard'
]
NConfigProvider
:
typeof
import
(
'naive-ui'
)[
'NConfigProvider'
]
NDataTable
:
typeof
import
(
'naive-ui'
)[
'NDataTable'
]
NDropdown
:
typeof
import
(
'naive-ui'
)[
'NDropdown'
]
NInput
:
typeof
import
(
'naive-ui'
)[
'NInput'
]
NLayout
:
typeof
import
(
'naive-ui'
)[
'NLayout'
]
...
...
@@ -20,10 +19,8 @@ declare module 'vue' {
NLayoutFooter
:
typeof
import
(
'naive-ui'
)[
'NLayoutFooter'
]
NLayoutHeader
:
typeof
import
(
'naive-ui'
)[
'NLayoutHeader'
]
NMessageProvider
:
typeof
import
(
'naive-ui'
)[
'NMessageProvider'
]
NModal
:
typeof
import
(
'naive-ui'
)[
'NModal'
]
NModalProvider
:
typeof
import
(
'naive-ui'
)[
'NModalProvider'
]
NSpace
:
typeof
import
(
'naive-ui'
)[
'NSpace'
]
NSpin
:
typeof
import
(
'naive-ui'
)[
'NSpin'
]
NTree
:
typeof
import
(
'naive-ui'
)[
'NTree'
]
RouterLink
:
typeof
import
(
'vue-router'
)[
'RouterLink'
]
RouterView
:
typeof
import
(
'vue-router'
)[
'RouterView'
]
...
...
src/assets/file/Trans-Convert.xml
View file @
a9bc5113
...
...
@@ -2,29 +2,30 @@
<!--Arbortext, Inc., 1988-2013, v.4002-->
<!DOCTYPE JOBCARD PUBLIC "-//CEA-TEXT//DTD JOBCARD-VER1//EN" "JOBCARD.dtd" [
<!ENTITY nbsp " ">
<!ENTITY rsquo "’">
<!ENTITY rsquo "’">
]>
<JOBCARD>
<EOTK-HEADER></EOTK-HEADER>
<CEP>
<EFFECT
EFFRG=
"001999"
></EFFECT>
<TITLEC>
发动机QEC拆卸(V2500-A5系列)
</TITLEC>
<TITLE>
Remove the Engine's QEC(V2500-A5 series)
测试修改
</TITLE>
<TITLE>
Remove the Engine's QEC(V2500-A5 series)
修改示例
</TITLE>
<TOPIC
CK-LEVEL=
"C"
>
<TITLEC>
飞机/发动机基本信息
</TITLEC>
<TITLE>
AIRCRAFT/ENGINE INFORMATION
</TITLE>
<TITLE>
测试新增
</TITLE>
<TITLE>
AIRCRAFT/ENGINE INFORMATION
</TITLE>
<TITLE>
AIRCRAFT/ENGINE INFORMATION
</TITLE>
<STEP
CK-LEVEL=
"C"
>
<EFFECT
EFFRG=
"001999"
></EFFECT>
<RECORD-LINE
>
<PARAC>
发动机序号
</PARAC
>
<PARA>
Engine SN
</PARA
>
<RECORD></RECORD
>
</RECORD-LINE
>
<NOTE
>
<PARAC>
开始工作前请记录。
</PARAC
>
<PARA>
Please record before starting work.
</PARA
>
</NOTE
>
<!-- <RECORD-LINE>--
>
<!-- <PARAC>发动机序号</PARAC>--
>
<!-- <PARA>Engine SN</PARA>--
>
<!-- <RECORD></RECORD>--
>
<!-- </RECORD-LINE>--
>
<!-- <NOTE>--
>
<!-- <PARAC>开始工作前请记录。</PARAC>--
>
<!-- <PARA>Please record before starting work.</PARA>--
>
<!-- </NOTE>--
>
<SIGNOFF/>
</STEP>
</TOPIC>
...
...
src/lib/XMLProcessor/src/core/Processing.ts
View file @
a9bc5113
...
...
@@ -27,7 +27,8 @@ export class Processing {
label
:
item
.
label
,
hash
:
item
.
hash
,
index
:
item
.
index
,
chained
:
item
.
chained
chained
:
item
.
chained
,
textContent
:
item
.
textContent
})
if
(
item
.
children
)
{
resp
.
push
(...
this
.
flattenTree
(
item
.
children
))
...
...
@@ -68,44 +69,32 @@ export class Processing {
Changed
:
[],
Added
:
[]
}
// 获取
老节点中hash不存在
的节点
let
non
ExistedHashNodeForOld
:
TreeRenderResultFlatted
[]
=
resultAFlatted
.
filter
((
item
)
=>
{
return
!
resultBFlatted
.
find
(
(
itemB
)
=>
itemB
.
hash
===
item
.
hash
&&
itemB
.
chained
.
join
(
'$'
)
===
item
.
chained
.
join
(
'$'
)
)
// 获取
序列号、hash以及标签中任一不相同
的节点
let
non
SameInOld
=
resultAFlatted
.
filter
(
a
=>
{
return
!
resultBFlatted
.
find
(
v
=>
v
.
chained
.
join
(
'$'
)
===
a
.
chained
.
join
(
'$'
)
&&
v
.
hash
===
a
.
hash
&&
a
.
label
===
v
.
label
)
})
let
non
ExistedHashNodeForNew
:
TreeRenderResultFlatted
[]
=
resultBFlatted
.
filter
((
item
)
=>
{
return
!
resultAFlatted
.
find
(
(
itemA
)
=>
itemA
.
hash
===
item
.
hash
&&
itemA
.
chained
.
join
(
'$'
)
===
item
.
chained
.
join
(
'$'
)
)
let
non
SameInNew
=
resultBFlatted
.
filter
(
a
=>
{
return
!
resultAFlatted
.
find
(
v
=>
v
.
chained
.
join
(
'$'
)
===
a
.
chained
.
join
(
'$'
)
&&
v
.
hash
===
a
.
hash
&&
a
.
label
===
v
.
label
)
})
const
hashDiffInOld
:
TreeRenderResultFlatted
[]
=
nonExistedHashNodeForOld
.
filter
(
(
a
)
=>
!
nonExistedHashNodeForNew
.
find
((
v
)
=>
v
.
hash
===
a
.
hash
)
)
const
hashDiffInNew
:
TreeRenderResultFlatted
[]
=
nonExistedHashNodeForNew
.
filter
(
(
a
)
=>
!
nonExistedHashNodeForOld
.
find
((
v
)
=>
v
.
hash
===
a
.
hash
)
)
let
nodeUpdatedForOld
:
TreeRenderResultFlatted
[]
=
[]
let
nodeUpdatedForNew
:
TreeRenderResultFlatted
[]
=
[]
for
(
const
item
of
hashDiffInOld
)
{
const
sameIndexFound
=
hashDiffInNew
.
find
((
a
)
=>
a
.
chained
.
join
(
'$'
)
===
item
.
chained
.
join
(
'$'
))
if
(
sameIndexFound
)
{
nodeUpdatedForOld
.
push
(
item
)
nodeUpdatedForNew
.
push
(
sameIndexFound
)
}
}
let
newNodeInserted
:
TreeRenderResultFlatted
[]
=
[]
for
(
const
item
of
hashDiffInNew
)
{
if
(
!
nodeUpdatedForOld
.
find
(
a
=>
a
.
hash
===
item
.
hash
)
&&
!
nodeUpdatedForNew
.
find
(
a
=>
a
.
hash
===
item
.
hash
))
{
newNodeInserted
.
push
(
item
)
}
}
let
oldNodeDeleted
:
TreeRenderResultFlatted
[]
=
[]
for
(
const
item
of
hashDiffInOld
)
{
if
(
!
nodeUpdatedForNew
.
find
(
a
=>
a
.
hash
===
item
.
hash
)
&&
!
nodeUpdatedForOld
.
find
(
a
=>
a
.
hash
===
item
.
hash
))
{
oldNodeDeleted
.
push
(
item
)
}
// 如果标签和序列号相同,但是hash不同,则视为修改
let
nodeChangedInOld
=
nonSameInOld
.
filter
(
a
=>
{
return
nonSameInNew
.
find
(
v
=>
v
.
chained
.
join
(
'$'
)
===
a
.
chained
.
join
(
'$'
)
&&
a
.
label
===
v
.
label
)
})
let
nodeChangedInNew
=
nonSameInNew
.
filter
(
a
=>
{
return
nonSameInOld
.
find
(
v
=>
v
.
chained
.
join
(
'$'
)
===
a
.
chained
.
join
(
'$'
)
&&
a
.
label
===
v
.
label
)
})
// 再获取剩下来不同的节点
let
stillDiffInOld
=
nonSameInOld
.
filter
(
a
=>
{
return
!
nodeChangedInOld
.
find
(
v
=>
v
.
key
===
a
.
key
)
})
let
stillDiffInNew
=
nonSameInNew
.
filter
(
a
=>
{
return
!
nodeChangedInNew
.
find
(
v
=>
v
.
key
===
a
.
key
)
})
for
(
const
node
of
stillDiffInOld
)
{
let
samePosInCurrent
=
resultBFlatted
.
find
(
v
=>
v
.
chained
.
join
(
'$'
)
===
node
.
chained
.
join
(
'$'
))
console
.
log
(
'node-old-reflect'
,
samePosInCurrent
)
}
dataForOld
.
Changed
=
nodeUpdatedForOld
dataForOld
.
Deleted
=
oldNodeDeleted
dataForNew
.
Changed
=
nodeUpdatedForNew
dataForNew
.
Added
=
newNodeInserted
console
.
log
(
'non-same'
,
{
nonSameInNew
,
nonSameInOld
,
nodeChangedInOld
,
nodeChangedInNew
,
stillDiffInNew
,
stillDiffInOld
})
return
{
dataForNew
,
dataForOld
,
...
...
@@ -197,12 +186,14 @@ export class Processing {
children
:
[],
index
:
0
,
chained
:
[
0
],
hash
:
md5
.
hex
(
domNode
.
textContent
!
||
''
)
hash
:
md5
.
hex
(
domNode
.
textContent
!
||
''
),
textContent
:
domNode
.
textContent
||
''
}
// 为 DOM 节点设置 data-key 属性
domNode
.
setAttribute
(
'data-key'
,
targetKey
)
domNode
.
setAttribute
(
'data-w-e-type'
,
domNode
.
nodeName
)
domNode
.
setAttribute
(
'data-indent-level'
,
'0'
)
domNode
.
setAttribute
(
'data-chained'
,
treeItem
.
chained
.
join
(
'$'
))
// 递归处理子节点
treeItem
.
children
=
this
.
innerGroupHandle
(
domNode
.
children
,
handledNode
,
[
0
])
// 将树形数据项添加到结果数组中
...
...
@@ -238,12 +229,14 @@ export class Processing {
label
:
node
.
nodeName
,
index
:
realIndex
,
chained
:
[...
startChained
,
realIndex
],
hash
:
md5
.
hex
(
node
.
textContent
!
||
''
)
hash
:
md5
.
hex
(
node
.
textContent
!
||
''
),
textContent
:
node
.
textContent
||
''
}
// 为 DOM 节点设置 data-key 属性
node
.
setAttribute
(
'data-key'
,
targetKey
)
node
.
setAttribute
(
'data-w-e-type'
,
node
.
nodeName
)
node
.
setAttribute
(
'data-indent-level'
,
startChained
.
length
.
toString
())
node
.
setAttribute
(
'data-chained'
,
treeItem
.
chained
.
join
(
'$'
))
// 如果节点有子节点,递归处理子节点
if
(
node
.
children
.
length
>
0
)
{
treeItem
.
children
=
this
.
innerGroupHandle
(
node
.
children
,
handledNode
,
[...
startChained
,
realIndex
])
...
...
src/lib/XMLProcessor/src/typing/index.d.ts
View file @
a9bc5113
...
...
@@ -4,7 +4,8 @@ export type TreeRenderResult = {
children
?:
TreeRenderResult
[],
hash
:
string
,
index
:
number
,
chained
:
number
[]
chained
:
number
[],
textContent
:
string
}
export
type
TreeRenderResultFlatted
=
{
...
...
@@ -12,7 +13,8 @@ export type TreeRenderResultFlatted = {
label
:
string
,
hash
:
string
,
index
:
number
,
chained
:
number
[]
chained
:
number
[],
textContent
:
string
}
export
type
OldTreeModification
=
{
...
...
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