Commit a9bc5113 by qlintonger xeno

feat: 修复额外内容+123

parent 3ed50b19
......@@ -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']
......
......@@ -2,29 +2,30 @@
<!--Arbortext, Inc., 1988-2013, v.4002-->
<!DOCTYPE JOBCARD PUBLIC "-//CEA-TEXT//DTD JOBCARD-VER1//EN" "JOBCARD.dtd" [
<!ENTITY nbsp "&#160;">
<!ENTITY rsquo "&#8217;">
<!ENTITY rsquo "&#8217;">
]>
<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>
......
......@@ -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 nonExistedHashNodeForOld: TreeRenderResultFlatted[] = resultAFlatted.filter((item) => {
return !resultBFlatted.find((itemB) => itemB.hash === item.hash && itemB.chained.join('$') === item.chained.join('$'))
// 获取序列号、hash以及标签中任一不相同的节点
let nonSameInOld = resultAFlatted.filter(a=> {
return !resultBFlatted.find(v=>v.chained.join('$') === a.chained.join('$') && v.hash === a.hash && a.label === v.label)
})
let nonExistedHashNodeForNew: TreeRenderResultFlatted[] = resultBFlatted.filter((item) => {
return !resultAFlatted.find((itemA) => itemA.hash === item.hash && itemA.chained.join('$') === item.chained.join('$'))
let nonSameInNew = 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])
......
......@@ -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 = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment