Skip to content

Commit 4db8c9c

Browse files
perf: application overview update Text
1 parent b6c676f commit 4db8c9c

File tree

3 files changed

+21
-175
lines changed

3 files changed

+21
-175
lines changed

ui/src/views/application-overview/component/DisplaySettingDialog.vue

Lines changed: 15 additions & 172 deletions
Original file line numberDiff line numberDiff line change
@@ -8,99 +8,15 @@
88
<el-form label-position="top" ref="displayFormRef" :model="form">
99
<el-form-item>
1010
<el-space direction="vertical" alignment="start">
11-
<el-checkbox v-model="form.show_source" label="显示知识来源" />
1211
<el-checkbox
13-
v-model="form.show_history"
14-
label="显示历史记录"
15-
v-if="user.isEnterprise()"
16-
/>
17-
<el-checkbox
18-
v-model="form.draggable"
19-
label="可拖拽位置(浮窗模式)"
20-
v-if="user.isEnterprise()"
21-
/>
22-
<el-checkbox
23-
v-model="form.show_guide"
24-
label="显示引导图(浮窗模式)"
25-
v-if="user.isEnterprise()"
12+
v-model="form.show_source"
13+
:label="isWorkFlow(detail.type) ? '显示执行详情' : '显示知识来源'"
2614
/>
2715
</el-space>
2816
</el-form-item>
29-
<el-form-item label="对话头像" v-if="user.isEnterprise()">
30-
<div class="flex mt-8">
31-
<div class="border border-r-4 mr-16" style="padding: 8px">
32-
<el-image
33-
v-if="imgUrl.avatar"
34-
:src="imgUrl.avatar"
35-
alt=""
36-
fit="cover"
37-
style="width: 50px; height: 50px; display: block"
38-
/>
39-
<LogoIcon v-else height="50px" style="width: 50px; height: 50px; display: block" />
40-
</div>
41-
42-
<el-upload
43-
ref="uploadRef"
44-
action="#"
45-
:auto-upload="false"
46-
:show-file-list="false"
47-
accept="image/jpeg, image/png, image/gif"
48-
:on-change="(file: any, fileList: any) => onChange(file, fileList, 'avatar')"
49-
>
50-
<el-button icon="Upload">{{
51-
$t('views.applicationOverview.appInfo.EditAvatarDialog.upload')
52-
}}</el-button>
53-
<template #tip>
54-
<div class="el-upload__tip info" style="margin-top: 0">
55-
建议尺寸 32*32,支持 JPG、PNG、GIF,大小不超过 10 MB
56-
</div>
57-
</template>
58-
</el-upload>
59-
</div>
60-
</el-form-item>
61-
<el-form-item label="浮窗入口图标" v-if="user.isEnterprise()">
62-
<div class="flex mt-8">
63-
<div class="border border-r-4 mr-16" style="padding: 8px">
64-
<el-image
65-
v-if="imgUrl.float_icon"
66-
:src="imgUrl.float_icon"
67-
alt=""
68-
fit="cover"
69-
style="width: 50px; height: 50px; display: block"
70-
/>
71-
<img
72-
v-else
73-
src="@/assets/logo/logo.svg"
74-
height="50px"
75-
style="width: 50px; height: 50px; display: block"
76-
/>
77-
</div>
78-
79-
<el-upload
80-
ref="uploadRef"
81-
action="#"
82-
:auto-upload="false"
83-
:show-file-list="false"
84-
accept="image/jpeg, image/png, image/gif"
85-
:on-change="(file: any, fileList: any) => onChange(file, fileList, 'float_icon')"
86-
>
87-
<el-button icon="Upload">{{
88-
$t('views.applicationOverview.appInfo.EditAvatarDialog.upload')
89-
}}</el-button>
90-
<template #tip>
91-
<div class="el-upload__tip info" style="margin-top: 0">
92-
建议尺寸 32*32,支持 JPG、PNG、GIF,大小不超过 10 MB
93-
</div>
94-
</template>
95-
</el-upload>
96-
</div>
97-
</el-form-item>
9817
</el-form>
9918
<template #footer>
10019
<span class="dialog-footer">
101-
<el-button v-if="user.isEnterprise()" type="primary" @click.prevent="resetForm" link
102-
>恢复默认
103-
</el-button>
10420
<el-button @click.prevent="dialogVisible = false"
10521
>{{ $t('views.applicationOverview.appInfo.LimitDialog.cancelButtonText') }}
10622
</el-button>
@@ -116,11 +32,9 @@ import { ref, watch } from 'vue'
11632
import { useRoute } from 'vue-router'
11733
import type { FormInstance, FormRules, UploadFiles } from 'element-plus'
11834
import applicationApi from '@/api/application'
119-
import applicationXpackApi from '@/api/application-xpack'
35+
import { isWorkFlow } from '@/utils/application'
12036
import { MsgSuccess, MsgError } from '@/utils/message'
12137
import { t } from '@/locales'
122-
import useStore from '@/stores'
123-
const { user } = useStore()
12438
12539
const route = useRoute()
12640
const {
@@ -129,33 +43,13 @@ const {
12943
13044
const emit = defineEmits(['refresh'])
13145
132-
const defaultSetting = {
133-
show_source: false,
134-
show_history: true,
135-
draggable: true,
136-
show_guide: true,
137-
avatar: '',
138-
float_icon: ''
139-
}
14046
14147
const displayFormRef = ref()
14248
const form = ref<any>({
14349
show_source: false
14450
})
14551
146-
const xpackForm = ref<any>({
147-
show_source: false,
148-
show_history: false,
149-
draggable: false,
150-
show_guide: false,
151-
avatar: '',
152-
float_icon: ''
153-
})
154-
155-
const imgUrl = ref<any>({
156-
avatar: '',
157-
float_icon: ''
158-
})
52+
const detail = ref<any>(null)
15953
16054
const dialogVisible = ref<boolean>(false)
16155
const loading = ref(false)
@@ -165,50 +59,12 @@ watch(dialogVisible, (bool) => {
16559
form.value = {
16660
show_source: false
16761
}
168-
imgUrl.value = {
169-
avatar: '',
170-
float_icon: ''
171-
}
17262
}
17363
})
17464
175-
function resetForm() {
176-
form.value = {
177-
...defaultSetting
178-
}
179-
imgUrl.value = {
180-
avatar: '',
181-
float_icon: ''
182-
}
183-
}
184-
185-
const onChange = (file: any, fileList: UploadFiles, attr: string) => {
186-
//1、判断文件大小是否合法,文件限制不能大于 10 MB
187-
const isLimit = file?.size / 1024 / 1024 < 10
188-
if (!isLimit) {
189-
// @ts-ignore
190-
MsgError(t('views.applicationOverview.appInfo.EditAvatarDialog.fileSizeExceeded'))
191-
return false
192-
} else {
193-
xpackForm.value[attr] = file.raw
194-
imgUrl.value[attr] = URL.createObjectURL(file.raw)
195-
}
196-
}
197-
198-
const open = (data: any) => {
199-
if (user.isEnterprise()) {
200-
xpackForm.value.show_source = data.show_source
201-
xpackForm.value.show_history = data.show_history
202-
xpackForm.value.draggable = data.draggable
203-
xpackForm.value.show_guide = data.show_guide
204-
xpackForm.value.avatar = data.avatar
205-
xpackForm.value.float_icon = data.float_icon
206-
imgUrl.value.avatar = data.avatar
207-
imgUrl.value.float_icon = data.float_icon
208-
form.value = xpackForm.value
209-
} else {
210-
form.value.show_source = data.show_source
211-
}
65+
const open = (data: any, content: any) => {
66+
detail.value = content
67+
form.value.show_source = data.show_source
21268
21369
dialogVisible.value = true
21470
}
@@ -217,28 +73,15 @@ const submit = async (formEl: FormInstance | undefined) => {
21773
if (!formEl) return
21874
await formEl.validate((valid, fields) => {
21975
if (valid) {
220-
if (user.isEnterprise()) {
221-
let fd = new FormData()
222-
Object.keys(form.value).map((item) => {
223-
fd.append(item, form.value[item])
224-
})
225-
applicationXpackApi.putAccessToken(id as string, fd, loading).then((res) => {
226-
emit('refresh')
227-
// @ts-ignore
228-
MsgSuccess(t('views.applicationOverview.appInfo.LimitDialog.settingSuccessMessage'))
229-
dialogVisible.value = false
230-
})
231-
} else {
232-
const obj = {
233-
show_source: form.value.show_source
234-
}
235-
applicationApi.putAccessToken(id as string, obj, loading).then((res) => {
236-
emit('refresh')
237-
// @ts-ignore
238-
MsgSuccess(t('views.applicationOverview.appInfo.LimitDialog.settingSuccessMessage'))
239-
dialogVisible.value = false
240-
})
76+
const obj = {
77+
show_source: form.value.show_source
24178
}
79+
applicationApi.putAccessToken(id as string, obj, loading).then((res) => {
80+
emit('refresh')
81+
// @ts-ignore
82+
MsgSuccess(t('views.applicationOverview.appInfo.LimitDialog.settingSuccessMessage'))
83+
dialogVisible.value = false
84+
})
24285
}
24386
})
24487
}

ui/src/views/application-overview/component/XPackDisplaySettingDialog.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,10 @@
264264
</el-card>
265265

266266
<el-space direction="vertical" alignment="start" :size="2">
267-
<el-checkbox v-model="form.show_source" label="显示知识来源" />
267+
<el-checkbox
268+
v-model="form.show_source"
269+
:label="isWorkFlow(detail.type) ? '显示执行详情' : '显示知识来源'"
270+
/>
268271
<el-checkbox v-model="form.show_history" label="显示历史记录" />
269272
<el-checkbox v-model="form.show_guide" label="显示引导图(浮窗模式)" />
270273
<el-checkbox v-model="form.disclaimer" label="免责声明" @change="changeDisclaimer" />
@@ -298,7 +301,7 @@
298301
import { computed, ref, watch } from 'vue'
299302
import { useRoute } from 'vue-router'
300303
import type { FormInstance, FormRules, UploadFiles } from 'element-plus'
301-
import { isAppIcon } from '@/utils/application'
304+
import { isAppIcon, isWorkFlow } from '@/utils/application'
302305
import applicationXpackApi from '@/api/application-xpack'
303306
import { MsgSuccess, MsgError } from '@/utils/message'
304307
import { t } from '@/locales'

ui/src/views/application-overview/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ function openDisplaySettingDialog() {
274274
if (user.isEnterprise()) {
275275
XPackDisplaySettingDialogRef.value?.open(accessToken.value, detail.value)
276276
} else {
277-
DisplaySettingDialogRef.value?.open(accessToken.value)
277+
DisplaySettingDialogRef.value?.open(accessToken.value, detail.value)
278278
}
279279
}
280280
function openEditAvatar() {

0 commit comments

Comments
 (0)