refactor: application add show_exec
This commit is contained in:
parent
8ab4456ec3
commit
66d4b6c81a
@ -26,6 +26,7 @@ class ApplicationAccessToken(AppModelMixin):
|
|||||||
base_field=models.CharField(max_length=128, blank=True)
|
base_field=models.CharField(max_length=128, blank=True)
|
||||||
, default=list)
|
, default=list)
|
||||||
show_source = models.BooleanField(default=False, verbose_name="是否显示知识来源")
|
show_source = models.BooleanField(default=False, verbose_name="是否显示知识来源")
|
||||||
|
show_exec = models.BooleanField(default=False, verbose_name="是否显示执行详情")
|
||||||
|
|
||||||
language = models.CharField(max_length=10, verbose_name="语言", default=None, null=True)
|
language = models.CharField(max_length=10, verbose_name="语言", default=None, null=True)
|
||||||
|
|
||||||
|
|||||||
@ -9,8 +9,8 @@
|
|||||||
<el-form label-position="top" ref="displayFormRef" :model="form">
|
<el-form label-position="top" ref="displayFormRef" :model="form">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<span>{{
|
<span>{{
|
||||||
$t('views.applicationOverview.appInfo.SettingDisplayDialog.languageLabel')
|
$t('views.applicationOverview.appInfo.SettingDisplayDialog.languageLabel')
|
||||||
}}</span>
|
}}</span>
|
||||||
<el-select v-model="form.language" clearable>
|
<el-select v-model="form.language" clearable>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in langList"
|
v-for="item in langList"
|
||||||
@ -24,11 +24,15 @@
|
|||||||
<el-space direction="vertical" alignment="start">
|
<el-space direction="vertical" alignment="start">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-model="form.show_source"
|
v-model="form.show_source"
|
||||||
:label="
|
:label="$t('views.applicationOverview.appInfo.SettingDisplayDialog.showSourceLabel')"
|
||||||
isWorkFlow(detail.type)
|
/>
|
||||||
? $t('views.applicationOverview.appInfo.SettingDisplayDialog.showExecutionDetail')
|
</el-space>
|
||||||
: $t('views.applicationOverview.appInfo.SettingDisplayDialog.showSourceLabel')
|
</el-form-item>
|
||||||
"
|
<el-form-item>
|
||||||
|
<el-space direction="vertical" alignment="start">
|
||||||
|
<el-checkbox
|
||||||
|
v-model="form.show_exec"
|
||||||
|
:label="$t('views.applicationOverview.appInfo.SettingDisplayDialog.showExecutionDetail')"
|
||||||
/>
|
/>
|
||||||
</el-space>
|
</el-space>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -44,16 +48,16 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch } from 'vue'
|
import {ref, watch} from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import {useRoute} from 'vue-router'
|
||||||
import type { FormInstance, FormRules, UploadFiles } from 'element-plus'
|
import type {FormInstance, FormRules, UploadFiles} from 'element-plus'
|
||||||
import applicationApi from '@/api/application/application'
|
import applicationApi from '@/api/application/application'
|
||||||
import { isWorkFlow } from '@/utils/application'
|
import {MsgSuccess, MsgError} from '@/utils/message'
|
||||||
import { MsgSuccess, MsgError } from '@/utils/message'
|
import {getBrowserLang, langList, t} from '@/locales'
|
||||||
import { getBrowserLang, langList, t } from '@/locales'
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const {
|
const {
|
||||||
params: { id }
|
params: {id}
|
||||||
} = route
|
} = route
|
||||||
|
|
||||||
const emit = defineEmits(['refresh'])
|
const emit = defineEmits(['refresh'])
|
||||||
@ -61,6 +65,7 @@ const emit = defineEmits(['refresh'])
|
|||||||
const displayFormRef = ref()
|
const displayFormRef = ref()
|
||||||
const form = ref<any>({
|
const form = ref<any>({
|
||||||
show_source: false,
|
show_source: false,
|
||||||
|
show_exec: false,
|
||||||
language: ''
|
language: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -73,6 +78,7 @@ watch(dialogVisible, (bool) => {
|
|||||||
if (!bool) {
|
if (!bool) {
|
||||||
form.value = {
|
form.value = {
|
||||||
show_source: false,
|
show_source: false,
|
||||||
|
show_exec: false,
|
||||||
language: ''
|
language: ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,6 +86,7 @@ watch(dialogVisible, (bool) => {
|
|||||||
const open = (data: any, content: any) => {
|
const open = (data: any, content: any) => {
|
||||||
detail.value = content
|
detail.value = content
|
||||||
form.value.show_source = data.show_source
|
form.value.show_source = data.show_source
|
||||||
|
form.value.show_exec = data.show_exec
|
||||||
form.value.language = data.language
|
form.value.language = data.language
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
@ -98,6 +105,6 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ open })
|
defineExpose({open})
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped></style>
|
||||||
|
|||||||
@ -17,11 +17,11 @@
|
|||||||
<div class="flex align-center">
|
<div class="flex align-center">
|
||||||
<el-button type="primary" @click.prevent="resetForm" link>
|
<el-button type="primary" @click.prevent="resetForm" link>
|
||||||
<el-icon class="mr-4">
|
<el-icon class="mr-4">
|
||||||
<Refresh />
|
<Refresh/>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
{{ $t('views.applicationOverview.appInfo.SettingDisplayDialog.restoreDefault') }}
|
{{ $t('views.applicationOverview.appInfo.SettingDisplayDialog.restoreDefault') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-divider direction="vertical" />
|
<el-divider direction="vertical"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -39,7 +39,7 @@
|
|||||||
:size="32"
|
:size="32"
|
||||||
style="background: none"
|
style="background: none"
|
||||||
>
|
>
|
||||||
<img :src="detail?.icon" alt="" />
|
<img :src="detail?.icon" alt=""/>
|
||||||
</el-avatar>
|
</el-avatar>
|
||||||
<el-avatar
|
<el-avatar
|
||||||
v-else-if="detail?.name"
|
v-else-if="detail?.name"
|
||||||
@ -72,7 +72,7 @@
|
|||||||
color: xpackForm.custom_theme?.header_font_color
|
color: xpackForm.custom_theme?.header_font_color
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<Close />
|
<Close/>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
@ -134,7 +134,7 @@
|
|||||||
style="width: 28px; height: 28px; display: block"
|
style="width: 28px; height: 28px; display: block"
|
||||||
/>
|
/>
|
||||||
<el-avatar v-else>
|
<el-avatar v-else>
|
||||||
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
|
<img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
|
||||||
</el-avatar>
|
</el-avatar>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -143,7 +143,7 @@
|
|||||||
style="position: absolute; bottom: 0; padding-bottom: 8px; box-sizing: border-box"
|
style="position: absolute; bottom: 0; padding-bottom: 8px; box-sizing: border-box"
|
||||||
class="p-16 text-center w-full"
|
class="p-16 text-center w-full"
|
||||||
>
|
>
|
||||||
<img src="@/assets/display-bg1.png" alt="" class="w-full" />
|
<img src="@/assets/display-bg1.png" alt="" class="w-full"/>
|
||||||
<el-text type="info" v-if="xpackForm.disclaimer" class="mt-8" style="font-size: 12px">
|
<el-text type="info" v-if="xpackForm.disclaimer" class="mt-8" style="font-size: 12px">
|
||||||
<auto-tooltip :content="xpackForm.disclaimer_value">
|
<auto-tooltip :content="xpackForm.disclaimer_value">
|
||||||
{{ xpackForm.disclaimer_value }}
|
{{ xpackForm.disclaimer_value }}
|
||||||
@ -177,7 +177,7 @@
|
|||||||
{{ $t('views.applicationOverview.appInfo.SettingDisplayDialog.customThemeColor') }}
|
{{ $t('views.applicationOverview.appInfo.SettingDisplayDialog.customThemeColor') }}
|
||||||
</h5>
|
</h5>
|
||||||
<div>
|
<div>
|
||||||
<el-color-picker v-model="xpackForm.custom_theme.theme_color" />
|
<el-color-picker v-model="xpackForm.custom_theme.theme_color"/>
|
||||||
{{
|
{{
|
||||||
!xpackForm.custom_theme.theme_color
|
!xpackForm.custom_theme.theme_color
|
||||||
? $t('views.applicationOverview.appInfo.SettingDisplayDialog.default')
|
? $t('views.applicationOverview.appInfo.SettingDisplayDialog.default')
|
||||||
@ -191,7 +191,7 @@
|
|||||||
$t('views.applicationOverview.appInfo.SettingDisplayDialog.headerTitleFontColor')
|
$t('views.applicationOverview.appInfo.SettingDisplayDialog.headerTitleFontColor')
|
||||||
}}
|
}}
|
||||||
</h5>
|
</h5>
|
||||||
<el-color-picker v-model="xpackForm.custom_theme.header_font_color" />
|
<el-color-picker v-model="xpackForm.custom_theme.header_font_color"/>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row class="w-full mb-8">
|
<el-row class="w-full mb-8">
|
||||||
@ -210,12 +210,12 @@
|
|||||||
<el-card shadow="never" class="mb-8">
|
<el-card shadow="never" class="mb-8">
|
||||||
<div class="flex-between mb-8">
|
<div class="flex-between mb-8">
|
||||||
<span class="lighter">{{
|
<span class="lighter">{{
|
||||||
$t('views.applicationOverview.appInfo.SettingDisplayDialog.AIAvatar')
|
$t('views.applicationOverview.appInfo.SettingDisplayDialog.AIAvatar')
|
||||||
}}</span>
|
}}</span>
|
||||||
<span class="flex align-center">
|
<span class="flex align-center">
|
||||||
<el-checkbox v-model="xpackForm.show_avatar">{{
|
<el-checkbox v-model="xpackForm.show_avatar">{{
|
||||||
$t('views.applicationOverview.appInfo.SettingDisplayDialog.display')
|
$t('views.applicationOverview.appInfo.SettingDisplayDialog.display')
|
||||||
}}</el-checkbox>
|
}}</el-checkbox>
|
||||||
<el-upload
|
<el-upload
|
||||||
class="ml-8"
|
class="ml-8"
|
||||||
ref="uploadRef"
|
ref="uploadRef"
|
||||||
@ -238,8 +238,8 @@
|
|||||||
<el-card shadow="never" class="mb-8">
|
<el-card shadow="never" class="mb-8">
|
||||||
<div class="flex-between mb-8">
|
<div class="flex-between mb-8">
|
||||||
<span class="lighter">{{
|
<span class="lighter">{{
|
||||||
$t('views.applicationOverview.appInfo.SettingDisplayDialog.askUserAvatar')
|
$t('views.applicationOverview.appInfo.SettingDisplayDialog.askUserAvatar')
|
||||||
}}</span>
|
}}</span>
|
||||||
<span class="flex align-center">
|
<span class="flex align-center">
|
||||||
<el-checkbox v-model="xpackForm.show_user_avatar">
|
<el-checkbox v-model="xpackForm.show_user_avatar">
|
||||||
{{
|
{{
|
||||||
@ -262,14 +262,14 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<el-text type="info" size="small"
|
<el-text type="info" size="small"
|
||||||
>{{ $t('views.applicationOverview.appInfo.SettingDisplayDialog.imageMessage') }}
|
>{{ $t('views.applicationOverview.appInfo.SettingDisplayDialog.imageMessage') }}
|
||||||
</el-text>
|
</el-text>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card shadow="never" class="mb-8">
|
<el-card shadow="never" class="mb-8">
|
||||||
<div class="flex-between mb-8">
|
<div class="flex-between mb-8">
|
||||||
<span class="lighter">{{
|
<span class="lighter">{{
|
||||||
$t('views.applicationOverview.appInfo.SettingDisplayDialog.floatIcon')
|
$t('views.applicationOverview.appInfo.SettingDisplayDialog.floatIcon')
|
||||||
}}</span>
|
}}</span>
|
||||||
<el-upload
|
<el-upload
|
||||||
ref="uploadRef"
|
ref="uploadRef"
|
||||||
action="#"
|
action="#"
|
||||||
@ -289,8 +289,8 @@
|
|||||||
<div class="border-t mt-8">
|
<div class="border-t mt-8">
|
||||||
<div class="flex-between mb-8">
|
<div class="flex-between mb-8">
|
||||||
<span class="lighter">{{
|
<span class="lighter">{{
|
||||||
$t('views.applicationOverview.appInfo.SettingDisplayDialog.iconDefaultPosition')
|
$t('views.applicationOverview.appInfo.SettingDisplayDialog.iconDefaultPosition')
|
||||||
}}</span>
|
}}</span>
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-model="xpackForm.draggable"
|
v-model="xpackForm.draggable"
|
||||||
:label="
|
:label="
|
||||||
@ -370,11 +370,11 @@
|
|||||||
<el-space direction="vertical" alignment="start" :size="2">
|
<el-space direction="vertical" alignment="start" :size="2">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-model="xpackForm.show_source"
|
v-model="xpackForm.show_source"
|
||||||
:label="
|
:label="$t('views.applicationOverview.appInfo.SettingDisplayDialog.showSourceLabel')"
|
||||||
isWorkFlow(detail.type)
|
/>
|
||||||
? $t('views.applicationOverview.appInfo.SettingDisplayDialog.showExecutionDetail')
|
<el-checkbox
|
||||||
: $t('views.applicationOverview.appInfo.SettingDisplayDialog.showSourceLabel')
|
v-model="xpackForm.show_exec"
|
||||||
"
|
:label="$t('views.applicationOverview.appInfo.SettingDisplayDialog.showExecutionDetail')"
|
||||||
/>
|
/>
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-model="xpackForm.show_history"
|
v-model="xpackForm.show_history"
|
||||||
@ -390,7 +390,7 @@
|
|||||||
@change="changeDisclaimer"
|
@change="changeDisclaimer"
|
||||||
/>
|
/>
|
||||||
<span v-if="xpackForm.disclaimer"
|
<span v-if="xpackForm.disclaimer"
|
||||||
><el-tooltip :content="xpackForm.disclaimer_value" placement="top">
|
><el-tooltip :content="xpackForm.disclaimer_value" placement="top">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="xpackForm.disclaimer_value"
|
v-model="xpackForm.disclaimer_value"
|
||||||
style="width: 422px; margin-bottom: 10px"
|
style="width: 422px; margin-bottom: 10px"
|
||||||
@ -413,28 +413,28 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref, watch } from 'vue'
|
import {computed, ref, watch} from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import {useRoute} from 'vue-router'
|
||||||
import type { FormInstance, FormRules, UploadFiles } from 'element-plus'
|
import type {FormInstance, FormRules, UploadFiles} from 'element-plus'
|
||||||
import { isWorkFlow } from '@/utils/application'
|
import {isAppIcon} from '@/utils/common'
|
||||||
import { isAppIcon } from '@/utils/common'
|
|
||||||
import applicationXpackApi from '@/api/application/application-xpack'
|
import applicationXpackApi from '@/api/application/application-xpack'
|
||||||
import { MsgSuccess, MsgError } from '@/utils/message'
|
import {MsgSuccess, MsgError} from '@/utils/message'
|
||||||
import { langList, t } from '@/locales'
|
import {langList, t} from '@/locales'
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
import { cloneDeep } from 'lodash'
|
import {cloneDeep} from 'lodash'
|
||||||
|
|
||||||
const { user } = useStore()
|
const {user} = useStore()
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const {
|
const {
|
||||||
params: { id }
|
params: {id}
|
||||||
} = route
|
} = route
|
||||||
|
|
||||||
const emit = defineEmits(['refresh'])
|
const emit = defineEmits(['refresh'])
|
||||||
|
|
||||||
const defaultSetting = {
|
const defaultSetting = {
|
||||||
show_source: false,
|
show_source: false,
|
||||||
|
show_exec: false,
|
||||||
language: '',
|
language: '',
|
||||||
show_history: true,
|
show_history: true,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
@ -452,8 +452,8 @@ const defaultSetting = {
|
|||||||
header_font_color: '#1f2329'
|
header_font_color: '#1f2329'
|
||||||
},
|
},
|
||||||
float_location: {
|
float_location: {
|
||||||
y: { type: 'bottom', value: 30 },
|
y: {type: 'bottom', value: 30},
|
||||||
x: { type: 'right', value: 0 }
|
x: {type: 'right', value: 0}
|
||||||
},
|
},
|
||||||
show_avatar: true,
|
show_avatar: true,
|
||||||
show_user_avatar: false
|
show_user_avatar: false
|
||||||
@ -463,6 +463,7 @@ const displayFormRef = ref()
|
|||||||
|
|
||||||
const xpackForm = ref<any>({
|
const xpackForm = ref<any>({
|
||||||
show_source: false,
|
show_source: false,
|
||||||
|
show_exec: false,
|
||||||
language: '',
|
language: '',
|
||||||
show_history: false,
|
show_history: false,
|
||||||
draggable: false,
|
draggable: false,
|
||||||
@ -480,8 +481,8 @@ const xpackForm = ref<any>({
|
|||||||
header_font_color: '#1f2329'
|
header_font_color: '#1f2329'
|
||||||
},
|
},
|
||||||
float_location: {
|
float_location: {
|
||||||
y: { type: 'bottom', value: 30 },
|
y: {type: 'bottom', value: 30},
|
||||||
x: { type: 'right', value: 0 }
|
x: {type: 'right', value: 0}
|
||||||
},
|
},
|
||||||
show_avatar: true,
|
show_avatar: true,
|
||||||
show_user_avatar: false
|
show_user_avatar: false
|
||||||
@ -531,6 +532,7 @@ const onChange = (file: any, fileList: UploadFiles, attr: string) => {
|
|||||||
const open = (data: any, content: any) => {
|
const open = (data: any, content: any) => {
|
||||||
detail.value = content
|
detail.value = content
|
||||||
xpackForm.value.show_source = data.show_source
|
xpackForm.value.show_source = data.show_source
|
||||||
|
xpackForm.value.show_exec = data.show_exec
|
||||||
xpackForm.value.show_history = data.show_history
|
xpackForm.value.show_history = data.show_history
|
||||||
xpackForm.value.language = data.language
|
xpackForm.value.language = data.language
|
||||||
xpackForm.value.draggable = data.draggable
|
xpackForm.value.draggable = data.draggable
|
||||||
@ -591,7 +593,7 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ open })
|
defineExpose({open})
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.setting-preview {
|
.setting-preview {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user