Skip to content

Commit 4bb7f41

Browse files
committed
feat(card): card adaptive
1 parent 42d7c3c commit 4bb7f41

File tree

6 files changed

+110
-61
lines changed

6 files changed

+110
-61
lines changed

frontend/src/views/ds/Card.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,11 @@ const onClickOutside = () => {
119119

120120
<style lang="less" scoped>
121121
.card {
122-
width: calc(33% - 14px);
122+
width: 100%;
123123
border: 1px solid #dee0e3;
124124
padding: 16px;
125125
border-radius: 12px;
126126
cursor: pointer;
127-
margin: 0 0 16px 16px;
128127
&:hover {
129128
box-shadow: 0px 6px 24px 0px #1f232914;
130129
}

frontend/src/views/ds/Datasource.vue

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -285,20 +285,32 @@ const back = () => {
285285
/>
286286

287287
<div v-else class="card-content">
288-
<Card
289-
v-for="ele in datasourceListWithSearch"
290-
:id="ele.id"
291-
:key="ele.id"
292-
:name="ele.name"
293-
:type="ele.type"
294-
:type-name="ele.type_name"
295-
:num="ele.num"
296-
:description="ele.description"
297-
@question="handleQuestion"
298-
@edit="handleEditDatasource(ele)"
299-
@del="deleteHandler(ele)"
300-
@data-table-detail="dataTableDetail(ele)"
301-
></Card>
288+
<el-row :gutter="16" class="w-full">
289+
<el-col
290+
v-for="ele in datasourceListWithSearch"
291+
:key="ele.id"
292+
:xs="24"
293+
:sm="12"
294+
:md="12"
295+
:lg="8"
296+
:xl="6"
297+
class="mb-16"
298+
>
299+
<Card
300+
:id="ele.id"
301+
:key="ele.id"
302+
:name="ele.name"
303+
:type="ele.type"
304+
:type-name="ele.type_name"
305+
:num="ele.num"
306+
:description="ele.description"
307+
@question="handleQuestion"
308+
@edit="handleEditDatasource(ele)"
309+
@del="deleteHandler(ele)"
310+
@data-table-detail="dataTableDetail(ele)"
311+
></Card>
312+
</el-col>
313+
</el-row>
302314
</div>
303315
<template v-if="!keywords && !datasourceListWithSearch.length && !searchLoading">
304316
<EmptyBackground
@@ -378,13 +390,13 @@ const back = () => {
378390
<style lang="less" scoped>
379391
.datasource-config {
380392
height: calc(100% - 16px);
381-
padding: 24px 24px 24px 8px;
393+
padding: 16px 0 16px 0;
382394
.datasource-methods {
383395
display: flex;
384396
align-items: center;
385397
justify-content: space-between;
386398
margin-bottom: 16px;
387-
padding-left: 16px;
399+
padding: 0 24px 0 24px;
388400
.title {
389401
font-weight: 500;
390402
font-size: 20px;
@@ -393,11 +405,17 @@ const back = () => {
393405
}
394406
395407
.card-content {
396-
display: flex;
397-
flex-wrap: wrap;
398408
max-height: calc(100% - 40px);
399409
overflow-y: auto;
400-
justify-content: space-between;
410+
padding: 0 8px 0 24px;
411+
412+
.w-full {
413+
width: 100%;
414+
}
415+
416+
.mb-16 {
417+
margin-bottom: 16px;
418+
}
401419
}
402420
403421
.datasource-yet {

frontend/src/views/system/embedded/Card.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,11 @@ const handleEmbedded = () => {
6969

7070
<style lang="less" scoped>
7171
.card {
72-
width: calc(33% - 14px);
72+
width: 100%;
7373
height: 168px;
7474
border: 1px solid #dee0e3;
7575
padding: 16px;
7676
border-radius: 12px;
77-
margin: 0 0 16px 16px;
7877
&:hover {
7978
box-shadow: 0px 6px 24px 0px #1f232914;
8079
}

frontend/src/views/system/embedded/index.vue

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -508,19 +508,30 @@ const saveHandler = () => {
508508
:description="$t('datasource.relevant_content_found')"
509509
img-type="tree"
510510
/>
511-
512511
<div v-else class="card-content">
513-
<Card
514-
v-for="ele in embeddedListWithSearch"
515-
:id="ele.id"
516-
:key="ele.id"
517-
:name="ele.name"
518-
:is-base="ele.type === 0"
519-
:description="ele.description"
520-
@embedded="handleEmbedded(ele)"
521-
@edit="handleEditRule(ele)"
522-
@del="deleteHandler(ele)"
523-
></Card>
512+
<el-row :gutter="16" class="w-full">
513+
<el-col
514+
v-for="ele in embeddedListWithSearch"
515+
:key="ele.id"
516+
:xs="24"
517+
:sm="12"
518+
:md="12"
519+
:lg="8"
520+
:xl="6"
521+
class="mb-16"
522+
>
523+
<Card
524+
:id="ele.id"
525+
:key="ele.id"
526+
:name="ele.name"
527+
:is-base="ele.type === 0"
528+
:description="ele.description"
529+
@embedded="handleEmbedded(ele)"
530+
@edit="handleEditRule(ele)"
531+
@del="deleteHandler(ele)"
532+
></Card>
533+
</el-col>
534+
</el-row>
524535
</div>
525536
<template v-if="!keywords && !embeddedListWithSearch.length && !searchLoading">
526537
<EmptyBackground :description="$t('embedded.no_application')" img-type="noneWhite" />
@@ -914,7 +925,7 @@ const saveHandler = () => {
914925
<style lang="less" scoped>
915926
.embedded {
916927
height: 100%;
917-
padding: 24px 24px 24px 8px;
928+
padding: 16px 0 16px 0;
918929
919930
.ed-empty {
920931
padding-top: 200px;
@@ -925,7 +936,7 @@ const saveHandler = () => {
925936
align-items: center;
926937
justify-content: space-between;
927938
margin-bottom: 16px;
928-
padding-left: 24px;
939+
padding: 0 24px 0 24px;
929940
930941
.btn-select {
931942
height: 32px;
@@ -957,11 +968,17 @@ const saveHandler = () => {
957968
}
958969
959970
.card-content {
960-
display: flex;
961-
flex-wrap: wrap;
962971
max-height: calc(100% - 40px);
963972
overflow-y: auto;
964-
justify-content: space-between;
973+
padding: 0 8px 0 24px;
974+
975+
.w-full {
976+
width: 100%;
977+
}
978+
979+
.mb-16 {
980+
margin-bottom: 16px;
981+
}
965982
}
966983
}
967984
</style>

frontend/src/views/system/model/Card.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,11 @@ defineExpose({ showErrorMask })
8888

8989
<style lang="less" scoped>
9090
.card {
91-
width: calc(33% - 14px);
91+
width: 100%;
9292
height: 160px;
9393
border: 1px solid #dee0e3;
9494
padding: 16px;
9595
border-radius: 12px;
96-
margin: 0 0 16px 16px;
9796
&:hover {
9897
box-shadow: 0px 6px 24px 0px #1f232914;
9998
}

frontend/src/views/system/model/Model.vue

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -343,21 +343,32 @@ const submit = (item: any) => {
343343
:description="$t('datasource.relevant_content_found')"
344344
img-type="tree"
345345
/>
346-
347346
<div v-else class="card-content">
348-
<card
349-
v-for="(ele, index) in modelListWithSearch"
350-
:id="ele.id"
351-
:ref="(el: any) => setCardRef(el, index)"
352-
:key="ele.id"
353-
:name="ele.name"
354-
:supplier="ele.supplier"
355-
:model-type="getModelTypeName(ele['model_type'])"
356-
:base-model="ele['base_model']"
357-
:is-default="ele['default_model']"
358-
@edit="handleEditModel(ele)"
359-
@del="deleteHandler"
360-
></card>
347+
<el-row :gutter="16" class="w-full">
348+
<el-col
349+
v-for="(ele, index) in modelListWithSearch"
350+
:key="ele.id"
351+
:xs="24"
352+
:sm="12"
353+
:md="12"
354+
:lg="8"
355+
:xl="6"
356+
class="mb-16"
357+
>
358+
<card
359+
:id="ele.id"
360+
:ref="(el: any) => setCardRef(el, index)"
361+
:key="ele.id"
362+
:name="ele.name"
363+
:supplier="ele.supplier"
364+
:model-type="getModelTypeName(ele['model_type'])"
365+
:base-model="ele['base_model']"
366+
:is-default="ele['default_model']"
367+
@edit="handleEditModel(ele)"
368+
@del="deleteHandler"
369+
></card>
370+
</el-col>
371+
</el-row>
361372
</div>
362373
<el-drawer
363374
v-model="modelConfigvVisible"
@@ -415,13 +426,13 @@ const submit = (item: any) => {
415426
<style lang="less" scoped>
416427
.model-config {
417428
height: calc(100% - 16px);
418-
padding: 24px 24px 24px 8px;
429+
padding: 16px 0 16px 0;
419430
.model-methods {
420431
display: flex;
421432
align-items: center;
422433
justify-content: space-between;
423434
margin-bottom: 16px;
424-
padding-left: 24px;
435+
padding: 0 24px 0 24px;
425436
.title {
426437
font-weight: 500;
427438
font-size: 20px;
@@ -430,11 +441,17 @@ const submit = (item: any) => {
430441
}
431442
432443
.card-content {
433-
display: flex;
434-
flex-wrap: wrap;
435444
max-height: calc(100% - 40px);
436445
overflow-y: auto;
437-
justify-content: space-between;
446+
padding: 0 8px 0 24px;
447+
448+
.w-full {
449+
width: 100%;
450+
}
451+
452+
.mb-16 {
453+
margin-bottom: 16px;
454+
}
438455
}
439456
}
440457
</style>

0 commit comments

Comments
 (0)