Skip to content

Commit d14b473

Browse files
feat: model
1 parent 4eed42b commit d14b473

File tree

17 files changed

+427
-193
lines changed

17 files changed

+427
-193
lines changed

ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"@codemirror/lang-json": "^6.0.1",
1717
"@codemirror/theme-one-dark": "^6.1.2",
1818
"axios": "^1.8.4",
19-
"element-plus": "^2.9.7",
19+
"element-plus": "^2.9.10",
2020
"nprogress": "^0.2.0",
2121
"pinia": "^3.0.1",
2222
"use-element-plus-theme": "^0.0.5",
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import { h } from 'vue'
2+
export default {
3+
'app-folder': {
4+
iconReader: () => {
5+
return h('i', [
6+
h(
7+
'svg',
8+
{
9+
style: { height: '100%', width: '100%' },
10+
viewBox: '0 0 1024 1024',
11+
version: '1.1',
12+
xmlns: 'http://www.w3.org/2000/svg',
13+
},
14+
[
15+
h('path', {
16+
d: 'M42.666667 170.666667a42.666667 42.666667 0 0 1 42.666666-42.666667h357.632a42.666667 42.666667 0 0 1 38.144 23.594667L512 213.333333h426.666667a42.666667 42.666667 0 0 1 42.666666 42.666667v597.333333a42.666667 42.666667 0 0 1-42.666666 42.666667H85.333333a42.666667 42.666667 0 0 1-42.666666-42.666667V170.666667z',
17+
fill: '#FFA53D',
18+
}),
19+
h('path', {
20+
d: 'M42.666667 256a42.666667 42.666667 0 0 1 42.666666-42.666667h853.333334a42.666667 42.666667 0 0 1 42.666666 42.666667v597.333333a42.666667 42.666667 0 0 1-42.666666 42.666667H85.333333a42.666667 42.666667 0 0 1-42.666666-42.666667V256z',
21+
fill: '#FFC60A',
22+
}),
23+
],
24+
),
25+
])
26+
},
27+
},
28+
'app-all-menu-active': {
29+
iconReader: () => {
30+
return h('i', [
31+
h(
32+
'svg',
33+
{
34+
style: { height: '100%', width: '100%' },
35+
viewBox: '0 0 20 20',
36+
version: '1.1',
37+
xmlns: 'http://www.w3.org/2000/svg'
38+
},
39+
[
40+
h('path', {
41+
d: 'M8.33317 1.6665H2.49984C2.0396 1.6665 1.6665 2.0396 1.6665 2.49984V8.33317C1.6665 8.79341 2.0396 9.1665 2.49984 9.1665H8.33317C8.79341 9.1665 9.1665 8.79341 9.1665 8.33317V2.49984C9.1665 2.0396 8.79341 1.6665 8.33317 1.6665Z',
42+
fill: 'currentColor'
43+
}),
44+
h('path', {
45+
d: 'M8.33317 10.8332H2.49984C2.0396 10.8332 1.6665 11.2063 1.6665 11.6665V17.4998C1.6665 17.9601 2.0396 18.3332 2.49984 18.3332H8.33317C8.79341 18.3332 9.1665 17.9601 9.1665 17.4998V11.6665C9.1665 11.2063 8.79341 10.8332 8.33317 10.8332Z',
46+
fill: 'currentColor'
47+
}),
48+
h('path', {
49+
d: 'M17.4998 1.6665H11.6665C11.2063 1.6665 10.8332 2.0396 10.8332 2.49984V8.33317C10.8332 8.79341 11.2063 9.1665 11.6665 9.1665H17.4998C17.9601 9.1665 18.3332 8.79341 18.3332 8.33317V2.49984C18.3332 2.0396 17.9601 1.6665 17.4998 1.6665Z',
50+
fill: 'currentColor'
51+
}),
52+
h('path', {
53+
d: 'M17.4508 10.8332H11.7155C11.2282 10.8332 10.8332 11.2282 10.8332 11.7155V17.4508C10.8332 17.9381 11.2282 18.3332 11.7155 18.3332H17.4508C17.9381 18.3332 18.3332 17.9381 18.3332 17.4508V11.7155C18.3332 11.2282 17.9381 10.8332 17.4508 10.8332Z',
54+
fill: 'currentColor'
55+
})
56+
]
57+
)
58+
])
59+
}
60+
},
61+
}

ui/src/components/app-icon/index.ts

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -117,31 +117,7 @@ export const iconMap: any = {
117117
])
118118
},
119119
},
120-
'app-folder': {
121-
iconReader: () => {
122-
return h('i', [
123-
h(
124-
'svg',
125-
{
126-
style: { height: '100%', width: '100%' },
127-
viewBox: '0 0 1024 1024',
128-
version: '1.1',
129-
xmlns: 'http://www.w3.org/2000/svg',
130-
},
131-
[
132-
h('path', {
133-
d: 'M42.666667 170.666667a42.666667 42.666667 0 0 1 42.666666-42.666667h357.632a42.666667 42.666667 0 0 1 38.144 23.594667L512 213.333333h426.666667a42.666667 42.666667 0 0 1 42.666666 42.666667v597.333333a42.666667 42.666667 0 0 1-42.666666 42.666667H85.333333a42.666667 42.666667 0 0 1-42.666666-42.666667V170.666667z',
134-
fill: '#FFA53D',
135-
}),
136-
h('path', {
137-
d: 'M42.666667 256a42.666667 42.666667 0 0 1 42.666666-42.666667h853.333334a42.666667 42.666667 0 0 1 42.666666 42.666667v597.333333a42.666667 42.666667 0 0 1-42.666666 42.666667H85.333333a42.666667 42.666667 0 0 1-42.666666-42.666667V256z',
138-
fill: '#FFC60A',
139-
}),
140-
],
141-
),
142-
])
143-
},
144-
},
120+
145121
// 动态加载的图标
146122
...dynamicIcons,
147123
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<template>
2+
<div class="common-list">
3+
<ul v-if="data.length > 0">
4+
<template v-for="(item, index) in data" :key="index">
5+
<li
6+
@click.stop="clickHandle(item, index)"
7+
:class="current === item[props.valueKey] ? 'active color-primary-1' : ''"
8+
class="cursor"
9+
@mouseenter.stop="mouseenter(item)"
10+
@mouseleave.stop="mouseleave()"
11+
>
12+
<slot :row="item" :index="index"> </slot>
13+
</li>
14+
</template>
15+
</ul>
16+
<slot name="empty" v-else>
17+
<el-empty :description="$t('common.noData')" />
18+
</slot>
19+
</div>
20+
</template>
21+
<script setup lang="ts">
22+
import { ref, watch } from 'vue'
23+
24+
defineOptions({ name: 'CommonList' })
25+
26+
const props = withDefaults(
27+
defineProps<{
28+
data: Array<any>
29+
defaultActive?: string
30+
valueKey?: string // 唯一标识的键名
31+
}>(),
32+
{
33+
data: () => [],
34+
defaultActive: '',
35+
valueKey: 'id'
36+
}
37+
)
38+
39+
const current = ref<Number | String>(0)
40+
41+
watch(
42+
() => props.defaultActive,
43+
(val) => {
44+
current.value = val
45+
},
46+
{ immediate: true }
47+
)
48+
49+
const emit = defineEmits(['click', 'mouseenter', 'mouseleave'])
50+
51+
function mouseenter(row: any) {
52+
emit('mouseenter', row)
53+
}
54+
function mouseleave() {
55+
emit('mouseleave')
56+
}
57+
58+
function clickHandle(row: any, index: number) {
59+
current.value = row[props.valueKey]
60+
emit('click', row)
61+
}
62+
63+
function clearCurrent() {
64+
current.value = 0
65+
}
66+
defineExpose({
67+
clearCurrent
68+
})
69+
</script>
70+
<style lang="scss" scoped>
71+
/* 通用 ui li样式 */
72+
.common-list {
73+
li {
74+
padding: 8px 16px;
75+
font-weight: 400;
76+
color: var(--el-text-color-regular);
77+
font-size: 14px;
78+
margin-bottom: 4px;
79+
&.active {
80+
border-radius: 4px;
81+
color: var(--el-color-primary);
82+
font-weight: 500;
83+
&:hover {
84+
background: var(--el-color-primary-light-9);
85+
}
86+
}
87+
&:hover {
88+
border-radius: 4px;
89+
background: var(--app-text-color-light-1);
90+
}
91+
}
92+
}
93+
</style>

ui/src/components/folder-tree/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
:placeholder="$t('common.search')"
66
prefix-icon="Search"
77
clearable
8-
class="p-8"
8+
class="p-16"
99
/>
1010
<el-tree
1111
ref="treeRef"

ui/src/components/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import LayoutContainer from './layout-container/index.vue'
88
import ContentContainer from './layout-container/ContentContainer.vue'
99
import CardBox from './card-box/index.vue'
1010
import FolderTree from './folder-tree/index.vue'
11+
import CommonList from './common-list/index.vue'
1112
export default {
1213
install(app: App) {
1314
app.component('LogoFull', LogoFull)
@@ -19,5 +20,6 @@ export default {
1920
app.component('ContentContainer', ContentContainer)
2021
app.component('CardBox', CardBox)
2122
app.component('FolderTree', FolderTree)
23+
app.component('CommonList', CommonList)
2224
},
2325
}

ui/src/components/layout-container/ContentContainer.vue

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
<template>
2-
<div class="content-container border-r-4 p-16-24">
2+
<div class="content-container">
33
<div class="content-container__header flex align-center w-full" v-if="slots.header || header">
44
<slot name="backButton">
55
<back-button :to="backTo" v-if="showBack"></back-button>
66
</slot>
7-
<slot name="header">
8-
<h4>{{ header }}</h4>
9-
</slot>
7+
<div class="flex-between w-full">
8+
<slot name="header">
9+
<h4>{{ header }}</h4>
10+
</slot>
11+
<slot name="search">
12+
<h4>{{ header }}</h4>
13+
</slot>
14+
</div>
1015
</div>
1116

12-
<div class="content-container__main">
17+
<div class="content-container__main p-16">
1318
<slot></slot>
1419
</div>
1520
</div>
@@ -34,11 +39,10 @@ const showBack = computed(() => {
3439
transition: 0.3s;
3540
.content-container__header {
3641
box-sizing: border-box;
37-
padding: calc(var(--app-base-px) * 2) 0;
42+
padding: calc(var(--app-base-px) * 2) calc(var(--app-base-px) * 2) 0;
3843
flex-wrap: wrap;
3944
}
4045
.content-container__main {
41-
// background-color: var(--app-view-bg-color);
4246
box-sizing: border-box;
4347
min-width: 447px;
4448
}

ui/src/components/layout-container/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="layout-container flex h-full">
3-
<div class="layout-container__left border-r p-8">
3+
<div class="layout-container__left border-r">
44
<slot name="left"></slot>
55
</div>
66
<div class="layout-container__right">

ui/src/styles/app.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
$primary-color: #3370ff;
12
@font-face {
23
font-family: AlibabaPuHuiTi;
34
src:
@@ -373,6 +374,12 @@ h5 {
373374
}
374375

375376
// 颜色
377+
.color-primary-1 {
378+
background: rgba($primary-color, 0.1);
379+
}
380+
.color-primary {
381+
color: var(--el-color-primary);
382+
}
376383
.color-text-primary {
377384
color: var(--el-text-color-primary);
378385
}

ui/src/styles/component.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// 复合搜索框
2+
.complex-search {
3+
border: 1px solid var(--el-border-color);
4+
border-radius: var(--el-border-radius-base);
5+
.el-select__wrapper {
6+
box-shadow: none !important;
7+
}
8+
.el-input__wrapper {
9+
box-shadow: none !important;
10+
}
11+
&__left {
12+
border-right: 1px solid var(--el-border-color);
13+
}
14+
}

0 commit comments

Comments
 (0)