Skip to content

Commit e50b5cc

Browse files
feat: tool
1 parent aa7bc34 commit e50b5cc

File tree

23 files changed

+1659
-85
lines changed

23 files changed

+1659
-85
lines changed

ui/src/api/tool/tool.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Result } from '@/request/Result'
22
import { get, post, del, put } from '@/request/index'
33
import { type Ref } from 'vue'
44
import type { pageRequest } from '@/api/type/common'
5+
import type { toolData } from '@/api/type/tool'
56
const prefix = '/workspace'
67

78
/**
@@ -38,7 +39,37 @@ const getToolList: (
3839
)
3940
}
4041

42+
/**
43+
* 修改工具
44+
* @param 参数
45+
46+
*/
47+
const putToolLib: (
48+
wordspace_id: string,
49+
tool_id: string,
50+
data: toolData,
51+
loading?: Ref<boolean>,
52+
) => Promise<Result<any>> = (wordspace_id, tool_id, data, loading) => {
53+
return put(`${prefix}/${wordspace_id}/tool/${tool_id}`, data, undefined, loading)
54+
}
55+
56+
/**
57+
* 获取工具详情
58+
* @param tool_id 工具id
59+
* @param loading 加载器
60+
* @returns 函数详情
61+
*/
62+
const getToolById: (
63+
wordspace_id: string,
64+
tool_id: String,
65+
loading?: Ref<boolean>,
66+
) => Promise<Result<any>> = (wordspace_id, function_lib_id, loading) => {
67+
return get(`${prefix}/${wordspace_id}/tool/${function_lib_id}`, undefined, loading)
68+
}
69+
4170
export default {
4271
getToolByFolder,
4372
getToolList,
73+
putToolLib,
74+
getToolById
4475
}

ui/src/api/type/tool.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
interface toolData {
2+
id?: String
3+
name?: String
4+
icon?: String
5+
desc?: String
6+
code?: String
7+
input_field_list?: Array<any>
8+
init_field_list?: Array<any>
9+
is_active?: Boolean
10+
folder_id?: String
11+
}
12+
13+
export type { toolData }

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,27 @@ export const iconMap: any = {
117117
])
118118
},
119119
},
120-
120+
'app-disabled': {
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: 'M512 21.333333C241.024 21.333333 21.333333 241.024 21.333333 512S241.024 1002.666667 512 1002.666667 1002.666667 782.976 1002.666667 512 782.976 21.333333 512 21.333333z m297.685333 697.856L304.810667 214.314667a362.666667 362.666667 0 0 1 504.874666 504.874666zM149.333333 512c0-77.056 24.021333-148.48 64.981334-207.189333l504.874666 504.874666A362.666667 362.666667 0 0 1 149.333333 512z',
134+
fill: 'currentColor',
135+
}),
136+
],
137+
),
138+
])
139+
},
140+
},
121141
// 动态加载的图标
122142
...dynamicIcons,
123143
}

ui/src/components/card-box/index.vue

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
<el-card shadow="hover" class="card-box" @mouseenter="cardEnter()" @mouseleave="cardLeave()">
33
<div class="card-header">
44
<slot name="header">
5-
<div class="title flex align-center" :class="$slots.subTitle ? 'mt-4' : ''">
6-
<slot name="icon">
7-
<el-avatar v-if="showIcon" class="mr-12 avatar-blue" shape="square" :size="32">
8-
<img src="@/assets/knowledge/icon_document.svg" style="width: 58%" alt="" />
9-
</el-avatar>
10-
</slot>
5+
<div class="title flex align-center">
6+
<div class="mr-12 flex align-center" v-if="showIcon">
7+
<slot name="icon">
8+
<el-avatar shape="square" :size="32" class="avatar-blue">
9+
<img src="@/assets/knowledge/icon_document.svg" style="width: 58%" alt="" />
10+
</el-avatar>
11+
</slot>
12+
</div>
1113
<div style="width: 90%">
1214
<slot name="title">
1315
<div>
@@ -21,16 +23,19 @@
2123
</div>
2224
<div class="description break-all mt-12">
2325
<slot>
24-
<div class="content">
26+
<div class="content color-secondary">
2527
{{ description }}
2628
</div>
2729
</slot>
2830
</div>
29-
<div @mouseenter="subHoveredEnter">
30-
<slot name="mouseEnter" v-if="$slots.mouseEnter && show" />
31-
</div>
32-
<div class="card-footer" v-if="$slots.footer">
33-
<slot name="footer" />
31+
32+
<div class="card-footer flex-between" v-if="$slots.footer || $slots.mouseEnter">
33+
<div>
34+
<slot name="footer"></slot>
35+
</div>
36+
<div @mouseenter="subHoveredEnter">
37+
<slot name="mouseEnter" v-if="$slots.mouseEnter && show" />
38+
</div>
3439
</div>
3540
</el-card>
3641
</template>
@@ -80,11 +85,12 @@ function subHoveredEnter() {
8085
min-width: var(--card-min-width);
8186
border-radius: 8px;
8287
.card-header {
83-
margin-top: -10px;
88+
margin-top: -5px;
8489
}
8590
.description {
8691
line-height: 22px;
8792
font-weight: 400;
93+
min-height: 70px;
8894
.content {
8995
display: -webkit-box;
9096
height: var(--app-card-box-description-height, 40px);
@@ -96,7 +102,7 @@ function subHoveredEnter() {
96102
97103
.card-footer {
98104
position: absolute;
99-
bottom: 4px;
105+
bottom: 8px;
100106
left: 0;
101107
min-height: 30px;
102108
font-weight: 400;

ui/src/components/dynamics-form/items/radio/RadioRow.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const option_list = computed(() => {
5555
border-radius: 4px;
5656
font-weight: 400;
5757
font-size: 14px;
58-
color: #1f2329;
58+
color: var(--el-text-color-primary);
5959
padding: 3px 4px;
6060
box-sizing: border-box;
6161
white-space: nowrap;

ui/src/components/dynamics-form/items/table/TableCheckbox.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ const activeText = computed(() => {
193193
justify-content: space-between;
194194
margin-bottom: 16px;
195195
.title {
196-
color: #1f2329;
196+
color: var(--el-text-color-primary);
197197
font-weight: 400;
198198
font-size: 14px;
199199
line-height: 22px;

ui/src/components/dynamics-form/items/table/TableRadio.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ const activeText = computed(() => {
181181
justify-content: space-between;
182182
margin-bottom: 16px;
183183
.title {
184-
color: #1f2329;
184+
color: var(--el-text-color-primary);
185185
font-weight: 400;
186186
font-size: 14px;
187187
line-height: 22px;

ui/src/locales/lang/en-US/common.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,14 @@ export default {
4444
document: 'Documents',
4545
image: 'Image',
4646
audio: 'Audio',
47-
video: 'Video'
47+
video: 'Video',
4848
},
4949
status: {
5050
label: 'Status',
51+
enabled: 'Enabled',
52+
disabled: 'Disabled',
5153
enableSuccess: 'Successful',
52-
disableSuccess: 'Successful'
54+
disableSuccess: 'Successful',
5355
},
5456
param: {
5557
outputParam: 'Output Parameters',
@@ -60,5 +62,5 @@ export default {
6062
inputPlaceholder: 'Please input',
6163
title: 'Title',
6264
content: 'Content',
63-
rename: 'Rename'
65+
rename: 'Rename',
6466
}

ui/src/locales/lang/zh-CN/common.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,18 @@ export default {
5252
},
5353
status: {
5454
label: '状态',
55+
enabled: '已启用',
56+
disabled: '已禁用',
5557
enableSuccess: '启用成功',
56-
disableSuccess: '禁用成功'
58+
disableSuccess: '禁用成功',
5759
},
5860
inputPlaceholder: '请输入',
5961
title: '标题',
6062
content: '内容',
6163
param: {
6264
outputParam: '输出参数',
6365
inputParam: '输入参数',
64-
initParam: '启动参数'
66+
initParam: '启动参数',
6567
},
66-
rename: '重命名'
68+
rename: '重命名',
6769
}

ui/src/locales/lang/zh-Hant/common.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,14 @@ export default {
4444
document: '文檔',
4545
image: '圖片',
4646
audio: '音頻',
47-
video: '視頻'
47+
video: '視頻',
4848
},
4949
status: {
5050
label: '狀態',
51+
enabled: '已啟用',
52+
disabled: '已停用',
5153
enableSuccess: '啟用成功',
52-
disableSuccess: '停用成功'
54+
disableSuccess: '停用成功',
5355
},
5456
inputPlaceholder: '請輸入',
5557
title: '標題',
@@ -59,5 +61,5 @@ export default {
5961
inputParam: '輸入參數',
6062
initParam: '啟動參數',
6163
},
62-
rename: '重命名'
64+
rename: '重命名',
6365
}

0 commit comments

Comments
 (0)