Skip to content

Commit 23825b4

Browse files
committed
增加示例 优化代码
1 parent a41c84e commit 23825b4

File tree

3 files changed

+159
-13
lines changed

3 files changed

+159
-13
lines changed

src/renderer/views/MST.vue

Lines changed: 94 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<el-button @click="handleExample(1)">样 例 1</el-button>
1212
<el-button @click="handleExample(2)">样 例 2</el-button>
1313
<el-button @click="handleExample(3)">样 例 3</el-button>
14+
<el-button @click="handleExample(4)">示 例</el-button>
1415
</div>
1516
<div class="button_group_right">
1617
<el-button type="info" @click="configureDialogVisible = true">配 置</el-button>
@@ -46,13 +47,14 @@
4647
<el-table :data="configureForm.links">
4748
<el-table-column label="起点">
4849
<template slot-scope="scope">
50+
<p>{{scope.row}}</p>
4951
<el-select v-model="scope.row.start" placeholder="请选择" v-show="!scope.row.disabled">
5052
<el-option v-for="(item, index) in configureForm.nodeNum ? parseInt(configureForm.nodeNum) : 0"
5153
:key="index"
5254
:label="getCharByIndex(index)" :value="index.toString()" :disabled="index === scope.row.end">
5355
</el-option>
5456
</el-select>
55-
<span v-show="scope.row.disabled">{{ getCharByIndex(scope.row.start) }}</span>
57+
<span v-show="scope.row.disabled">{{ getCharByIndex(parseInt(scope.row.start)) }}</span>
5658
</template>
5759
</el-table-column>
5860
<el-table-column label="终点">
@@ -63,7 +65,7 @@
6365
:label="getCharByIndex(index)" :value="index.toString()" :disabled="index === scope.row.start">
6466
</el-option>
6567
</el-select>
66-
<span v-show="scope.row.disabled">{{ getCharByIndex(scope.row.end) }}</span>
68+
<span v-show="scope.row.disabled">{{ getCharByIndex(parseInt(scope.row.end)) }}</span>
6769
</template>
6870
</el-table-column>
6971
<el-table-column label="权重" prop="value">
@@ -299,6 +301,96 @@ export default {
299301
value: "30"
300302
}
301303
]
304+
},
305+
{
306+
nodeNum: 10,
307+
links: [
308+
{
309+
start: "0",
310+
end: "1",
311+
value: "1"
312+
},
313+
{
314+
start: "0",
315+
end: "4",
316+
value: "3"
317+
},
318+
{
319+
start: "1",
320+
end: "2",
321+
value: "5"
322+
},
323+
{
324+
start: "1",
325+
end: "3",
326+
value: "6"
327+
},
328+
{
329+
start: "1",
330+
end: "4",
331+
value: "1"
332+
},
333+
{
334+
start: "2",
335+
end: "3",
336+
value: "4"
337+
},
338+
{
339+
start: "2",
340+
end: "8",
341+
value: "7"
342+
},
343+
{
344+
start: "2",
345+
end: "9",
346+
value: "2"
347+
},
348+
{
349+
start: "3",
350+
end: "5",
351+
value: "4"
352+
},
353+
{
354+
start: "3",
355+
end: "7",
356+
value: "3"
357+
},
358+
{
359+
start: "3",
360+
end: "9",
361+
value: "9"
362+
},
363+
{
364+
start: "4",
365+
end: "5",
366+
value: "11"
367+
},
368+
{
369+
start: "5",
370+
end: "6",
371+
value: "2"
372+
},
373+
{
374+
start: "6",
375+
end: "7",
376+
value: "1"
377+
},
378+
{
379+
start: "7",
380+
end: "8",
381+
value: "2"
382+
},
383+
{
384+
start: "7",
385+
end: "9",
386+
value: "4"
387+
},
388+
{
389+
start: "8",
390+
end: "9",
391+
value: "3"
392+
}
393+
]
302394
}
303395
]
304396
}

src/renderer/views/MaxMatch.vue

Lines changed: 63 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
<el-footer>
1010
<div class="button_group_left">
1111
<el-button @click="handleExample(1)">样 例 1</el-button>
12-
<el-button @click="handleExample(2)">样 例 2</el-button>
12+
<el-button>样 例 2</el-button>
1313
<el-button @click="handleExample(3)">样 例 3</el-button>
14+
<el-button @click="handleExample(4)">示 例</el-button>
1415
</div>
1516
<div class="button_group_right">
1617
<el-button type="info" @click="configureDialogVisible = true">配 置</el-button>
@@ -51,7 +52,7 @@
5152
:label="getCharByIndex(index)" :value="index.toString()" :disabled="index === scope.row.end">
5253
</el-option>
5354
</el-select>
54-
<span v-show="scope.row.disabled">{{ getCharByIndex(scope.row.start) }}</span>
55+
<span v-show="scope.row.disabled">{{ getCharByIndex(parseInt(scope.row.start)) }}</span>
5556
</template>
5657
</el-table-column>
5758
<el-table-column label="终点" prop="end">
@@ -62,7 +63,7 @@
6263
:label="getCharByIndex(index)" :value="index.toString()" :disabled="index === scope.row.start">
6364
</el-option>
6465
</el-select>
65-
<span v-show="scope.row.disabled">{{ getCharByIndex(scope.row.end) }}</span>
66+
<span v-show="scope.row.disabled">{{ getCharByIndex(parseInt(scope.row.end)) }}</span>
6667
</template>
6768
</el-table-column>
6869
<el-table-column label="操作">
@@ -107,9 +108,9 @@ export default {
107108
defaultJunctionPoint: 'border',
108109
layouts: [
109110
{
110-
'label': '自动布局',
111-
'layoutName': 'force',
112-
'layoutClassName': 'seeks-layout-force'
111+
'label': '中心',
112+
'layoutName': 'center',
113+
'layoutClassName': 'seeks-layout-center'
113114
}
114115
]
115116
},
@@ -249,6 +250,59 @@ export default {
249250
end: "9"
250251
},
251252
]
253+
},
254+
{
255+
nodeNum: 12,
256+
links: [
257+
{
258+
start: "0",
259+
end: "6"
260+
},
261+
{
262+
start: "0",
263+
end: "7"
264+
},
265+
{
266+
start: "0",
267+
end: "8"
268+
},
269+
{
270+
start: "1",
271+
end: "7"
272+
},
273+
{
274+
start: "2",
275+
end: "9"
276+
},
277+
{
278+
start: "3",
279+
end: "6"
280+
},
281+
{
282+
start: "3",
283+
end: "8"
284+
},
285+
{
286+
start: "3",
287+
end: "10"
288+
},
289+
{
290+
start: "4",
291+
end: "7"
292+
},
293+
{
294+
start: "4",
295+
end: "10"
296+
},
297+
{
298+
start: "4",
299+
end: "11"
300+
},
301+
{
302+
start: "5",
303+
end: "8"
304+
},
305+
]
252306
}
253307
]
254308
}
@@ -338,9 +392,9 @@ export default {
338392
defaultJunctionPoint: 'border',
339393
layouts: [
340394
{
341-
'label': '自动布局',
342-
'layoutName': 'force',
343-
'layoutClassName': 'seeks-layout-force'
395+
'label': '中心',
396+
'layoutName': 'center',
397+
'layoutClassName': 'seeks-layout-center'
344398
}
345399
]
346400
}, () => {})

src/renderer/views/ShortestPath.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
:label="getCharByIndex(index)" :value="index.toString()" :disabled="index === scope.row.end">
6161
</el-option>
6262
</el-select>
63-
<span v-show="scope.row.disabled">{{ getCharByIndex(scope.row.start) }}</span>
63+
<span v-show="scope.row.disabled">{{ getCharByIndex(parseInt(scope.row.start)) }}</span>
6464
</template>
6565
</el-table-column>
6666
<el-table-column label="终点" prop="end">
@@ -71,7 +71,7 @@
7171
:label="getCharByIndex(index)" :value="index.toString()" :disabled="index === scope.row.start">
7272
</el-option>
7373
</el-select>
74-
<span v-show="scope.row.disabled">{{ getCharByIndex(scope.row.end) }}</span>
74+
<span v-show="scope.row.disabled">{{ getCharByIndex(parseInt(scope.row.end)) }}</span>
7575
</template>
7676
</el-table-column>
7777
<el-table-column label="权重" prop="value">

0 commit comments

Comments
 (0)