Commit a9bc5113 by qlintonger xeno

feat: 修复额外内容+123

parent 3ed50b19
...@@ -12,7 +12,6 @@ declare module 'vue' { ...@@ -12,7 +12,6 @@ declare module 'vue' {
NButton: typeof import('naive-ui')['NButton'] NButton: typeof import('naive-ui')['NButton']
NCard: typeof import('naive-ui')['NCard'] NCard: typeof import('naive-ui')['NCard']
NConfigProvider: typeof import('naive-ui')['NConfigProvider'] NConfigProvider: typeof import('naive-ui')['NConfigProvider']
NDataTable: typeof import('naive-ui')['NDataTable']
NDropdown: typeof import('naive-ui')['NDropdown'] NDropdown: typeof import('naive-ui')['NDropdown']
NInput: typeof import('naive-ui')['NInput'] NInput: typeof import('naive-ui')['NInput']
NLayout: typeof import('naive-ui')['NLayout'] NLayout: typeof import('naive-ui')['NLayout']
...@@ -20,10 +19,8 @@ declare module 'vue' { ...@@ -20,10 +19,8 @@ declare module 'vue' {
NLayoutFooter: typeof import('naive-ui')['NLayoutFooter'] NLayoutFooter: typeof import('naive-ui')['NLayoutFooter']
NLayoutHeader: typeof import('naive-ui')['NLayoutHeader'] NLayoutHeader: typeof import('naive-ui')['NLayoutHeader']
NMessageProvider: typeof import('naive-ui')['NMessageProvider'] NMessageProvider: typeof import('naive-ui')['NMessageProvider']
NModal: typeof import('naive-ui')['NModal']
NModalProvider: typeof import('naive-ui')['NModalProvider'] NModalProvider: typeof import('naive-ui')['NModalProvider']
NSpace: typeof import('naive-ui')['NSpace'] NSpace: typeof import('naive-ui')['NSpace']
NSpin: typeof import('naive-ui')['NSpin']
NTree: typeof import('naive-ui')['NTree'] NTree: typeof import('naive-ui')['NTree']
RouterLink: typeof import('vue-router')['RouterLink'] RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView'] RouterView: typeof import('vue-router')['RouterView']
......
...@@ -2,29 +2,30 @@ ...@@ -2,29 +2,30 @@
<!--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 "&#160;"> <!ENTITY nbsp "&#160;">
<!ENTITY rsquo "&#8217;"> <!ENTITY rsquo "&#8217;">
]> ]>
<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) 测试修改</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>
<TITLE>测试新增</TITLE> <TITLE>AIRCRAFT/ENGINE INFORMATION</TITLE>
<TITLE>AIRCRAFT/ENGINE INFORMATION</TITLE>
<STEP CK-LEVEL="C"> <STEP CK-LEVEL="C">
<EFFECT EFFRG="001999"></EFFECT> <EFFECT EFFRG="001999"></EFFECT>
<RECORD-LINE> <!-- <RECORD-LINE>-->
<PARAC>发动机序号</PARAC> <!-- <PARAC>发动机序号</PARAC>-->
<PARA>Engine SN</PARA> <!-- <PARA>Engine SN</PARA>-->
<RECORD></RECORD> <!-- <RECORD></RECORD>-->
</RECORD-LINE> <!-- </RECORD-LINE>-->
<NOTE> <!-- <NOTE>-->
<PARAC>开始工作前请记录。</PARAC> <!-- <PARAC>开始工作前请记录。</PARAC>-->
<PARA>Please record before starting work.</PARA> <!-- <PARA>Please record before starting work.</PARA>-->
</NOTE> <!-- </NOTE>-->
<SIGNOFF/> <SIGNOFF/>
</STEP> </STEP>
</TOPIC> </TOPIC>
......
...@@ -27,7 +27,8 @@ export class Processing { ...@@ -27,7 +27,8 @@ export class Processing {
label: item.label, label: item.label,
hash: item.hash, hash: item.hash,
index: item.index, index: item.index,
chained: item.chained chained: item.chained,
textContent: item.textContent
}) })
if (item.children) { if (item.children) {
resp.push(...this.flattenTree(item.children)) resp.push(...this.flattenTree(item.children))
...@@ -68,44 +69,32 @@ export class Processing { ...@@ -68,44 +69,32 @@ export class Processing {
Changed: [], Changed: [],
Added: [] Added: []
} }
// 获取老节点中hash不存在的节点 // 获取序列号、hash以及标签中任一不相同的节点
let nonExistedHashNodeForOld: TreeRenderResultFlatted[] = resultAFlatted.filter((item) => { let nonSameInOld = resultAFlatted.filter(a=> {
return !resultBFlatted.find((itemB) => itemB.hash === item.hash && itemB.chained.join('$') === item.chained.join('$')) return !resultBFlatted.find(v=>v.chained.join('$') === a.chained.join('$') && v.hash === a.hash && a.label === v.label)
}) })
let nonExistedHashNodeForNew: TreeRenderResultFlatted[] = resultBFlatted.filter((item) => { let nonSameInNew = resultBFlatted.filter(a=> {
return !resultAFlatted.find((itemA) => itemA.hash === item.hash && itemA.chained.join('$') === item.chained.join('$')) return !resultAFlatted.find(v=>v.chained.join('$') === a.chained.join('$') && v.hash === a.hash && a.label === v.label)
}) })
const hashDiffInOld: TreeRenderResultFlatted[] = nonExistedHashNodeForOld.filter( // 如果标签和序列号相同,但是hash不同,则视为修改
(a) => !nonExistedHashNodeForNew.find((v) => v.hash === a.hash) let nodeChangedInOld = nonSameInOld.filter(a=> {
) return nonSameInNew.find(v=>v.chained.join('$') === a.chained.join('$') && a.label === v.label)
const hashDiffInNew: TreeRenderResultFlatted[] = nonExistedHashNodeForNew.filter( })
(a) => !nonExistedHashNodeForOld.find((v) => v.hash === a.hash) let nodeChangedInNew = nonSameInNew.filter(a=> {
) return nonSameInOld.find(v=>v.chained.join('$') === a.chained.join('$') && a.label === v.label)
let nodeUpdatedForOld: TreeRenderResultFlatted[] = [] })
let nodeUpdatedForNew: TreeRenderResultFlatted[] = [] // 再获取剩下来不同的节点
for (const item of hashDiffInOld) { let stillDiffInOld = nonSameInOld.filter(a=> {
const sameIndexFound = hashDiffInNew.find((a) => a.chained.join('$') === item.chained.join('$')) return !nodeChangedInOld.find(v=>v.key === a.key)
if (sameIndexFound) { })
nodeUpdatedForOld.push(item) let stillDiffInNew = nonSameInNew.filter(a=> {
nodeUpdatedForNew.push(sameIndexFound) return !nodeChangedInNew.find(v=>v.key === a.key)
} })
} for (const node of stillDiffInOld) {
let newNodeInserted: TreeRenderResultFlatted[] = [] let samePosInCurrent = resultBFlatted.find(v=>v.chained.join('$') === node.chained.join('$'))
for (const item of hashDiffInNew) { console.log('node-old-reflect', samePosInCurrent)
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)
}
} }
dataForOld.Changed = nodeUpdatedForOld console.log('non-same', {nonSameInNew, nonSameInOld, nodeChangedInOld, nodeChangedInNew, stillDiffInNew, stillDiffInOld})
dataForOld.Deleted = oldNodeDeleted
dataForNew.Changed = nodeUpdatedForNew
dataForNew.Added = newNodeInserted
return { return {
dataForNew, dataForNew,
dataForOld, dataForOld,
...@@ -197,12 +186,14 @@ export class Processing { ...@@ -197,12 +186,14 @@ export class Processing {
children: [], children: [],
index: 0, index: 0,
chained: [0], chained: [0],
hash: md5.hex(domNode.textContent! || '') hash: md5.hex(domNode.textContent! || ''),
textContent: domNode.textContent || ''
} }
// 为 DOM 节点设置 data-key 属性 // 为 DOM 节点设置 data-key 属性
domNode.setAttribute('data-key', targetKey) domNode.setAttribute('data-key', targetKey)
domNode.setAttribute('data-w-e-type', domNode.nodeName) domNode.setAttribute('data-w-e-type', domNode.nodeName)
domNode.setAttribute('data-indent-level', '0') domNode.setAttribute('data-indent-level', '0')
domNode.setAttribute('data-chained', treeItem.chained.join('$'))
// 递归处理子节点 // 递归处理子节点
treeItem.children = this.innerGroupHandle(domNode.children, handledNode, [0]) treeItem.children = this.innerGroupHandle(domNode.children, handledNode, [0])
// 将树形数据项添加到结果数组中 // 将树形数据项添加到结果数组中
...@@ -238,12 +229,14 @@ export class Processing { ...@@ -238,12 +229,14 @@ export class Processing {
label: node.nodeName, label: node.nodeName,
index: realIndex, index: realIndex,
chained: [...startChained, realIndex], chained: [...startChained, realIndex],
hash: md5.hex(node.textContent! || '') hash: md5.hex(node.textContent! || ''),
textContent: node.textContent || ''
} }
// 为 DOM 节点设置 data-key 属性 // 为 DOM 节点设置 data-key 属性
node.setAttribute('data-key', targetKey) node.setAttribute('data-key', targetKey)
node.setAttribute('data-w-e-type', node.nodeName) node.setAttribute('data-w-e-type', node.nodeName)
node.setAttribute('data-indent-level', startChained.length.toString()) node.setAttribute('data-indent-level', startChained.length.toString())
node.setAttribute('data-chained', treeItem.chained.join('$'))
// 如果节点有子节点,递归处理子节点 // 如果节点有子节点,递归处理子节点
if (node.children.length > 0) { if (node.children.length > 0) {
treeItem.children = this.innerGroupHandle(node.children, handledNode, [...startChained, realIndex]) treeItem.children = this.innerGroupHandle(node.children, handledNode, [...startChained, realIndex])
......
...@@ -4,7 +4,8 @@ export type TreeRenderResult = { ...@@ -4,7 +4,8 @@ export type TreeRenderResult = {
children?: TreeRenderResult[], children?: TreeRenderResult[],
hash: string, hash: string,
index: number, index: number,
chained: number[] chained: number[],
textContent: string
} }
export type TreeRenderResultFlatted = { export type TreeRenderResultFlatted = {
...@@ -12,7 +13,8 @@ export type TreeRenderResultFlatted = { ...@@ -12,7 +13,8 @@ export type TreeRenderResultFlatted = {
label: string, label: string,
hash: string, hash: string,
index: number, index: number,
chained: number[] chained: number[],
textContent: string
} }
export type OldTreeModification = { 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