cloud-web-corejs 1.0.54-dev.657 → 1.0.54-dev.658
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/code-editor/index.vue +31 -2
- package/src/views/bd/setting/formVersion/compareBasicSection.vue +70 -0
- package/src/views/bd/setting/formVersion/compareCodeSection.vue +505 -0
- package/src/views/bd/setting/formVersion/compareContent.vue +63 -0
- package/src/views/bd/setting/formVersion/compareDialog.vue +135 -219
- package/src/views/bd/setting/formVersion/compareMixin.js +93 -0
- package/src/views/bd/setting/formVersion/formScriptCompareView.vue +94 -0
- package/src/views/bd/setting/formVersion/formTemplateCompareView.vue +74 -0
- package/src/views/bd/setting/formVersion/tableDetailDiff.js +78 -0
- package/src/views/bd/setting/formVersion/tableModelCompareView.vue +426 -0
- package/src/views/bd/setting/formVersion/textDiff.js +102 -0
- package/src/views/bd/setting/form_script/edit1.vue +4 -4
- package/src/views/bd/setting/form_script/mixins/dialog.js +2 -2
- package/src/views/bd/setting/form_script/mixins/edit.js +1 -1
- package/src/views/bd/setting/form_script/mixins/edit1.js +1 -1
- package/src/views/bd/setting/form_script/mixins/form_list.js +3 -3
- package/src/views/bd/setting/form_script/mixins/list.js +3 -3
- package/src/views/bd/setting/form_script/mixins/list1.js +4 -4
- package/src/views/bd/setting/form_script/mixins/otherAuthDialog.js +1 -1
- package/src/views/bd/setting/form_template/batchWfObjConfigDialog.vue +1 -1
- package/src/views/bd/setting/form_template/formDesignerDialog.vue +1 -1
- package/src/views/bd/setting/form_template/mixins/batchWfObjConfigDialog.js +3 -3
- package/src/views/bd/setting/form_template/mixins/edit.js +1 -1
- package/src/views/bd/setting/form_template/mixins/itemList.js +1 -1
- package/src/views/bd/setting/form_template/mixins/list.js +4 -4
- package/src/views/bd/setting/form_template/mixins/list2.js +3 -3
- package/src/views/bd/setting/form_template/mixins/otherAuthDialog.js +1 -1
- package/src/views/bd/setting/form_template/mixins/wf_list.js +3 -3
- package/src/views/bd/setting/request_setting/list.vue +15 -25
- package/src/views/bd/setting/table_model/edit.vue +1 -1
- package/src/views/bd/setting/table_model/mixins/dialog.js +1 -1
- package/src/views/bd/setting/table_model/mixins/list.js +6 -6
- package/src/views/bd/setting/table_model/mixins/otherAuthDialog.js +1 -1
- package/src/views/user/form/view/list.vue +29 -12
package/package.json
CHANGED
|
@@ -165,7 +165,34 @@ export default {
|
|
|
165
165
|
codeValue: this.value || "",
|
|
166
166
|
};
|
|
167
167
|
},
|
|
168
|
-
watch: {
|
|
168
|
+
watch: {
|
|
169
|
+
value(val) {
|
|
170
|
+
if (!this.aceEditor) return;
|
|
171
|
+
const newVal = val || "";
|
|
172
|
+
if (this.aceEditor.getValue() !== newVal) {
|
|
173
|
+
this.aceEditor.setValue(newVal, -1);
|
|
174
|
+
this.aceEditor.clearSelection();
|
|
175
|
+
this.aceEditor.resize();
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
mode() {
|
|
179
|
+
if (!this.aceEditor) return;
|
|
180
|
+
if (this.mode === "json") {
|
|
181
|
+
this.setJsonMode();
|
|
182
|
+
} else if (this.mode === "css") {
|
|
183
|
+
this.setCssMode();
|
|
184
|
+
} else {
|
|
185
|
+
this.aceEditor.getSession().setMode(this.modePath);
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
height() {
|
|
189
|
+
this.$nextTick(() => {
|
|
190
|
+
if (this.aceEditor) {
|
|
191
|
+
this.aceEditor.resize();
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
},
|
|
195
|
+
},
|
|
169
196
|
methods: {
|
|
170
197
|
addAutoCompletion(ace) {
|
|
171
198
|
let acData = this.acData;
|
|
@@ -193,7 +220,9 @@ export default {
|
|
|
193
220
|
return this.aceEditor.getSession().getAnnotations();
|
|
194
221
|
},
|
|
195
222
|
setValue(val) {
|
|
196
|
-
this.aceEditor
|
|
223
|
+
if (!this.aceEditor) return;
|
|
224
|
+
this.aceEditor.setValue(val || "", -1);
|
|
225
|
+
this.aceEditor.clearSelection();
|
|
197
226
|
},
|
|
198
227
|
btnMouseDown(event) {
|
|
199
228
|
let rootDom = document.body.querySelector("#app");
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="compare-cont">
|
|
3
|
+
<div class="title"><b>{{ $t1(sectionTitle) }}</b></div>
|
|
4
|
+
<table class="table-border_1">
|
|
5
|
+
<tbody>
|
|
6
|
+
<tr>
|
|
7
|
+
<th>{{ $t1(headerLabel) }}</th>
|
|
8
|
+
<td>
|
|
9
|
+
<span class="version-blue">{{ $t1("版本号") }}:{{ preVersion }}</span>
|
|
10
|
+
<div class="compare-revert-btn">
|
|
11
|
+
<reverButton
|
|
12
|
+
:objType="objType"
|
|
13
|
+
:objCode="objCode"
|
|
14
|
+
:hData="compareHData1"
|
|
15
|
+
@reverCallback="$emit('reverCallback')"
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
</td>
|
|
19
|
+
<td>
|
|
20
|
+
<span class="version-green">{{ $t1("版本号") }}:{{ curVersion }}</span>
|
|
21
|
+
<div class="compare-revert-btn">
|
|
22
|
+
<reverButton
|
|
23
|
+
:objType="objType"
|
|
24
|
+
:objCode="objCode"
|
|
25
|
+
:hData="compareHData2"
|
|
26
|
+
@reverCallback="$emit('reverCallback')"
|
|
27
|
+
/>
|
|
28
|
+
</div>
|
|
29
|
+
</td>
|
|
30
|
+
</tr>
|
|
31
|
+
<tr
|
|
32
|
+
v-for="field in fields"
|
|
33
|
+
:key="field.key"
|
|
34
|
+
:class="fieldDiffClass(field)"
|
|
35
|
+
>
|
|
36
|
+
<th>{{ $t1(field.label) }}</th>
|
|
37
|
+
<td>{{ getFieldVal(compareHData1, field) }}</td>
|
|
38
|
+
<td>{{ getFieldVal(compareHData2, field) }}</td>
|
|
39
|
+
</tr>
|
|
40
|
+
</tbody>
|
|
41
|
+
</table>
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<script>
|
|
46
|
+
import compareMixin from "./compareMixin";
|
|
47
|
+
import reverButton from "./reverButton.vue";
|
|
48
|
+
|
|
49
|
+
export default {
|
|
50
|
+
name: "compareBasicSection",
|
|
51
|
+
mixins: [compareMixin],
|
|
52
|
+
components: {
|
|
53
|
+
reverButton,
|
|
54
|
+
},
|
|
55
|
+
props: {
|
|
56
|
+
sectionTitle: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: "基础信息",
|
|
59
|
+
},
|
|
60
|
+
headerLabel: {
|
|
61
|
+
type: String,
|
|
62
|
+
required: true,
|
|
63
|
+
},
|
|
64
|
+
fields: {
|
|
65
|
+
type: Array,
|
|
66
|
+
default: () => [],
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
</script>
|
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="compare-cont compare-code-section"
|
|
4
|
+
:class="{ 'is-section-fullscreen': fullscreen, 'is-diff-mode': enableDiff }"
|
|
5
|
+
>
|
|
6
|
+
<div class="compare-code-header">
|
|
7
|
+
<div class="compare-header-main">
|
|
8
|
+
<div class="title"><b>{{ $t1(sectionTitle) }}</b></div>
|
|
9
|
+
<div v-if="enableDiff" class="compare-diff-legend">
|
|
10
|
+
<span class="legend-item legend-old">{{ $t1("变更/删除") }}</span>
|
|
11
|
+
<span class="legend-item legend-new">{{ $t1("变更/新增") }}</span>
|
|
12
|
+
<span class="compare-diff-nav">
|
|
13
|
+
<span
|
|
14
|
+
class="diff-nav-btn"
|
|
15
|
+
:class="{ 'is-disabled': !diffNavList.length }"
|
|
16
|
+
@click="diffNavList.length && gotoPrevDiff()"
|
|
17
|
+
>
|
|
18
|
+
<i class="el-icon-top"></i>{{ $t1("上一处差异") }}
|
|
19
|
+
</span>
|
|
20
|
+
<span
|
|
21
|
+
class="diff-nav-btn"
|
|
22
|
+
:class="{ 'is-disabled': !diffNavList.length }"
|
|
23
|
+
@click="diffNavList.length && gotoNextDiff()"
|
|
24
|
+
>
|
|
25
|
+
<i class="el-icon-bottom"></i>{{ $t1("下一处差异") }}
|
|
26
|
+
</span>
|
|
27
|
+
<span class="diff-nav-btn" @click="gotoTop">
|
|
28
|
+
<i class="el-icon-caret-top"></i>{{ $t1("返回顶部") }}
|
|
29
|
+
</span>
|
|
30
|
+
<span v-if="diffNavList.length" class="diff-nav-count">
|
|
31
|
+
{{ currentDiffIndex < 0 ? "-" : currentDiffIndex + 1 }} / {{ diffNavList.length }}
|
|
32
|
+
</span>
|
|
33
|
+
</span>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
<el-tooltip class="item" effect="dark" :content="$t1('全屏')" placement="top">
|
|
37
|
+
<el-link class="is-full" :underline="false" @click="toggleFullscreen">
|
|
38
|
+
<i class="iconfont icon-quanping"></i>
|
|
39
|
+
</el-link>
|
|
40
|
+
</el-tooltip>
|
|
41
|
+
</div>
|
|
42
|
+
<div class="flex compare-code-flex">
|
|
43
|
+
<div class="flex-1 compare-code-col">
|
|
44
|
+
<span class="version-blue">{{ $t1("版本号") }}:{{ preVersion }}</span>
|
|
45
|
+
<div class="compare-code-editor-wrap">
|
|
46
|
+
<code-editor
|
|
47
|
+
ref="leftEditor"
|
|
48
|
+
:mode="mode"
|
|
49
|
+
:readonly="true"
|
|
50
|
+
:value="leftCode"
|
|
51
|
+
:resize="false"
|
|
52
|
+
:height="editorHeight"
|
|
53
|
+
/>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
<div class="flex-1 compare-code-col">
|
|
57
|
+
<span class="version-green">{{ $t1("版本号") }}:{{ curVersion }}</span>
|
|
58
|
+
<div class="compare-code-editor-wrap">
|
|
59
|
+
<code-editor
|
|
60
|
+
ref="rightEditor"
|
|
61
|
+
:mode="mode"
|
|
62
|
+
:readonly="true"
|
|
63
|
+
:value="rightCode"
|
|
64
|
+
:resize="false"
|
|
65
|
+
:height="editorHeight"
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</template>
|
|
72
|
+
|
|
73
|
+
<script>
|
|
74
|
+
import ace from "ace-builds";
|
|
75
|
+
import { diffLines } from "./textDiff";
|
|
76
|
+
|
|
77
|
+
export default {
|
|
78
|
+
name: "compareCodeSection",
|
|
79
|
+
props: {
|
|
80
|
+
sectionTitle: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: "脚本",
|
|
83
|
+
},
|
|
84
|
+
preVersion: [String, Number],
|
|
85
|
+
curVersion: [String, Number],
|
|
86
|
+
leftCode: {
|
|
87
|
+
type: String,
|
|
88
|
+
default: "",
|
|
89
|
+
},
|
|
90
|
+
rightCode: {
|
|
91
|
+
type: String,
|
|
92
|
+
default: "",
|
|
93
|
+
},
|
|
94
|
+
mode: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: "java",
|
|
97
|
+
},
|
|
98
|
+
enableDiff: {
|
|
99
|
+
type: Boolean,
|
|
100
|
+
default: false,
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
data() {
|
|
104
|
+
return {
|
|
105
|
+
fullscreen: false,
|
|
106
|
+
diffNavList: [],
|
|
107
|
+
currentDiffIndex: -1,
|
|
108
|
+
diffMarkerIds: {
|
|
109
|
+
left: [],
|
|
110
|
+
right: [],
|
|
111
|
+
},
|
|
112
|
+
activeMarkerIds: {
|
|
113
|
+
left: null,
|
|
114
|
+
right: null,
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
computed: {
|
|
119
|
+
editorHeight() {
|
|
120
|
+
return this.fullscreen ? "100%" : "450px";
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
watch: {
|
|
124
|
+
leftCode() {
|
|
125
|
+
this.syncAndApplyDiff();
|
|
126
|
+
},
|
|
127
|
+
rightCode() {
|
|
128
|
+
this.syncAndApplyDiff();
|
|
129
|
+
},
|
|
130
|
+
editorHeight() {
|
|
131
|
+
this.resizeEditors();
|
|
132
|
+
if (this.enableDiff) {
|
|
133
|
+
this.syncAndApplyDiff();
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
enableDiff(val) {
|
|
137
|
+
if (val) {
|
|
138
|
+
this.syncAndApplyDiff();
|
|
139
|
+
} else {
|
|
140
|
+
this.clearDiffMarkers();
|
|
141
|
+
this.diffNavList = [];
|
|
142
|
+
this.currentDiffIndex = -1;
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
mounted() {
|
|
147
|
+
this.syncAndApplyDiff();
|
|
148
|
+
},
|
|
149
|
+
beforeDestroy() {
|
|
150
|
+
this.clearDiffMarkers();
|
|
151
|
+
},
|
|
152
|
+
methods: {
|
|
153
|
+
syncEditorContent() {
|
|
154
|
+
[
|
|
155
|
+
{ ref: "leftEditor", code: this.leftCode },
|
|
156
|
+
{ ref: "rightEditor", code: this.rightCode },
|
|
157
|
+
].forEach(({ ref, code }) => {
|
|
158
|
+
const editorComp = this.$refs[ref];
|
|
159
|
+
const aceEditor = editorComp?.aceEditor;
|
|
160
|
+
if (!aceEditor) return;
|
|
161
|
+
const newVal = code || "";
|
|
162
|
+
if (aceEditor.getValue() !== newVal) {
|
|
163
|
+
aceEditor.setValue(newVal, -1);
|
|
164
|
+
aceEditor.clearSelection();
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
},
|
|
168
|
+
syncAndApplyDiff() {
|
|
169
|
+
this.$nextTick(() => {
|
|
170
|
+
this.syncEditorContent();
|
|
171
|
+
if (!this.enableDiff) return;
|
|
172
|
+
this.$nextTick(() => {
|
|
173
|
+
this.applyDiffHighlightWithRetry();
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
},
|
|
177
|
+
applyDiffHighlightWithRetry(retry = 0) {
|
|
178
|
+
if (!this.enableDiff) return;
|
|
179
|
+
const leftReady = !!this.$refs.leftEditor?.aceEditor;
|
|
180
|
+
const rightReady = !!this.$refs.rightEditor?.aceEditor;
|
|
181
|
+
if ((!leftReady || !rightReady) && retry < 20) {
|
|
182
|
+
setTimeout(() => this.applyDiffHighlightWithRetry(retry + 1), 50);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
this.syncEditorContent();
|
|
186
|
+
this.applyDiffHighlight();
|
|
187
|
+
},
|
|
188
|
+
toggleFullscreen() {
|
|
189
|
+
this.fullscreen = !this.fullscreen;
|
|
190
|
+
this.$nextTick(() => {
|
|
191
|
+
this.resizeEditors();
|
|
192
|
+
this.syncAndApplyDiff();
|
|
193
|
+
});
|
|
194
|
+
},
|
|
195
|
+
resizeEditors() {
|
|
196
|
+
this.$nextTick(() => {
|
|
197
|
+
["leftEditor", "rightEditor"].forEach((refName) => {
|
|
198
|
+
const editor = this.$refs[refName];
|
|
199
|
+
if (editor && editor.aceEditor) {
|
|
200
|
+
editor.aceEditor.resize();
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
},
|
|
205
|
+
clearDiffMarkers() {
|
|
206
|
+
this.clearActiveMarkers();
|
|
207
|
+
["leftEditor", "rightEditor"].forEach((refName, index) => {
|
|
208
|
+
const side = index === 0 ? "left" : "right";
|
|
209
|
+
const editor = this.$refs[refName]?.aceEditor;
|
|
210
|
+
if (!editor) return;
|
|
211
|
+
this.diffMarkerIds[side].forEach((id) => {
|
|
212
|
+
editor.session.removeMarker(id);
|
|
213
|
+
});
|
|
214
|
+
this.diffMarkerIds[side] = [];
|
|
215
|
+
});
|
|
216
|
+
},
|
|
217
|
+
clearActiveMarkers() {
|
|
218
|
+
["leftEditor", "rightEditor"].forEach((refName, index) => {
|
|
219
|
+
const side = index === 0 ? "left" : "right";
|
|
220
|
+
const editor = this.$refs[refName]?.aceEditor;
|
|
221
|
+
const markerId = this.activeMarkerIds[side];
|
|
222
|
+
if (editor && markerId != null) {
|
|
223
|
+
editor.session.removeMarker(markerId);
|
|
224
|
+
}
|
|
225
|
+
this.activeMarkerIds[side] = null;
|
|
226
|
+
});
|
|
227
|
+
},
|
|
228
|
+
applyDiffHighlight() {
|
|
229
|
+
if (!this.enableDiff) return;
|
|
230
|
+
|
|
231
|
+
const leftEditor = this.$refs.leftEditor?.aceEditor;
|
|
232
|
+
const rightEditor = this.$refs.rightEditor?.aceEditor;
|
|
233
|
+
if (!leftEditor || !rightEditor) return;
|
|
234
|
+
|
|
235
|
+
this.syncEditorContent();
|
|
236
|
+
this.clearDiffMarkers();
|
|
237
|
+
|
|
238
|
+
const leftText = leftEditor.getValue();
|
|
239
|
+
const rightText = rightEditor.getValue();
|
|
240
|
+
const { oldMarks, newMarks, diffNavList } = diffLines(leftText, rightText);
|
|
241
|
+
this.diffNavList = diffNavList || [];
|
|
242
|
+
this.currentDiffIndex = -1;
|
|
243
|
+
const Range = ace.require("ace/range").Range;
|
|
244
|
+
|
|
245
|
+
this.diffMarkerIds.left = oldMarks.map((row) =>
|
|
246
|
+
leftEditor.session.addMarker(
|
|
247
|
+
new Range(row, 0, row, Number.MAX_VALUE),
|
|
248
|
+
"compare-diff-old",
|
|
249
|
+
"fullLine",
|
|
250
|
+
false
|
|
251
|
+
)
|
|
252
|
+
);
|
|
253
|
+
this.diffMarkerIds.right = newMarks.map((row) =>
|
|
254
|
+
rightEditor.session.addMarker(
|
|
255
|
+
new Range(row, 0, row, Number.MAX_VALUE),
|
|
256
|
+
"compare-diff-new",
|
|
257
|
+
"fullLine",
|
|
258
|
+
false
|
|
259
|
+
)
|
|
260
|
+
);
|
|
261
|
+
},
|
|
262
|
+
gotoPrevDiff() {
|
|
263
|
+
if (!this.diffNavList.length) return;
|
|
264
|
+
this.currentDiffIndex =
|
|
265
|
+
(this.currentDiffIndex - 1 + this.diffNavList.length) % this.diffNavList.length;
|
|
266
|
+
this.locateCurrentDiff();
|
|
267
|
+
},
|
|
268
|
+
gotoNextDiff() {
|
|
269
|
+
if (!this.diffNavList.length) return;
|
|
270
|
+
this.currentDiffIndex = (this.currentDiffIndex + 1) % this.diffNavList.length;
|
|
271
|
+
this.locateCurrentDiff();
|
|
272
|
+
},
|
|
273
|
+
gotoTop() {
|
|
274
|
+
const leftEditor = this.$refs.leftEditor?.aceEditor;
|
|
275
|
+
const rightEditor = this.$refs.rightEditor?.aceEditor;
|
|
276
|
+
if (!leftEditor || !rightEditor) return;
|
|
277
|
+
|
|
278
|
+
this.clearActiveMarkers();
|
|
279
|
+
this.currentDiffIndex = -1;
|
|
280
|
+
this.scrollEditorToLine(leftEditor, 0);
|
|
281
|
+
this.scrollEditorToLine(rightEditor, 0);
|
|
282
|
+
},
|
|
283
|
+
resolveDiffScrollRows(diffItem) {
|
|
284
|
+
const leftRow =
|
|
285
|
+
diffItem.left != null ? diffItem.left : diffItem.anchorLeft ?? 0;
|
|
286
|
+
const rightRow =
|
|
287
|
+
diffItem.right != null ? diffItem.right : diffItem.anchorRight ?? 0;
|
|
288
|
+
return { leftRow, rightRow };
|
|
289
|
+
},
|
|
290
|
+
addActiveHunkMarker(editor, side, diffItem) {
|
|
291
|
+
const Range = ace.require("ace/range").Range;
|
|
292
|
+
const isLeft = side === "left";
|
|
293
|
+
const start = isLeft ? diffItem.left : diffItem.right;
|
|
294
|
+
const end = isLeft ? diffItem.leftEnd : diffItem.rightEnd;
|
|
295
|
+
|
|
296
|
+
if (start == null) return null;
|
|
297
|
+
|
|
298
|
+
const endRow = end != null ? end : start;
|
|
299
|
+
return editor.session.addMarker(
|
|
300
|
+
new Range(start, 0, endRow, Number.MAX_VALUE),
|
|
301
|
+
isLeft ? "compare-diff-active-old" : "compare-diff-active-new",
|
|
302
|
+
"fullLine",
|
|
303
|
+
false
|
|
304
|
+
);
|
|
305
|
+
},
|
|
306
|
+
scrollEditorToLine(editor, row) {
|
|
307
|
+
const maxRow = Math.max(editor.session.getLength() - 1, 0);
|
|
308
|
+
const targetRow = Math.max(0, Math.min(row, maxRow));
|
|
309
|
+
editor.scrollToLine(targetRow, true, true, () => {});
|
|
310
|
+
editor.gotoLine(targetRow + 1, 0, true);
|
|
311
|
+
editor.renderer.scrollCursorIntoView(
|
|
312
|
+
{ row: targetRow, column: 0 },
|
|
313
|
+
0.5
|
|
314
|
+
);
|
|
315
|
+
},
|
|
316
|
+
locateCurrentDiff() {
|
|
317
|
+
const diffItem = this.diffNavList[this.currentDiffIndex];
|
|
318
|
+
if (!diffItem) return;
|
|
319
|
+
|
|
320
|
+
const leftEditor = this.$refs.leftEditor?.aceEditor;
|
|
321
|
+
const rightEditor = this.$refs.rightEditor?.aceEditor;
|
|
322
|
+
if (!leftEditor || !rightEditor) return;
|
|
323
|
+
|
|
324
|
+
this.clearActiveMarkers();
|
|
325
|
+
const { leftRow, rightRow } = this.resolveDiffScrollRows(diffItem);
|
|
326
|
+
|
|
327
|
+
this.scrollEditorToLine(leftEditor, leftRow);
|
|
328
|
+
this.scrollEditorToLine(rightEditor, rightRow);
|
|
329
|
+
|
|
330
|
+
this.activeMarkerIds.left = this.addActiveHunkMarker(
|
|
331
|
+
leftEditor,
|
|
332
|
+
"left",
|
|
333
|
+
diffItem
|
|
334
|
+
);
|
|
335
|
+
this.activeMarkerIds.right = this.addActiveHunkMarker(
|
|
336
|
+
rightEditor,
|
|
337
|
+
"right",
|
|
338
|
+
diffItem
|
|
339
|
+
);
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
};
|
|
343
|
+
</script>
|
|
344
|
+
|
|
345
|
+
<style scoped lang="scss">
|
|
346
|
+
.compare-code-section {
|
|
347
|
+
.compare-code-header {
|
|
348
|
+
position: relative;
|
|
349
|
+
min-height: 28px;
|
|
350
|
+
padding-right: 24px;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.compare-header-main {
|
|
354
|
+
display: flex;
|
|
355
|
+
align-items: center;
|
|
356
|
+
flex-wrap: wrap;
|
|
357
|
+
gap: 0 16px;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.title {
|
|
361
|
+
margin-bottom: 0 !important;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.compare-diff-legend {
|
|
365
|
+
display: inline-flex;
|
|
366
|
+
align-items: center;
|
|
367
|
+
flex-wrap: wrap;
|
|
368
|
+
font-size: 12px;
|
|
369
|
+
gap: 0 12px;
|
|
370
|
+
|
|
371
|
+
.legend-item {
|
|
372
|
+
display: inline-block;
|
|
373
|
+
padding: 2px 8px;
|
|
374
|
+
border-radius: 2px;
|
|
375
|
+
|
|
376
|
+
&.legend-old {
|
|
377
|
+
background: rgba(245, 108, 108, 0.2);
|
|
378
|
+
color: #f56c6c;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
&.legend-new {
|
|
382
|
+
background: rgba(103, 194, 58, 0.2);
|
|
383
|
+
color: #67c23a;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.compare-diff-nav {
|
|
388
|
+
display: inline-flex;
|
|
389
|
+
align-items: center;
|
|
390
|
+
gap: 8px;
|
|
391
|
+
|
|
392
|
+
.diff-nav-btn {
|
|
393
|
+
display: inline-flex;
|
|
394
|
+
align-items: center;
|
|
395
|
+
height: 24px;
|
|
396
|
+
padding: 0 10px;
|
|
397
|
+
font-size: 12px;
|
|
398
|
+
line-height: 22px;
|
|
399
|
+
color: #409eff;
|
|
400
|
+
background: #ecf5ff;
|
|
401
|
+
border: 1px solid #b3d8ff;
|
|
402
|
+
border-radius: 2px;
|
|
403
|
+
cursor: pointer;
|
|
404
|
+
white-space: nowrap;
|
|
405
|
+
user-select: none;
|
|
406
|
+
transition: all 0.2s;
|
|
407
|
+
|
|
408
|
+
i {
|
|
409
|
+
margin-right: 4px;
|
|
410
|
+
font-size: 12px;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
&:hover:not(.is-disabled) {
|
|
414
|
+
color: #fff;
|
|
415
|
+
background: #409eff;
|
|
416
|
+
border-color: #409eff;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
&.is-disabled {
|
|
420
|
+
color: #c0c4cc;
|
|
421
|
+
background: #f5f7fa;
|
|
422
|
+
border-color: #e4e7ed;
|
|
423
|
+
cursor: not-allowed;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
.diff-nav-count {
|
|
428
|
+
color: #909399;
|
|
429
|
+
white-space: nowrap;
|
|
430
|
+
padding-left: 4px;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
&.is-diff-mode {
|
|
436
|
+
::v-deep .ace_marker-layer {
|
|
437
|
+
.compare-diff-old {
|
|
438
|
+
position: absolute;
|
|
439
|
+
background: rgba(245, 108, 108, 0.28);
|
|
440
|
+
z-index: 3;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
.compare-diff-new {
|
|
444
|
+
position: absolute;
|
|
445
|
+
background: rgba(103, 194, 58, 0.28);
|
|
446
|
+
z-index: 3;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
.compare-diff-active-old {
|
|
450
|
+
position: absolute;
|
|
451
|
+
background: rgba(245, 108, 108, 0.55);
|
|
452
|
+
z-index: 4;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
.compare-diff-active-new {
|
|
456
|
+
position: absolute;
|
|
457
|
+
background: rgba(103, 194, 58, 0.55);
|
|
458
|
+
z-index: 4;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
&.is-section-fullscreen {
|
|
464
|
+
position: fixed;
|
|
465
|
+
top: 0;
|
|
466
|
+
right: 0;
|
|
467
|
+
bottom: 0;
|
|
468
|
+
left: 0;
|
|
469
|
+
z-index: 9999;
|
|
470
|
+
display: flex;
|
|
471
|
+
flex-direction: column;
|
|
472
|
+
margin: 0;
|
|
473
|
+
overflow: hidden;
|
|
474
|
+
|
|
475
|
+
.compare-code-header {
|
|
476
|
+
flex-shrink: 0;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
.compare-code-flex {
|
|
480
|
+
flex: 1;
|
|
481
|
+
min-height: 0;
|
|
482
|
+
align-items: stretch;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.compare-code-col {
|
|
486
|
+
display: flex;
|
|
487
|
+
flex-direction: column;
|
|
488
|
+
min-height: 0;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
.compare-code-editor-wrap {
|
|
492
|
+
flex: 1;
|
|
493
|
+
min-height: 0;
|
|
494
|
+
|
|
495
|
+
::v-deep .ace-container {
|
|
496
|
+
height: 100%;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
::v-deep .ace-editor {
|
|
500
|
+
height: 100% !important;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
</style>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<component
|
|
4
|
+
v-if="type"
|
|
5
|
+
:is="type"
|
|
6
|
+
:objType="objType"
|
|
7
|
+
:objCode="objCode"
|
|
8
|
+
:compareHData1="compareHData1"
|
|
9
|
+
:compareHData2="compareHData2"
|
|
10
|
+
:preVersion="preVersion"
|
|
11
|
+
:curVersion="curVersion"
|
|
12
|
+
@reverCallback="$emit('reverCallback')"
|
|
13
|
+
/>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
<script>
|
|
17
|
+
import formTemplateCompareView from "./formTemplateCompareView.vue";
|
|
18
|
+
import formScriptCompareView from "./formScriptCompareView.vue";
|
|
19
|
+
import tableModelCompareView from "./tableModelCompareView.vue";
|
|
20
|
+
export default {
|
|
21
|
+
name: "compareContent",
|
|
22
|
+
components: {
|
|
23
|
+
formTemplateCompareView,
|
|
24
|
+
formScriptCompareView,
|
|
25
|
+
tableModelCompareView,
|
|
26
|
+
},
|
|
27
|
+
props: {
|
|
28
|
+
objType: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: "",
|
|
31
|
+
},
|
|
32
|
+
objCode: String,
|
|
33
|
+
compareHData1: {
|
|
34
|
+
type: Object,
|
|
35
|
+
default: () => ({}),
|
|
36
|
+
},
|
|
37
|
+
compareHData2: {
|
|
38
|
+
type: Object,
|
|
39
|
+
default: () => ({}),
|
|
40
|
+
},
|
|
41
|
+
preVersion: [String, Number],
|
|
42
|
+
curVersion: [String, Number],
|
|
43
|
+
},
|
|
44
|
+
data() {
|
|
45
|
+
return {
|
|
46
|
+
type: null,
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
created() {
|
|
50
|
+
this.initType();
|
|
51
|
+
},
|
|
52
|
+
methods: {
|
|
53
|
+
initType() {
|
|
54
|
+
this.type =
|
|
55
|
+
this.objType === "FormTemplate"
|
|
56
|
+
? "formTemplateCompareView"
|
|
57
|
+
: this.objType === "FormScript"
|
|
58
|
+
? "formScriptCompareView"
|
|
59
|
+
: "tableModelCompareView";
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
</script>
|